6.6.31-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 143/301 MIPS: scall: Save thread_info.syscall unconditionally on entry
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaxun Yang <[email protected]>
[ Upstream commit 4370b673ccf240bf7587b0cb8e6726a5ccaf1f17 ]
thread_info.syscall is used by syscall_get_nr to supply syscall nr over a thread stack frame.
Previously, thread_info.syscall is only saved at syscall_trace_enter when syscall tracing is enabled. However rest of the kernel code do expect syscall_get_nr to be available without syscall tracing. The previous design breaks collect_syscall.
Move saving process to syscall entry to fix it.
--- arch/mips/include/asm/ptrace.h | 2 +- arch/mips/kernel/asm-offsets.c | 1 + arch/mips/kernel/ptrace.c | 15 ++++++--------- arch/mips/kernel/scall32-o32.S | 23 +++++++++++++---------- arch/mips/kernel/scall64-n32.S | 3 ++- arch/mips/kernel/scall64-n64.S | 3 ++- arch/mips/kernel/scall64-o32.S | 33 +++++++++++++++++---------------- 7 files changed, 42 insertions(+), 38 deletions(-)
arch/mips/include/asm/ptrace.h +1 -1
@@ -159,7 +159,7 @@ extern unsigned long exception_ip(struct pt_regs *regs);#define exception_ip (regs) exception_ip(regs)#define profile_pc (regs) instruction_pointer(regs) -extern asmlinkage long syscall_trace_enter (struct pt_regs *regs,long syscall); +extern asmlinkage long syscall_trace_enter (struct pt_regs *regs); extern asmlinkage void syscall_trace_leave(struct pt_regs *regs);extern void die (const char *,struct pt_regs *)__noreturn ;
arch/mips/kernel/asm-offsets.c +1 -0
@@ -101,6 +101,7 @@ void output_thread_info_defines(void)OFFSET (TI_CPU , thread_info, cpu);OFFSET (TI_PRE_COUNT , thread_info, preempt_count);OFFSET (TI_REGS , thread_info, regs); +OFFSET (TI_SYSCALL , thread_info, syscall);DEFINE (_THREAD_SIZE,THREAD_SIZE );DEFINE (_THREAD_MASK,THREAD_MASK );DEFINE (_IRQ_STACK_SIZE,IRQ_STACK_SIZE );
arch/mips/kernel/ptrace.c +6 -9
@@ -1317,16 +1317,13 @@ long arch_ptrace(struct task_struct *child, long request,* Notification of system call entry/exit * - triggered by current->work.syscall_trace */ -asmlinkage long syscall_trace_enter (struct pt_regs *regs,long syscall) +asmlinkage long syscall_trace_enter (struct pt_regs *regs) {user_exit (); -current_thread_info ()->syscall = syscall; -if (test_thread_flag (TIF_SYSCALL_TRACE )) {if (ptrace_report_syscall_entry (regs))return -1 ; - syscall =current_thread_info ()->syscall; }#ifdef CONFIG_SECCOMP
@@ -1335,7 +1332,7 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)struct seccomp_data sd;unsigned long args[6 ]; - sd.nr = syscall; + sd.nr =current_thread_info ()->syscall; sd.arch =syscall_get_arch (current);syscall_get_arguments (current, regs, args);for (i =0 ; i <6 ; i++)
@@ -1345,23 +1342,23 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall) ret =__secure_computing (&sd);if (ret ==-1 )return ret; - syscall = current_thread_info()->syscall; }#endif if (unlikely (test_thread_flag (TIF_SYSCALL_TRACEPOINT )))trace_sys_enter (regs, regs->regs[2 ]); -audit_syscall_entry (syscall, regs->regs[4 ], regs->regs[5 ], +audit_syscall_entry (current_thread_info ()->syscall, + regs->regs[4 ], regs->regs[5 ], regs->regs[6 ], regs->regs[7 ]);/* * Negative syscall numbers are mistaken for rejected syscalls, but * won't have had the return value set appropriately, so we do so now. */ -if (syscall <0 ) +if (current_thread_info ()->syscall <0 )syscall_set_return_value (current, regs, -ENOSYS ,0 ); -return syscall; +return current_thread_info ()->syscall; }/*
arch/mips/kernel/scall32-o32.S +13 -10
@@ -77,6 +77,18 @@ loads_done: PTR_WD load_a7, bad_stack_a7 .previous + /* + * syscall number is in v0 unless we called syscall(__NR_###) + * where the real syscall number is in a0 + */ + subu t2, v0, __NR_O32_Linux + bnez t2, 1f /* __NR_syscall at offset 0 */ + LONG_S a0, TI_SYSCALL($28) # Save a0 as syscall number + b 2f +1: + LONG_S v0, TI_SYSCALL($28) # Save v0 as syscall number +2: + lw t0, TI_FLAGS($28) # syscall tracing enabled? li t1, _TIF_WORK_SYSCALL_ENTRY and t0, t1
@@ -114,16 +126,7 @@ syscall_trace_entry: SAVE_STATIC move a0, sp - /* - * syscall number is in v0 unless we called syscall(__NR_###) - * where the real syscall number is in a0 - */ - move a1, v0 - subu t2, v0, __NR_O32_Linux - bnez t2, 1f /* __NR_syscall at offset 0 */ - lw a1, PT_R4(sp) - -1: jal syscall_trace_enter + jal syscall_trace_enter bltz v0, 1f # seccomp failed? Skip syscall
arch/mips/kernel/scall64-n32.S +2 -1
@@ -44,6 +44,8 @@ NESTED(handle_sysn32, PT_SIZE, sp) sd a3, PT_R26(sp) # save a3 for syscall restarting + LONG_S v0, TI_SYSCALL($28) # Store syscall number + li t1, _TIF_WORK_SYSCALL_ENTRY LONG_L t0, TI_FLAGS($28) # syscall tracing enabled? and t0, t1, t0
@@ -72,7 +74,6 @@ syscall_common: n32_syscall_trace_entry: SAVE_STATIC move a0, sp - move a1, v0 jal syscall_trace_enter bltz v0, 1f # seccomp failed? Skip syscall
arch/mips/kernel/scall64-n64.S +2 -1
@@ -46,6 +46,8 @@ NESTED(handle_sys64, PT_SIZE, sp) sd a3, PT_R26(sp) # save a3 for syscall restarting + LONG_S v0, TI_SYSCALL($28) # Store syscall number + li t1, _TIF_WORK_SYSCALL_ENTRY LONG_L t0, TI_FLAGS($28) # syscall tracing enabled? and t0, t1, t0
@@ -82,7 +84,6 @@ n64_syscall_exit: syscall_trace_entry: SAVE_STATIC move a0, sp - move a1, v0 jal syscall_trace_enter bltz v0, 1f # seccomp failed? Skip syscall
arch/mips/kernel/scall64-o32.S +17 -16
@@ -79,6 +79,22 @@ loads_done: PTR_WD load_a7, bad_stack_a7 .previous + /* + * absolute syscall number is in v0 unless we called syscall(__NR_###) + * where the real syscall number is in a0 + * note: NR_syscall is the first O32 syscall but the macro is + * only defined when compiling with -mabi=32 (CONFIG_32BIT) + * therefore __NR_O32_Linux is used (4000) + */ + + subu t2, v0, __NR_O32_Linux + bnez t2, 1f /* __NR_syscall at offset 0 */ + LONG_S a0, TI_SYSCALL($28) # Save a0 as syscall number + b 2f +1: + LONG_S v0, TI_SYSCALL($28) # Save v0 as syscall number +2: + li t1, _TIF_WORK_SYSCALL_ENTRY LONG_L t0, TI_FLAGS($28) # syscall tracing enabled? and t0, t1, t0
@@ -113,22 +129,7 @@ trace_a_syscall: sd a7, PT_R11(sp) # For indirect syscalls move a0, sp - /* - * absolute syscall number is in v0 unless we called syscall(__NR_###) - * where the real syscall number is in a0 - * note: NR_syscall is the first O32 syscall but the macro is - * only defined when compiling with -mabi=32 (CONFIG_32BIT) - * therefore __NR_O32_Linux is used (4000) - */ - .set push - .set reorder - subu t1, v0, __NR_O32_Linux - move a1, v0 - bnez t1, 1f /* __NR_syscall at offset 0 */ - ld a1, PT_R4(sp) /* Arg1 for __NR_syscall case */ - .set pop - -1: jal syscall_trace_enter + jal syscall_trace_enter bltz v0, 1f # seccomp failed? Skip syscall
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 144/301 tools/power/turbostat: Fix uncore frequency file string
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Ernst <[email protected]>
[ Upstream commit 60add818ab2543b7e4f2bfeaacf2504743c1eb50 ]
Running turbostat on a 16 socket HPE Scale-up Compute 3200 (SapphireRapids) fails with:
turbostat: /sys/devices/system/cpu/intel_uncore_frequency/package_010_die_00/current_freq_khz: open failed: No such file or directory
We observe the sysfs uncore frequency directories named:
...
package_09_die_00/
package_10_die_00/
package_11_die_00/
...
package_15_die_00/
The culprit is an incorrect sprintf format string "package_0%d_die_0%d" used with each instance of reading uncore frequency files. uncore-frequency-common.c creates the sysfs directory with the format "package_%02d_die_%02d". Once the package value reaches double digits, the formats diverge.
Change each instance of "package_0%d_die_0%d" to "package_%02d_die_%02d".
[lenb: deleted the probe part of this patch, as it was already fixed]
--- tools/power/x86/turbostat/turbostat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/x86/turbostat/turbostat.c +1 -1
@@ -1969,7 +1969,7 @@ unsigned long long get_uncore_mhz(int package, int die) {char path[128 ]; -sprintf (path,"/sys/devices/system/cpu/intel_uncore_frequency/package_0%d_die_0%d/current_freq_khz" , package, +sprintf (path,"/sys/devices/system/cpu/intel_uncore_frequency/package_%02d_die_%02d/current_freq_khz" , package, die);return (snapshot_sysfs_counter (path) /1000 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 145/301 drm/amdgpu: Refine IB schedule error logging
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lijo Lazar <[email protected]>
[ Upstream commit 4b18a91faf1752f9bd69a4ed3aed2c8f6e5b0528 ]
Downgrade to debug information when IBs are skipped. Also, use dev_* to identify the device.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +5 -2
@@ -300,12 +300,15 @@ static struct dma_fence *amdgpu_job_run(struct drm_sched_job *sched_job)dma_fence_set_error (finished, -ECANCELED );if (finished->error <0 ) { -DRM_INFO ("Skip scheduling IBs!\n" ); +dev_dbg (adev->dev,"Skip scheduling IBs in ring(%s)" , + ring->name); }else { r =amdgpu_ib_schedule (ring, job->num_ibs, job->ibs, job, &fence);if (r) -DRM_ERROR ("Error scheduling IBs (%d)\n" , r); +dev_err (adev->dev, +"Error scheduling IBs (%d) in ring(%s)" , r, + ring->name); } job->job_run_counter++;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 146/301 drm/amdgpu: implement IRQ_STATE_ENABLE for SDMA v4.4.2
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Zhou <[email protected]>
[ Upstream commit f886b49feaae30acd599e37d4284836024b0f3ed ]
SDMA_CNTL is not set in some cases, driver configures it by itself.
v2: simplify code
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +3 -13
@@ -1613,19 +1613,9 @@ static int sdma_v4_4_2_set_ecc_irq_state(struct amdgpu_device *adev,u32 sdma_cntl; sdma_cntl =RREG32_SDMA (type, regSDMA_CNTL); -switch (state) { -case AMDGPU_IRQ_STATE_DISABLE : - sdma_cntl =REG_SET_FIELD (sdma_cntl,SDMA_CNTL , -DRAM_ECC_INT_ENABLE ,0 ); -WREG32_SDMA (type, regSDMA_CNTL, sdma_cntl); -break ; -/* sdma ecc interrupt is enabled by default -* driver doesn't need to do anything to -* enable the interrupt */ -case AMDGPU_IRQ_STATE_ENABLE : -default : -break ; - } + sdma_cntl =REG_SET_FIELD (sdma_cntl,SDMA_CNTL ,DRAM_ECC_INT_ENABLE , + state ==AMDGPU_IRQ_STATE_ENABLE ?1 :0 ); +WREG32_SDMA (type, regSDMA_CNTL, sdma_cntl);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 147/301 drm/amd/display: Skip on writeback when its not applicable
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Hung <[email protected]>
[ Upstream commit ecedd99a9369fb5cde601ae9abd58bca2739f1ae ]
[WHY]
dynamic memory safety error detector (KASAN) catches and generates error messages "BUG: KASAN: slab-out-of-bounds" as writeback connector does not support certain features which are not initialized.
[HOW]
Skip them when connector type is DRM_MODE_CONNECTOR_WRITEBACK.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -0
@@ -2974,6 +2974,10 @@ static int dm_resume(void *handle)/* Do mst topology probing after resuming cached state*/ drm_connector_list_iter_begin (ddev, &iter);drm_for_each_connector_iter (connector, &iter) { + +if (connector->connector_type ==DRM_MODE_CONNECTOR_WRITEBACK ) +continue ; + aconnector =to_amdgpu_dm_connector (connector);if (aconnector->dc_link->type != dc_connection_mst_branch || aconnector->mst_root)
@@ -5756,6 +5760,9 @@ get_highest_refresh_rate_mode(struct amdgpu_dm_connector *aconnector, &aconnector->base.probed_modes : &aconnector->base.modes; +if (aconnector->base.connector_type ==DRM_MODE_CONNECTOR_WRITEBACK ) +return NULL ; +if (aconnector->freesync_vid_base.clock !=0 )return &aconnector->freesync_vid_base;
@@ -8445,6 +8452,9 @@ static void amdgpu_dm_commit_audio(struct drm_device *dev,continue ; notify: +if (connector->connector_type ==DRM_MODE_CONNECTOR_WRITEBACK ) +continue ; + aconnector =to_amdgpu_dm_connector (connector);mutex_lock (&adev->dm.audio_lock);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 148/301 drm/amdgpu: Fix VCN allocation in CPX partition
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lijo Lazar <[email protected]>
[ Upstream commit f7e232de51bb1b45646e5b7dc4ebcf13510f2630 ]
VCN need not be shared in CPX mode always for all GFX 9.4.3 SOC SKUs. In certain configs, VCN instance can be exclusively allocated to a partition even under CPX mode.
--- drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c +11 -4
@@ -61,6 +61,11 @@ void aqua_vanjaram_doorbell_index_init(struct amdgpu_device *adev) adev->doorbell_index.max_assignment =AMDGPU_DOORBELL_LAYOUT1_MAX_ASSIGNMENT <<1 ; } +static bool aqua_vanjaram_xcp_vcn_shared (struct amdgpu_device *adev) +{ +return (adev->xcp_mgr->num_xcps > adev->vcn.num_vcn_inst); +} +static void aqua_vanjaram_set_xcp_id (struct amdgpu_device *adev,uint32_t inst_idx,struct amdgpu_ring *ring) {
@@ -86,7 +91,7 @@ static void aqua_vanjaram_set_xcp_id(struct amdgpu_device *adev,case AMDGPU_RING_TYPE_VCN_ENC :case AMDGPU_RING_TYPE_VCN_JPEG : ip_blk =AMDGPU_XCP_VCN ; -if (adev->xcp_mgr->mode ==AMDGPU_CPX_PARTITION_MODE ) +if (aqua_vanjaram_xcp_vcn_shared (adev)) inst_mask =1 << (inst_idx *2 );break ;default :
@@ -139,10 +144,12 @@ static int aqua_vanjaram_xcp_sched_list_update(aqua_vanjaram_xcp_gpu_sched_update (adev, ring, ring->xcp_id); -/* VCN is shared by two partitions under CPX MODE */ +/* VCN may be shared by two partitions under CPX MODE in certain +* configs. +*/ if ((ring->funcs->type ==AMDGPU_RING_TYPE_VCN_ENC || - ring->funcs->type ==AMDGPU_RING_TYPE_VCN_JPEG ) && - adev->xcp_mgr->mode ==AMDGPU_CPX_PARTITION_MODE ) + ring->funcs->type ==AMDGPU_RING_TYPE_VCN_JPEG ) && +aqua_vanjaram_xcp_vcn_shared (adev))aqua_vanjaram_xcp_gpu_sched_update (adev, ring, ring->xcp_id +1 ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 149/301 amd/amdkfd: sync all devices to wait all processes being evicted
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhigang Luo <[email protected]>
[ Upstream commit d06af584be5a769d124b7302b32a033e9559761d ]
If there are more than one device doing reset in parallel, the first device will call kfd_suspend_all_processes() to evict all processes on all devices, this call takes time to finish. other device will start reset and recover without waiting. if the process has not been evicted before doing recover, it will be restored, then caused page fault.
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +6 -11
@@ -935,7 +935,6 @@ void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm) {struct kfd_node *node;int i; -int count;if (!kfd->init_complete)return ;
@@ -943,12 +942,10 @@ void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm)/* for runtime suspend, skip locking kfd */ if (!run_pm) {mutex_lock (&kfd_processes_mutex); - count = ++kfd_locked; -mutex_unlock (&kfd_processes_mutex); -/* For first KFD device suspend all the KFD processes */ -if (count ==1 ) +if (++kfd_locked ==1 )kfd_suspend_all_processes (); +mutex_unlock (&kfd_processes_mutex); }for (i =0 ; i < kfd->num_nodes; i++) {
@@ -959,7 +956,7 @@ void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm)int kgd2kfd_resume (struct kfd_dev *kfd,bool run_pm) { -int ret, count, i; +int ret, i;if (!kfd->init_complete)return 0 ;
@@ -973,12 +970,10 @@ int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)/* for runtime resume, skip unlocking kfd */ if (!run_pm) {mutex_lock (&kfd_processes_mutex); - count = --kfd_locked; -mutex_unlock (&kfd_processes_mutex); - -WARN_ONCE (count <0 ,"KFD suspend / resume ref. error" ); -if (count ==0 ) +if (--kfd_locked ==0 ) ret =kfd_resume_all_processes (); +WARN_ONCE (kfd_locked <0 ,"KFD suspend / resume ref. error" ); +mutex_unlock (&kfd_processes_mutex); }return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 150/301 selftests: timers: Fix valid-adjtimex signed left-shift undefined behavior
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
[ Upstream commit 076361362122a6d8a4c45f172ced5576b2d4a50d ]
The struct adjtimex freq field takes a signed value who's units are in shifted (<<16) parts-per-million.
Unfortunately for negative adjustments, the straightforward use of:
freq = ppm << 16 trips undefined behavior warnings with clang:
valid-adjtimex.c:66:6: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
-499<<16,
~~~~^
valid-adjtimex.c:67:6: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
-450<<16,
~~~~^..
Fix it by using a multiply by (1 << 16) instead of shifting negative values in the valid-adjtimex test case. Align the values for better readability.
--- .../testing/selftests/timers/valid-adjtimex.c | 73 +++++++++---------- 1 file changed, 36 insertions(+), 37 deletions(-)
tools/testing/selftests/timers/valid-adjtimex.c +36 -37
@@ -21,9 +21,6 @@* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ - - -#include <stdio.h> #include <stdlib.h> #include <time.h>
@@ -62,45 +59,47 @@ int clear_time_state(void)#define NUM_FREQ_OUTOFRANGE 4#define NUM_FREQ_INVALID 2 +#define SHIFTED_PPM (1 << 16) +long valid_freq[NUM_FREQ_VALID ] = { --499 <<16 , --450 <<16 , --400 <<16 , --350 <<16 , --300 <<16 , --250 <<16 , --200 <<16 , --150 <<16 , --100 <<16 , --75 <<16 , --50 <<16 , --25 <<16 , --10 <<16 , --5 <<16 , --1 <<16 , +-499 *SHIFTED_PPM , +-450 *SHIFTED_PPM , +-400 *SHIFTED_PPM , +-350 *SHIFTED_PPM , +-300 *SHIFTED_PPM , +-250 *SHIFTED_PPM , +-200 *SHIFTED_PPM , +-150 *SHIFTED_PPM , +-100 *SHIFTED_PPM , +-75 *SHIFTED_PPM , +-50 *SHIFTED_PPM , +-25 *SHIFTED_PPM , +-10 *SHIFTED_PPM , +-5 *SHIFTED_PPM , +-1 *SHIFTED_PPM ,-1000 , -1 <<16 , -5 <<16 , -10 <<16 , -25 <<16 , -50 <<16 , -75 <<16 , -100 <<16 , -150 <<16 , -200 <<16 , -250 <<16 , -300 <<16 , -350 <<16 , -400 <<16 , -450 <<16 , -499 <<16 , +1 *SHIFTED_PPM , +5 *SHIFTED_PPM , +10 *SHIFTED_PPM , +25 *SHIFTED_PPM , +50 *SHIFTED_PPM , +75 *SHIFTED_PPM , +100 *SHIFTED_PPM , +150 *SHIFTED_PPM , +200 *SHIFTED_PPM , +250 *SHIFTED_PPM , +300 *SHIFTED_PPM , +350 *SHIFTED_PPM , +400 *SHIFTED_PPM , +450 *SHIFTED_PPM , +499 *SHIFTED_PPM , };long outofrange_freq[NUM_FREQ_OUTOFRANGE ] = { --1000 <<16 , --550 <<16 , -550 <<16 , -1000 <<16 , +-1000 *SHIFTED_PPM , +-550 *SHIFTED_PPM , +550 *SHIFTED_PPM , +1000 *SHIFTED_PPM , };#define LONG_MAX (~0UL>>1)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 151/301 Drivers: hv: vmbus: Leak pages if set_memory_encrypted() fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rick Edgecombe <[email protected]>
[ Upstream commit 03f5a999adba062456c8c818a683beb1b498983a ]
In CoCo VMs it is possible for the untrusted host to cause set_memory_encrypted() or set_memory_decrypted() to fail such that an error is returned and the resulting memory is shared. Callers need to take care to handle these errors to avoid returning decrypted (shared) memory to the page allocator, which could lead to functional or security issues.
VMBus code could free decrypted pages if set_memory_encrypted()/decrypted() fails. Leak the pages if this happens.
Message-ID: <[email protected]>
--- drivers/hv/connection.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-)
drivers/hv/connection.c +22 -7
@@ -237,8 +237,17 @@ int vmbus_connect(void) vmbus_connection.monitor_pages[0], 1); ret |=set_memory_decrypted ((unsigned long ) vmbus_connection.monitor_pages[1 ],1 ); -if (ret) +if (ret) { +/* +* If set_memory_decrypted() fails, the encryption state +* of the memory is unknown. So leak the memory instead +* of risking returning decrypted memory to the free list. +* For simplicity, always handle both pages the same. +*/ + vmbus_connection.monitor_pages[0 ] =NULL ; + vmbus_connection.monitor_pages[1 ] =NULL ; goto cleanup; + }/* * Set_memory_decrypted() will change the memory contents if
@@ -337,13 +346,19 @@ void vmbus_disconnect(void) vmbus_connection.int_page =NULL ; } -set_memory_encrypted ((unsigned long )vmbus_connection.monitor_pages[0 ],1 ); -set_memory_encrypted ((unsigned long )vmbus_connection.monitor_pages[1 ],1 ); +if (vmbus_connection.monitor_pages[0 ]) { +if (!set_memory_encrypted ( + (unsigned long )vmbus_connection.monitor_pages[0 ],1 )) +hv_free_hyperv_page (vmbus_connection.monitor_pages[0 ]); + vmbus_connection.monitor_pages[0 ] =NULL ; + } -hv_free_hyperv_page (vmbus_connection.monitor_pages[0 ]); -hv_free_hyperv_page (vmbus_connection.monitor_pages[1 ]); - vmbus_connection.monitor_pages[0 ] =NULL ; - vmbus_connection.monitor_pages[1 ] =NULL ; +if (vmbus_connection.monitor_pages[1 ]) { +if (!set_memory_encrypted ( + (unsigned long )vmbus_connection.monitor_pages[1 ],1 )) +hv_free_hyperv_page (vmbus_connection.monitor_pages[1 ]); + vmbus_connection.monitor_pages[1 ] =NULL ; + } }/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 152/301 Drivers: hv: vmbus: Track decrypted status in vmbus_gpadl
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rick Edgecombe <[email protected]>
[ Upstream commit 211f514ebf1ef5de37b1cf6df9d28a56cfd242ca ]
In CoCo VMs it is possible for the untrusted host to cause set_memory_encrypted() or set_memory_decrypted() to fail such that an error is returned and the resulting memory is shared. Callers need to take care to handle these errors to avoid returning decrypted (shared) memory to the page allocator, which could lead to functional or security issues.
In order to make sure callers of vmbus_establish_gpadl() and vmbus_teardown_gpadl() don't return decrypted/shared pages to allocators, add a field in struct vmbus_gpadl to keep track of the decryption status of the buffers. This will allow the callers to know if they should free or leak the pages.
Message-ID: <[email protected]>
--- drivers/hv/channel.c | 25 +++++++++++++++++++++---- include/linux/hyperv.h | 1 + 2 files changed, 22 insertions(+), 4 deletions(-)
drivers/hv/channel.c +21 -4
@@ -472,9 +472,18 @@ static int __vmbus_establish_gpadl(struct vmbus_channel *channel, (atomic_inc_return (&vmbus_connection.next_gpadl_handle) -1 ); ret =create_gpadl_header (type, kbuffer, size, send_offset, &msginfo); -if (ret) +if (ret) { + gpadl->decrypted = false;return ret; + } +/* +* Set the "decrypted" flag to true for the set_memory_decrypted() +* success case. In the failure case, the encryption state of the +* memory is unknown. Leave "decrypted" as true to ensure the +* memory will be leaked instead of going back on the free list. +*/ + gpadl->decrypted = true; ret =set_memory_decrypted ((unsigned long )kbuffer,PFN_UP (size));if (ret) {
@@ -563,9 +572,15 @@ static int __vmbus_establish_gpadl(struct vmbus_channel *channel,kfree (msginfo); -if (ret) -set_memory_encrypted ((unsigned long )kbuffer, -PFN_UP (size)); +if (ret) { +/* +* If set_memory_encrypted() fails, the decrypted flag is +* left as true so the memory is leaked instead of being +* put back on the free list. +*/ +if (!set_memory_encrypted ((unsigned long )kbuffer,PFN_UP (size))) + gpadl->decrypted = false; + }return ret; }
@@ -886,6 +901,8 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, struct vmbus_gpadl *gpadif (ret)pr_warn ("Fail to set mem host visibility in GPADL teardown %d.\n" , ret); + gpadl->decrypted = ret; +return ret; }EXPORT_SYMBOL_GPL (vmbus_teardown_gpadl);
include/linux/hyperv.h +1 -0
@@ -832,6 +832,7 @@ struct vmbus_gpadl {u32 gpadl_handle;u32 size;void *buffer; +bool decrypted; };struct vmbus_channel {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 153/301 hv_netvsc: Dont free decrypted memory
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rick Edgecombe <[email protected]>
[ Upstream commit bbf9ac34677b57506a13682b31a2a718934c0e31 ]
In CoCo VMs it is possible for the untrusted host to cause set_memory_encrypted() or set_memory_decrypted() to fail such that an error is returned and the resulting memory is shared. Callers need to take care to handle these errors to avoid returning decrypted (shared) memory to the page allocator, which could lead to functional or security issues.
The netvsc driver could free decrypted/shared pages if set_memory_decrypted() fails. Check the decrypted field in the gpadl to decide whether to free the memory.
Message-ID: <[email protected]>
--- drivers/net/hyperv/netvsc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/hyperv/netvsc.c +5 -2
@@ -154,8 +154,11 @@ static void free_netvsc_device(struct rcu_head *head)int i;kfree (nvdev->extension); -vfree (nvdev->recv_buf); -vfree (nvdev->send_buf); + +if (!nvdev->recv_buf_gpadl_handle.decrypted) +vfree (nvdev->recv_buf); +if (!nvdev->send_buf_gpadl_handle.decrypted) +vfree (nvdev->send_buf);bitmap_free (nvdev->send_section_map);for (i =0 ; i <VRSS_CHANNEL_MAX ; i++) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 154/301 uio_hv_generic: Dont free decrypted memory
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rick Edgecombe <[email protected]>
[ Upstream commit 3d788b2fbe6a1a1a9e3db09742b90809d51638b7 ]
In CoCo VMs it is possible for the untrusted host to cause set_memory_encrypted() or set_memory_decrypted() to fail such that an error is returned and the resulting memory is shared. Callers need to take care to handle these errors to avoid returning decrypted (shared) memory to the page allocator, which could lead to functional or security issues.
The VMBus device UIO driver could free decrypted/shared pages if set_memory_decrypted() fails. Check the decrypted field in the gpadl to decide whether to free the memory.
Message-ID: <[email protected]>
--- drivers/uio/uio_hv_generic.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/uio/uio_hv_generic.c +8 -4
@@ -181,12 +181,14 @@ hv_uio_cleanup(struct hv_device *dev, struct hv_uio_private_data *pdata) {if (pdata->send_gpadl.gpadl_handle) {vmbus_teardown_gpadl (dev->channel, &pdata->send_gpadl); -vfree (pdata->send_buf); +if (!pdata->send_gpadl.decrypted) +vfree (pdata->send_buf); }if (pdata->recv_gpadl.gpadl_handle) {vmbus_teardown_gpadl (dev->channel, &pdata->recv_gpadl); -vfree (pdata->recv_buf); +if (!pdata->recv_gpadl.decrypted) +vfree (pdata->recv_buf); } }
@@ -295,7 +297,8 @@ hv_uio_probe(struct hv_device *dev, ret =vmbus_establish_gpadl (channel, pdata->recv_buf,RECV_BUFFER_SIZE , &pdata->recv_gpadl);if (ret) { -vfree (pdata->recv_buf); +if (!pdata->recv_gpadl.decrypted) +vfree (pdata->recv_buf); goto fail_close; }
@@ -317,7 +320,8 @@ hv_uio_probe(struct hv_device *dev, ret =vmbus_establish_gpadl (channel, pdata->send_buf,SEND_BUFFER_SIZE , &pdata->send_gpadl);if (ret) { -vfree (pdata->send_buf); +if (!pdata->send_gpadl.decrypted) +vfree (pdata->send_buf); goto fail_close; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 155/301 Drivers: hv: vmbus: Dont free ring buffers that couldnt be re-encrypted
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
[ Upstream commit 30d18df6567be09c1433e81993e35e3da573ac48 ]
In CoCo VMs it is possible for the untrusted host to cause set_memory_encrypted() or set_memory_decrypted() to fail such that an error is returned and the resulting memory is shared. Callers need to take care to handle these errors to avoid returning decrypted (shared) memory to the page allocator, which could lead to functional or security issues.
The VMBus ring buffer code could free decrypted/shared pages if set_memory_decrypted() fails. Check the decrypted field in the struct vmbus_gpadl for the ring buffers to decide whether to free the memory.
Message-ID: <[email protected]>
--- drivers/hv/channel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hv/channel.c +3 -1
@@ -153,7 +153,9 @@ void vmbus_free_ring(struct vmbus_channel *channel)hv_ringbuffer_cleanup (&channel->inbound);if (channel->ringbuffer_page) { -__free_pages (channel->ringbuffer_page, +/* In a CoCo VM leak the memory if it didn't get re-encrypted */ +if (!channel->ringbuffer_gpadlhandle.decrypted) +__free_pages (channel->ringbuffer_page,get_order (channel->ringbuffer_pagecount <<PAGE_SHIFT )); channel->ringbuffer_page =NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 156/301 smb3: fix broken reconnect when password changing on the server by allowing password rotation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
[ Upstream commit 35f834265e0dc78b003aa0d1af65cafb89666b76 ]
There are various use cases that are becoming more common in which password changes are scheduled on a server(s) periodically but the clients connected to this server need to stay connected (even in the face of brief network reconnects) due to mounts which can not be easily unmounted and mounted at will, and servers that do password rotation do not always have the ability to tell the clients exactly when to the new password will be effective, so add support for an alt password ("password2=") on mount (and also remount) so that we can anticipate the upcoming change to the server without risking breaking existing mounts.
An alternative would have been to use the kernel keyring for this but the processes doing the reconnect do not have access to the keyring but do have access to the ses structure.
--- fs/smb/client/cifsglob.h | 1 + fs/smb/client/connect.c | 8 ++++++++ fs/smb/client/fs_context.c | 21 +++++++++++++++++++++ fs/smb/client/fs_context.h | 2 ++ fs/smb/client/misc.c | 1 + fs/smb/client/smb2pdu.c | 11 +++++++++++ 6 files changed, 44 insertions(+)
fs/smb/client/cifsglob.h +1 -0
@@ -1049,6 +1049,7 @@ struct cifs_ses {and after mount option parsing we fill it */ char *domainName;char *password; +char *password2;/* When key rotation used, new password may be set before it expires */ char workstation_name[CIFS_MAX_WORKSTATION_LEN ];struct session_key auth_key;struct ntlmssp_auth *ntlmssp;/* ciphertext, flags, server challenge */
fs/smb/client/connect.c +8 -0
@@ -2178,6 +2178,7 @@ cifs_set_cifscreds(struct smb3_fs_context *ctx, struct cifs_ses *ses) } ++delim; +/* BB consider adding support for password2 (Key Rotation) for multiuser in future */ ctx->password =kstrndup (delim, len,GFP_KERNEL );if (!ctx->password) { cifs_dbg(FYI, "Unable to allocate %zd bytes for password\n",
@@ -2201,6 +2202,7 @@ cifs_set_cifscreds(struct smb3_fs_context *ctx, struct cifs_ses *ses)kfree (ctx->username); ctx->username =NULL ;kfree_sensitive (ctx->password); +/* no need to free ctx->password2 since not allocated in this path */ ctx->password =NULL ; goto out_key_put; }
@@ -2312,6 +2314,12 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)if (!ses->password) goto get_ses_fail; } +/* ctx->password freed at unmount */ +if (ctx->password2) { + ses->password2 =kstrdup (ctx->password2,GFP_KERNEL ); +if (!ses->password2) + goto get_ses_fail; + }if (ctx->domainname) { ses->domainName =kstrdup (ctx->domainname,GFP_KERNEL );if (!ses->domainName)
fs/smb/client/fs_context.c +21 -0
@@ -161,6 +161,7 @@ const struct fs_parameter_spec smb3_fs_parameters[] = {fsparam_string ("username" , Opt_user),fsparam_string ("pass" , Opt_pass),fsparam_string ("password" , Opt_pass), +fsparam_string ("password2" , Opt_pass2),fsparam_string ("ip" , Opt_ip),fsparam_string ("addr" , Opt_ip), fsparam_string("domain", Opt_domain),
@@ -314,6 +315,7 @@ smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx new_ctx->nodename =NULL ; new_ctx->username =NULL ; new_ctx->password =NULL ; + new_ctx->password2 =NULL ; new_ctx->server_hostname =NULL ; new_ctx->domainname =NULL ; new_ctx->UNC =NULL ;
@@ -326,6 +328,7 @@ smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctxDUP_CTX_STR (prepath);DUP_CTX_STR (username);DUP_CTX_STR (password); +DUP_CTX_STR (password2);DUP_CTX_STR (server_hostname);DUP_CTX_STR (UNC );DUP_CTX_STR (source);
@@ -884,6 +887,8 @@ static int smb3_reconfigure(struct fs_context *fc)else {kfree_sensitive (ses->password); ses->password =kstrdup (ctx->password,GFP_KERNEL ); +kfree_sensitive (ses->password2); + ses->password2 =kstrdup (ctx->password2,GFP_KERNEL ); }STEAL_STRING (cifs_sb, ctx, domainname);STEAL_STRING (cifs_sb, ctx, nodename);
@@ -1283,6 +1288,18 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, goto cifs_parse_mount_err; }break ; +case Opt_pass2: +kfree_sensitive (ctx->password2); + ctx->password2 =NULL ; +if (strlen (param->string) ==0 ) +break ; + + ctx->password2 =kstrdup (param->string,GFP_KERNEL ); +if (ctx->password2 ==NULL ) { +cifs_errorf (fc,"OOM when copying password2 string\n" ); + goto cifs_parse_mount_err; + } +break ;case Opt_ip:if (strlen (param->string) ==0 ) { ctx->got_ip = false;
@@ -1582,6 +1599,8 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, cifs_parse_mount_err:kfree_sensitive (ctx->password); ctx->password =NULL ; +kfree_sensitive (ctx->password2); + ctx->password2 =NULL ;return -EINVAL ; }
@@ -1684,6 +1703,8 @@ smb3_cleanup_fs_context_contents(struct smb3_fs_context *ctx) ctx->username =NULL ;kfree_sensitive (ctx->password); ctx->password =NULL ; +kfree_sensitive (ctx->password2); + ctx->password2 =NULL ;kfree (ctx->server_hostname); ctx->server_hostname =NULL ;kfree (ctx->UNC);
fs/smb/client/fs_context.h +2 -0
@@ -137,6 +137,7 @@ enum cifs_param { Opt_source, Opt_user, Opt_pass, + Opt_pass2, Opt_ip, Opt_domain, Opt_srcaddr,
@@ -170,6 +171,7 @@ struct smb3_fs_context {char *username;char *password; +char *password2;char *domainname;char *source;char *server_hostname;
fs/smb/client/misc.c +1 -0
@@ -101,6 +101,7 @@ sesInfoFree(struct cifs_ses *buf_to_free)kfree (buf_to_free->serverDomain);kfree (buf_to_free->serverNOS);kfree_sensitive (buf_to_free->password); +kfree_sensitive (buf_to_free->password2);kfree (buf_to_free->user_name);kfree (buf_to_free->domainName);kfree_sensitive (buf_to_free->auth_key.response);
fs/smb/client/smb2pdu.c +11 -0
@@ -367,6 +367,17 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon, } rc =cifs_setup_session (0 , ses, server, nls_codepage); +if ((rc == -EACCES ) || (rc == -EKEYEXPIRED ) || (rc == -EKEYREVOKED )) { +/* +* Try alternate password for next reconnect (key rotation +* could be enabled on the server e.g.) if an alternate +* password is available and the current password is expired, +* but do not swap on non pwd related errors like host down +*/ +if (ses->password2) +swap (ses->password2, ses->password); + } +if ((rc == -EACCES ) && !tcon->retry) {mutex_unlock (&ses->session_mutex); rc = -EHOSTDOWN ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 157/301 iommu: mtk: fix module autoloading
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 7537e31df80cb58c27f3b6fef702534ea87a5957 ]
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded based on the alias from of_device_id table.
--- drivers/iommu/mtk_iommu.c | 1 + drivers/iommu/mtk_iommu_v1.c | 1 + 2 files changed, 2 insertions(+)
drivers/iommu/mtk_iommu.c +1 -0
@@ -1773,6 +1773,7 @@ static const struct of_device_id mtk_iommu_of_ids[] = { { .compatible = "mediatek,mt8365-m4u", .data = &mt8365_data}, {} }; +MODULE_DEVICE_TABLE (of, mtk_iommu_of_ids);static struct platform_driver mtk_iommu_driver = { .probe = mtk_iommu_probe,
drivers/iommu/mtk_iommu_v1.c +1 -0
@@ -600,6 +600,7 @@ static const struct of_device_id mtk_iommu_v1_of_ids[] = { { .compatible = "mediatek,mt2701-m4u", }, {} }; +MODULE_DEVICE_TABLE (of, mtk_iommu_v1_of_ids);static const struct component_master_ops mtk_iommu_v1_com_ops = { .bind = mtk_iommu_v1_bind,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 158/301 fs/9p: only translate RWX permissions for plain 9P2000
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joakim Sindholt <[email protected]>
[ Upstream commit cd25e15e57e68a6b18dc9323047fe9c68b99290b ]
Garbage in plain 9P2000's perm bits is allowed through, which causes it to be able to set (among others) the suid bit. This was presumably not the intent since the unix extended bits are handled explicitly and conditionally on .u.
--- fs/9p/vfs_inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/9p/vfs_inode.c +1 -1
@@ -83,7 +83,7 @@ static int p9mode2perm(struct v9fs_session_info *v9ses,int res;int mode = stat->mode; - res = mode &S_IALLUGO ; + res = mode &0777 ;/* S_IRWXUGO */ if (v9fs_proto_dotu (v9ses)) {if ((mode &P9_DMSETUID ) ==P9_DMSETUID ) res |=S_ISUID ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 159/301 fs/9p: translate O_TRUNC into OTRUNC
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joakim Sindholt <[email protected]>
[ Upstream commit 87de39e70503e04ddb58965520b15eb9efa7eef3 ]
This one hits both 9P2000 and .u as it appears v9fs has never translated the O_TRUNC flag.
--- fs/9p/vfs_inode.c | 3 +++ 1 file changed, 3 insertions(+)
fs/9p/vfs_inode.c +3 -0
@@ -178,6 +178,9 @@ int v9fs_uflags2omode(int uflags, int extended)break ; } +if (uflags &O_TRUNC ) + ret |=P9_OTRUNC ; +if (extended) {if (uflags &O_EXCL ) ret |=P9_OEXCL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 160/301 fs/9p: fix the cache always being enabled on files with qid flags
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joakim Sindholt <[email protected]>
[ Upstream commit 4e5d208cc9bd5fbc95d536fa223b4b14c37b8ca8 ]
I'm not sure why this check was ever here. After updating to 6.6 I suddenly found caching had been turned on by default and neither cache=none nor the new directio would turn it off. After walking through the new code very manually I realized that it's because the caching has to be, in effect, turned off explicitly by setting P9L_DIRECT and whenever a file has a flag, in my case QTAPPEND, it doesn't get set.
Setting aside QTDIR which seems to ignore the new fid->mode entirely, the rest of these either should be subject to the same cache rules as every other QTFILE or perhaps very explicitly not cached in the case of QTAUTH.
--- fs/9p/fid.h | 3 --- 1 file changed, 3 deletions(-)
fs/9p/fid.h +0 -3
@@ -49,9 +49,6 @@ static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry)static inline void v9fs_fid_add_modes (struct p9_fid *fid,unsigned int s_flags,unsigned int s_cache,unsigned int f_flags) { -if (fid->qid.type !=P9_QTFILE ) -return ; -if ((!s_cache) || ((fid->qid.version ==0 ) && !(s_flags &V9FS_IGNORE_QV )) || (s_flags &V9FS_DIRECT_IO ) || (f_flags &O_DIRECT )) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 161/301 9p: explicitly deny setlease attempts
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
[ Upstream commit 7a84602297d36617dbdadeba55a2567031e5165b ]
9p is a remote network protocol, and it doesn't support asynchronous notifications from the server. Ensure that we don't hand out any leases since we can't guarantee they'll be broken when a file's contents change.
--- fs/9p/vfs_file.c | 2 ++ 1 file changed, 2 insertions(+)
fs/9p/vfs_file.c +2 -0
@@ -591,6 +591,7 @@ const struct file_operations v9fs_file_operations = { .splice_read = v9fs_file_splice_read, .splice_write = iter_file_splice_write, .fsync = v9fs_file_fsync, + .setlease = simple_nosetlease, };const struct file_operations v9fs_file_operations_dotl = {
@@ -605,4 +606,5 @@ const struct file_operations v9fs_file_operations_dotl = { .splice_read = v9fs_file_splice_read, .splice_write = iter_file_splice_write, .fsync = v9fs_file_fsync_dotl, + .setlease = simple_nosetlease, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 162/301 powerpc/crypto/chacha-p10: Fix failure on non Power10
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit 69630926011c1f7170a465b7b5c228deb66e9372 ]
The chacha-p10-crypto module provides optimised chacha routines for Power10. It also selects CRYPTO_ARCH_HAVE_LIB_CHACHA which says it provides chacha_crypt_arch() to generic code.
Notably the module needs to provide chacha_crypt_arch() regardless of whether it is loaded on Power10 or an older CPU.
The implementation of chacha_crypt_arch() already has a fallback to chacha_crypt_generic(), however the module as a whole fails to load on pre-Power10, because of the use of module_cpu_feature_match().
This breaks for example loading wireguard:
jostaberry-1:~ # modprobe -v wireguard
insmod /lib/modules/6.8.0-lp155.8.g7e0e887-default/kernel/arch/powerpc/crypto/chacha-p10-crypto.ko.zst
modprobe: ERROR: could not insert 'wireguard': No such device
Fix it by removing module_cpu_feature_match(), and instead check the CPU feature manually. If the CPU feature is not found, the module still loads successfully, but doesn't register the Power10 specific algorithms. That allows chacha_crypt_generic() to remain available for use, fixing the problem.
[root@fedora ~]# modprobe -v wireguard
insmod /lib/modules/6.8.0-00001-g786a790c4d79/kernel/net/ipv4/udp_tunnel.ko insmod /lib/modules/6.8.0-00001-g786a790c4d79/kernel/net/ipv6/ip6_udp_tunnel.ko insmod /lib/modules/6.8.0-00001-g786a790c4d79/kernel/lib/crypto/libchacha.ko insmod /lib/modules/6.8.0-00001-g786a790c4d79/kernel/arch/powerpc/crypto/chacha-p10-crypto.ko insmod /lib/modules/6.8.0-00001-g786a790c4d79/kernel/lib/crypto/libchacha20poly1305.ko insmod /lib/modules/6.8.0-00001-g786a790c4d79/kernel/drivers/net/wireguard/wireguard.ko
[ 18.910452][ T721] wireguard: allowedips self-tests: pass [ 18.914999][ T721] wireguard: nonce counter self-tests: pass [ 19.029066][ T721] wireguard: ratelimiter self-tests: pass [ 19.029257][ T721] wireguard: WireGuard 1.0.0 loaded. See www.wireguard.com for information. [ 19.029361][ T721] wireguard: Copyright (C) 2015-2019 Jason A. Donenfeld <[email protected]>. All Rights Reserved.
--- arch/powerpc/crypto/chacha-p10-glue.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/powerpc/crypto/chacha-p10-glue.c +7 -1
@@ -197,6 +197,9 @@ static struct skcipher_alg algs[] = {static int __init chacha_p10_init (void ) { +if (!cpu_has_feature (CPU_FTR_ARCH_31 )) +return 0 ; +static_branch_enable (&have_p10);return crypto_register_skciphers (algs,ARRAY_SIZE (algs));
@@ -204,10 +207,13 @@ static int __init chacha_p10_init(void) static void __exit chacha_p10_exit(void) { +if (!static_branch_likely (&have_p10)) +return ; +crypto_unregister_skciphers (algs,ARRAY_SIZE (algs)); } -module_cpu_feature_match (PPC_MODULE_FEATURE_P10 , chacha_p10_init); +module_init (chacha_p10_init);module_exit (chacha_p10_exit);MODULE_DESCRIPTION ("ChaCha and XChaCha stream ciphers (P10 accelerated)" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 163/301 gpio: wcove: Use -ENOTSUPP consistently
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 0c3b532ad3fbf82884a2e7e83e37c7dcdd4d1d99 ]
The GPIO library expects the drivers to return -ENOTSUPP in some cases and not using analogue POSIX code. Make the driver to follow this.
--- drivers/gpio/gpio-wcove.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-wcove.c +1 -1
@@ -104,7 +104,7 @@ static inline int to_reg(int gpio, enum ctrl_register type)unsigned int reg = type ==CTRL_IN ?GPIO_IN_CTRL_BASE :GPIO_OUT_CTRL_BASE ;if (gpio >=WCOVE_GPIO_NUM ) -return -EOPNOTSUPP ; +return -ENOTSUPP ;return reg + gpio; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 164/301 gpio: crystalcove: Use -ENOTSUPP consistently
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit ace0ebe5c98d66889f19e0f30e2518d0c58d0e04 ]
The GPIO library expects the drivers to return -ENOTSUPP in some cases and not using analogue POSIX code. Make the driver to follow this.
--- drivers/gpio/gpio-crystalcove.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-crystalcove.c +1 -1
@@ -92,7 +92,7 @@ static inline int to_reg(int gpio, enum ctrl_register reg_type)case 0x5e :return GPIOPANELCTL ;default : -return -EOPNOTSUPP ; +return -ENOTSUPP ; } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 165/301 clk: Dont hold prepare_lock when calling kref_put()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
[ Upstream commit 6f63af7511e7058f3fa4ad5b8102210741c9f947 ]
We don't need to hold the prepare_lock when dropping a ref on a struct clk_core. The release function is only freeing memory and any code with a pointer reference has already unlinked anything pointing to the clk_core. This reduces the holding area of the prepare_lock a bit.
Note that we also don't call free_clk() with the prepare_lock held. There isn't any reason to do that.
--- drivers/clk/clk.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/clk/clk.c +5 -7
@@ -4523,7 +4523,8 @@ void clk_unregister(struct clk *clk)if (ops == &clk_nodrv_ops) {pr_err ("%s: unregistered clock: %s\n" , __func__, clk->core->name); - goto unlock; +clk_prepare_unlock (); +return ; }/* * Assign empty clock ops for consumers that might still hold
@@ -4557,11 +4558,10 @@ void clk_unregister(struct clk *clk)if (clk->core->protect_count)pr_warn ("%s: unregistering protected clock: %s\n" , __func__, clk->core->name); +clk_prepare_unlock ();kref_put (&clk->core->ref, __clk_release);free_clk (clk); -unlock: -clk_prepare_unlock (); }EXPORT_SYMBOL_GPL (clk_unregister);
@@ -4720,13 +4720,11 @@ void __clk_put(struct clk *clk)if (clk->min_rate >0 || clk->max_rate <ULONG_MAX )clk_set_rate_range_nolock (clk,0 ,ULONG_MAX ); - owner = clk->core->owner; -kref_put (&clk->core->ref, __clk_release); -clk_prepare_unlock (); + owner = clk->core->owner; +kref_put (&clk->core->ref, __clk_release);module_put (owner); -free_clk (clk); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 166/301 fs/9p: drop inodes immediately on non-.L too
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joakim Sindholt <[email protected]>
[ Upstream commit 7fd524b9bd1be210fe79035800f4bd78a41b349f ]
--- fs/9p/vfs_super.c | 1 + 1 file changed, 1 insertion(+)
fs/9p/vfs_super.c +1 -0
@@ -320,6 +320,7 @@ static const struct super_operations v9fs_super_ops = { .alloc_inode = v9fs_alloc_inode, .free_inode = v9fs_free_inode, .statfs = simple_statfs, + .drop_inode = v9fs_drop_inode, .evict_inode = v9fs_evict_inode, .show_options = v9fs_show_options, .umount_begin = v9fs_umount_begin,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 167/301 gpio: lpc32xx: fix module autoloading
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 11baa36d317321f5d54059f07d243c5a1dbbfbb2 ]
Add MODULE_DEVICE_TABLE(), so the module could be properly autoloaded based on the alias from of_device_id table.
--- drivers/gpio/gpio-lpc32xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-lpc32xx.c +1 -0
@@ -529,6 +529,7 @@ static const struct of_device_id lpc32xx_gpio_of_match[] = { { .compatible = "nxp,lpc3220-gpio", }, { }, }; +MODULE_DEVICE_TABLE (of, lpc32xx_gpio_of_match);static struct platform_driver lpc32xx_gpio_driver = { .driver = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 168/301 drm/nouveau/dp: Dont probe eDP ports twice harder
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lyude Paul <[email protected]>
[ Upstream commit bf52d7f9b2067f02efe7e32697479097aba4a055 ]
I didn't pay close enough attention the last time I tried to fix this problem - while we currently do correctly take care to make sure we don't probe a connected eDP port more then once, we don't do the same thing for eDP ports we found to be disconnected.
So, fix this and make sure we only ever probe eDP ports once and then leave them at that connector state forever (since without HPD, it's not going to change on its own anyway). This should get rid of the last few GSP errors getting spit out during runtime suspend and resume on some machines, as we tried to reprobe eDP ports in response to ACPI hotplug probe events.
--- drivers/gpu/drm/nouveau/nouveau_dp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/nouveau/nouveau_dp.c +8 -5
@@ -108,12 +108,15 @@ nouveau_dp_detect(struct nouveau_connector *nv_connector,u8 *dpcd = nv_encoder->dp.dpcd;int ret =NOUVEAU_DP_NONE , hpd; -/* If we've already read the DPCD on an eDP device, we don't need to -* reread it as it won't change +/* eDP ports don't support hotplugging - so there's no point in probing eDP ports unless we +* haven't probed them once before. */ -if (connector->connector_type == DRM_MODE_CONNECTOR_eDP && - dpcd[DP_DPCD_REV ] !=0 ) -return NOUVEAU_DP_SST ; +if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { +if (connector->status == connector_status_connected) +return NOUVEAU_DP_SST ; +else if (connector->status == connector_status_disconnected) +return NOUVEAU_DP_NONE ; + }mutex_lock (&nv_encoder->dp.hpd_irq_lock);if (mstm) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 169/301 platform/x86: ISST: Add Granite Rapids-D to HPM CPU list
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <[email protected]>
[ Upstream commit d8c2d38c4d1dee8fe8e015b9ebf65bdd8e4da99b ]
Add Granite Rapids-D to hpm_cpu_ids, so that MSR 0x54 can be used.
--- drivers/platform/x86/intel/speed_select_if/isst_if_common.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/intel/speed_select_if/isst_if_common.c +1 -0
@@ -719,6 +719,7 @@ static struct miscdevice isst_if_char_driver = { };static const struct x86_cpu_id hpm_cpu_ids[] = { +X86_MATCH_INTEL_FAM6_MODEL (GRANITERAPIDS_D ,NULL ),X86_MATCH_INTEL_FAM6_MODEL (GRANITERAPIDS_X ,NULL ),X86_MATCH_INTEL_FAM6_MODEL (ATOM_CRESTMONT_X ,NULL ), {}
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 170/301 drm/radeon: silence UBSAN warning (v3)
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 781d41fed19caf900c8405064676813dc9921d32 ]
Convert a variable sized array from [1] to [].
v2: fix up a few more.
v3: integrate comments from Kees.
--- drivers/gpu/drm/radeon/pptable.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/pptable.h +5 -5
@@ -424,7 +424,7 @@ typedef struct _ATOM_PPLIB_SUMO_CLOCK_INFO{ typedef struct _ATOM_PPLIB_STATE_V2 { //number of valid dpm levels in this state; Driver uses it to calculate the whole - //size of the state: sizeof(ATOM_PPLIB_STATE_V2) + (ucNumDPMLevels - 1) * sizeof(UCHAR) + //size of the state: struct_size(ATOM_PPLIB_STATE_V2, clockInfoIndex, ucNumDPMLevels) UCHAR ucNumDPMLevels; //a index to the array of nonClockInfos
@@ -432,14 +432,14 @@ typedef struct _ATOM_PPLIB_STATE_V2/** * Driver will read the first ucNumDPMLevels in this array */ -UCHAR clockInfoIndex[1 ]; + UCHAR clockInfoIndex[] __counted_by(ucNumDPMLevels); }ATOM_PPLIB_STATE_V2 ;typedef struct _StateArray {//how many states we have UCHAR ucNumEntries; -ATOM_PPLIB_STATE_V2 states[1 ]; + ATOM_PPLIB_STATE_V2 states[] __counted_by(ucNumEntries); }StateArray ;
@@ -450,7 +450,7 @@ typedef struct _ClockInfoArray{//sizeof(ATOM_PPLIB_CLOCK_INFO) UCHAR ucEntrySize; -UCHAR clockInfo[1 ]; + UCHAR clockInfo[] __counted_by(ucNumEntries); }ClockInfoArray; typedef struct _NonClockInfoArray{
@@ -460,7 +460,7 @@ typedef struct _NonClockInfoArray{//sizeof(ATOM_PPLIB_NONCLOCK_INFO) UCHAR ucEntrySize; -ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[1 ]; + ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[] __counted_by(ucNumEntries); }NonClockInfoArray; typedef struct _ATOM_PPLIB_Clock_Voltage_Dependency_Record
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 171/301 net:usb:qmi_wwan: support Rolling modules
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vanillan Wang <[email protected]>
[ Upstream commit d362046021ea122309da8c8e0b6850c792ca97b5 ]
Update the qmi_wwan driver support for the Rolling LTE modules.
- VID:PID 33f8:0104, RW101-GL for laptop debug M.2 cards(with RMNET interface for /Linux/Chrome OS)0x0104: RMNET, diag, at, pipe
Here are the outputs of usb-devices:
T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=5000 MxCh= 0 D: Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1 P: Vendor=33f8 ProdID=0104 Rev=05.04 S: Manufacturer=Rolling Wireless S.a.r.l. S: Product=Rolling Module S: SerialNumber=ba2eb033 C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms I: If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1431,6 +1431,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x2692, 0x9025, 4)}, /* Cellient MPL200 (rebranded Qualcomm 05c6:9025) */ {QMI_QUIRK_SET_DTR(0x1546, 0x1312, 4)}, /* u-blox LARA-R6 01B */ {QMI_QUIRK_SET_DTR(0x1546, 0x1342, 4)}, /* u-blox LARA-L6 */ + {QMI_QUIRK_SET_DTR(0x33f8, 0x0104, 4)}, /* Rolling RW101 RMNET *//* 4. Gobi 1000 devices */ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 172/301 blk-iocost: do not WARN if iocg was already offlined
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Nan <[email protected]>
[ Upstream commit 01bc4fda9ea0a6b52f12326486f07a4910666cf6 ]
In iocg_pay_debt(), warn is triggered if 'active_list' is empty, which is intended to confirm iocg is active when it has debt. However, warn can be triggered during a blkcg or disk removal, if iocg_waitq_timer_fn() is run at that time:
WARNING: CPU: 0 PID: 2344971 at block/blk-iocost.c:1402 iocg_pay_debt+0x14c/0x190 Call trace: iocg_pay_debt+0x14c/0x190 iocg_kick_waitq+0x438/0x4c0 iocg_waitq_timer_fn+0xd8/0x130 __run_hrtimer+0x144/0x45c __hrtimer_run_queues+0x16c/0x244 hrtimer_interrupt+0x2cc/0x7b0
The warn in this situation is meaningless. Since this iocg is being removed, the state of the 'active_list' is irrelevant, and 'waitq_timer' is canceled after removing 'active_list' in ioc_pd_free(), which ensures iocg is freed after iocg_waitq_timer_fn() returns.
Therefore, add the check if iocg was already offlined to avoid warn when removing a blkcg or disk.
--- block/blk-iocost.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
block/blk-iocost.c +5 -2
@@ -1439,8 +1439,11 @@ static void iocg_pay_debt(struct ioc_gq *iocg, u64 abs_vpay,lockdep_assert_held (&iocg->ioc->lock);lockdep_assert_held (&iocg->waitq.lock); -/* make sure that nobody messed with @iocg */ -WARN_ON_ONCE (list_empty (&iocg->active_list)); +/* +* make sure that nobody messed with @iocg. Check iocg->pd.online +* to avoid warn when removing blkcg or disk. +*/ +WARN_ON_ONCE (list_empty (&iocg->active_list) && iocg->pd.online);WARN_ON_ONCE (iocg->inuse >1 ); iocg->abs_vdebt -=min (abs_vpay, iocg->abs_vdebt);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 173/301 SUNRPC: add a missing rpc_stat for TCP TLS
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
[ Upstream commit 8e088a20dbe33919695a8082c0b32deb62d23b4a ]
Commit 1548036ef120 ("nfs: make the rpc_stat per net namespace") added functionality to specify rpc_stats function but missed adding it to the TCP TLS functionality. As the result, mounting with xprtsec=tls lead to the following kernel oops.
[ 128.984192] Unable to handle kernel NULL pointer dereference at virtual address 000000000000001c [ 128.985058] Mem abort info: [ 128.985372] ESR = 0x0000000096000004 [ 128.985709] EC = 0x25: DABT (current EL), IL = 32 bits [ 128.986176] SET = 0, FnV = 0 [ 128.986521] EA = 0, S1PTW = 0 [ 128.986804] FSC = 0x04: level 0 translation fault [ 128.987229] Data abort info: [ 128.987597] ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000 [ 128.988169] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 128.988811] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 128.989302] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000106c84000 [ 128.990048] [000000000000001c] pgd=0000000000000000, p4d=0000000000000000 [ 128.990736] Internal error: Oops: 0000000096000004 [#1] SMP [ 128.991168] Modules linked in: nfs_layout_nfsv41_files
rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace netfs uinput dm_mod nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 rfkill ip_set nf_tables nfnetlink qrtr vsock_loopback vmw_vsock_virtio_transport_common vmw_vsock_vmci_transport vsock sunrpc vfat fat uvcvideo videobuf2_vmalloc videobuf2_memops uvc videobuf2_v4l2 videodev videobuf2_common mc vmw_vmci xfs libcrc32c e1000e crct10dif_ce ghash_ce sha2_ce vmwgfx nvme sha256_arm64 nvme_core sr_mod cdrom sha1_ce drm_ttm_helper ttm drm_kms_helper drm sg fuse
[ 128.996466] CPU: 0 PID: 179 Comm: kworker/u4:26 Kdump: loaded Not tainted 6.8.0-rc6+ #12 [ 128.997226] Hardware name: VMware, Inc. VMware20,1/VBSA, BIOS VMW201.00V.21805430.BA64.2305221830 05/22/2023 [ 128.998084] Workqueue: xprtiod xs_tcp_tls_setup_socket [sunrpc] [ 128.998701] pstate: 81400005 (Nzcv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) [ 128.999384] pc : call_start+0x74/0x138 [sunrpc] [ 128.999809] lr : __rpc_execute+0xb8/0x3e0 [sunrpc] [ 129.000244] sp : ffff8000832b3a00 [ 129.000508] x29: ffff8000832b3a00 x28: ffff800081ac79c0 x27: ffff800081ac7000 [ 129.001111] x26: 0000000004248060 x25: 0000000000000000 x24: ffff800081596008 [ 129.001757] x23: ffff80007b087240 x22: ffff00009a509d30 x21: 0000000000000000 [ 129.002345] x20: ffff000090075600 x19: ffff00009a509d00 x18: ffffffffffffffff [ 129.002912] x17: 733d4d4554535953 x16: 42555300312d746e x15: ffff8000832b3a88 [ 129.003464] x14: ffffffffffffffff x13: ffff8000832b3a7d x12: 0000000000000008 [ 129.004021] x11: 0101010101010101 x10: ffff8000150cb560 x9 : ffff80007b087c00 [ 129.004577] x8 : ffff00009a509de0 x7 : 0000000000000000 x6 : 00000000be8c4ee3 [ 129.005026] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff000094d56680 [ 129.005425] x2 : ffff80007b0637f8 x1 : ffff000090075600 x0 : ffff00009a509d00 [ 129.005824] Call trace: [ 129.005967] call_start+0x74/0x138 [sunrpc] [ 129.006233] __rpc_execute+0xb8/0x3e0 [sunrpc] [ 129.006506] rpc_execute+0x160/0x1d8 [sunrpc] [ 129.006778] rpc_run_task+0x148/0x1f8 [sunrpc] [ 129.007204] tls_probe+0x80/0xd0 [sunrpc] [ 129.007460] rpc_ping+0x28/0x80 [sunrpc] [ 129.007715] rpc_create_xprt+0x134/0x1a0 [sunrpc] [ 129.007999] rpc_create+0x128/0x2a0 [sunrpc] [ 129.008264] xs_tcp_tls_setup_socket+0xdc/0x508 [sunrpc] [ 129.008583] process_one_work+0x174/0x3c8 [ 129.008813] worker_thread+0x2c8/0x3e0 [ 129.009033] kthread+0x100/0x110 [ 129.009225] ret_from_fork+0x10/0x20 [ 129.009432] Code: f0ffffc2 911fe042 aa1403e1 aa1303e0 (b9401c83)
--- net/sunrpc/xprtsock.c | 1 + 1 file changed, 1 insertion(+)
net/sunrpc/xprtsock.c +1 -0
@@ -2644,6 +2644,7 @@ static void xs_tcp_tls_setup_socket(struct work_struct *work) .xprtsec = { .policy = RPC_XPRTSEC_NONE, }, + .stats = upper_clnt->cl_stats, };unsigned int pflags = current->flags;struct rpc_clnt *lower_clnt;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 174/301 qibfs: fix dentry leak
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit aa23317d0268b309bb3f0801ddd0d61813ff5afb ]
simple_recursive_removal() drops the pinning references to all positives in subtree. For the cases when its argument has been kept alive by the pinning alone that's exactly the right thing to do, but here the argument comes from dcache lookup, that needs to be balanced by explicit dput().
--- drivers/infiniband/hw/qib/qib_fs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/qib/qib_fs.c +1 -0
@@ -439,6 +439,7 @@ static int remove_device_files(struct super_block *sb,return PTR_ERR (dir); }simple_recursive_removal (dir,NULL ); +dput (dir);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 175/301 xfrm: Preserve vlan tags for transport mode software GRO
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Davey <[email protected]>
[ Upstream commit 58fbfecab965014b6e3cc956a76b4a96265a1add ]
The software GRO path for esp transport mode uses skb_mac_header_rebuild prior to re-injecting the packet via the xfrm_napi_dev. This only copies skb->mac_len bytes of header which may not be sufficient if the packet contains 802.1Q tags or other VLAN tags. Worse copying only the initial header will leave a packet marked as being VLAN tagged but without the corresponding tag leading to mangling when it is later untagged.
The VLAN tags are important when receiving the decrypted esp transport mode packet after GRO processing to ensure it is received on the correct interface.
Therefore record the full mac header length in xfrm*_transport_input for later use in corresponding xfrm*_transport_finish to copy the entire mac header when rebuilding the mac header for GRO. The skb->data pointer is left pointing skb->mac_header bytes after the start of the mac header as is expected by the network stack and network and transport header offsets reset to this location.
--- include/linux/skbuff.h | 15 +++++++++++++++ include/net/xfrm.h | 3 +++ net/ipv4/xfrm4_input.c | 6 +++++- net/ipv6/xfrm6_input.c | 6 +++++- net/xfrm/xfrm_input.c | 8 ++++++++ 5 files changed, 36 insertions(+), 2 deletions(-)
include/linux/skbuff.h +15 -0
@@ -2962,6 +2962,21 @@ static inline void skb_mac_header_rebuild(struct sk_buff *skb) } } +/* Move the full mac header up to current network_header. +* Leaves skb->data pointing at offset skb->mac_len into the mac_header. +* Must be provided the complete mac header length. +*/ +static inline void skb_mac_header_rebuild_full (struct sk_buff *skb,u32 full_mac_len) +{ +if (skb_mac_header_was_set (skb)) { +const unsigned char *old_mac =skb_mac_header (skb); + +skb_set_mac_header (skb, -full_mac_len); +memmove (skb_mac_header (skb), old_mac, full_mac_len); +__skb_push (skb, full_mac_len - skb->mac_len); + } +} +static inline int skb_checksum_start_offset (const struct sk_buff *skb) {return skb->csum_start -skb_headroom (skb);
include/net/xfrm.h +3 -0
@@ -1047,6 +1047,9 @@ struct xfrm_offload {#define CRYPTO_INVALID_PACKET_SYNTAX 64#define CRYPTO_INVALID_PROTOCOL 128 +/* Used to keep whole l2 header for transport mode GRO */ +__u32 orig_mac_len; +__u8 proto;__u8 inner_ipproto; };
net/ipv4/xfrm4_input.c +5 -1
@@ -61,7 +61,11 @@ int xfrm4_transport_finish(struct sk_buff *skb, int async)ip_send_check (iph);if (xo && (xo->flags &XFRM_GRO )) { -skb_mac_header_rebuild (skb); +/* The full l2 header needs to be preserved so that re-injecting the packet at l2 +* works correctly in the presence of vlan tags. +*/ +skb_mac_header_rebuild_full (skb, xo->orig_mac_len); +skb_reset_network_header (skb);skb_reset_transport_header (skb);return 0 ; }
net/ipv6/xfrm6_input.c +5 -1
@@ -56,7 +56,11 @@ int xfrm6_transport_finish(struct sk_buff *skb, int async)skb_postpush_rcsum (skb,skb_network_header (skb), nhlen);if (xo && (xo->flags &XFRM_GRO )) { -skb_mac_header_rebuild (skb); +/* The full l2 header needs to be preserved so that re-injecting the packet at l2 +* works correctly in the presence of vlan tags. +*/ +skb_mac_header_rebuild_full (skb, xo->orig_mac_len); +skb_reset_network_header (skb);skb_reset_transport_header (skb);return 0 ; }
net/xfrm/xfrm_input.c +8 -0
@@ -388,11 +388,15 @@ static int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb)*/ static int xfrm4_transport_input (struct xfrm_state *x,struct sk_buff *skb) { +struct xfrm_offload *xo =xfrm_offload (skb);int ihl = skb->data -skb_transport_header (skb);if (skb->transport_header != skb->network_header) {memmove (skb_transport_header (skb),skb_network_header (skb), ihl); +if (xo) + xo->orig_mac_len = +skb_mac_header_was_set (skb) ?skb_mac_header_len (skb) :0 ; skb->network_header = skb->transport_header; }ip_hdr (skb)->tot_len =htons (skb->len + ihl);
@@ -403,11 +407,15 @@ static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb)static int xfrm6_transport_input (struct xfrm_state *x,struct sk_buff *skb) {#if IS_ENABLED (CONFIG_IPV6 ) +struct xfrm_offload *xo =xfrm_offload (skb);int ihl = skb->data -skb_transport_header (skb);if (skb->transport_header != skb->network_header) {memmove (skb_transport_header (skb),skb_network_header (skb), ihl); +if (xo) + xo->orig_mac_len = +skb_mac_header_was_set (skb) ?skb_mac_header_len (skb) :0 ; skb->network_header = skb->transport_header; } ipv6_hdr(skb)->payload_len = htons(skb->len + ihl -
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 176/301 ARM: 9381/1: kasan: clear stale stack poison
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boy.Wu <[email protected]>
[ Upstream commit c4238686f9093b98bd6245a348bcf059cdce23af ]
We found below OOB crash:
[ 33.452494] ================================================================== [ 33.453513] BUG: KASAN: stack-out-of-bounds in refresh_cpu_vm_stats.constprop.0+0xcc/0x2ec [ 33.454660] Write of size 164 at addr c1d03d30 by task swapper/0/0 [ 33.455515] [ 33.455767] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G O 6.1.25-mainline #1 [ 33.456880] Hardware name: Generic DT based system [ 33.457555] unwind_backtrace from show_stack+0x18/0x1c [ 33.458326] show_stack from dump_stack_lvl+0x40/0x4c [ 33.459072] dump_stack_lvl from print_report+0x158/0x4a4 [ 33.459863] print_report from kasan_report+0x9c/0x148 [ 33.460616] kasan_report from kasan_check_range+0x94/0x1a0 [ 33.461424] kasan_check_range from memset+0x20/0x3c [ 33.462157] memset from refresh_cpu_vm_stats.constprop.0+0xcc/0x2ec [ 33.463064] refresh_cpu_vm_stats.constprop.0 from tick_nohz_idle_stop_tick+0x180/0x53c [ 33.464181] tick_nohz_idle_stop_tick from do_idle+0x264/0x354 [ 33.465029] do_idle from cpu_startup_entry+0x20/0x24 [ 33.465769] cpu_startup_entry from rest_init+0xf0/0xf4 [ 33.466528] rest_init from arch_post_acpi_subsys_init+0x0/0x18 [ 33.467397] [ 33.467644] The buggy address belongs to stack of task swapper/0/0 [ 33.468493] and is located at offset 112 in frame: [ 33.469172] refresh_cpu_vm_stats.constprop.0+0x0/0x2ec [ 33.469917] [ 33.470165] This frame has 2 objects: [ 33.470696] [32, 76) 'global_zone_diff' [ 33.470729] [112, 276) 'global_node_diff' [ 33.471294] [ 33.472095] The buggy address belongs to the physical page: [ 33.472862] page:3cd72da8 refcount:1 mapcount:0 mapping:00000000 index:0x0 pfn:0x41d03 [ 33.473944] flags: 0x1000(reserved|zone=0) [ 33.474565] raw: 00001000 ed741470 ed741470 00000000 00000000 00000000 ffffffff 00000001 [ 33.475656] raw: 00000000 [ 33.476050] page dumped because: kasan: bad access detected [ 33.476816] [ 33.477061] Memory state around the buggy address: [ 33.477732] c1d03c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 33.478630] c1d03c80: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 00 [ 33.479526] >c1d03d00: 00 04 f2 f2 f2 f2 00 00 00 00 00 00 f1 f1 f1 f1 [ 33.480415] ^ [ 33.481195] c1d03d80: 00 00 00 00 00 00 00 00 00 00 04 f3 f3 f3 f3 f3 [ 33.482088] c1d03e00: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 [ 33.482978] ==================================================================
We find the root cause of this OOB is that arm does not clear stale stack poison in the case of cpuidle.
This patch refer to arch/arm64/kernel/sleep.S to resolve this issue.
Quoted 1 line
From cited commit [1] that explain the problem
Functions which the compiler has instrumented for KASAN place poison on the stack shadow upon entry and remove this poison prior to returning.
In the case of cpuidle, CPUs exit the kernel a number of levels deep in C code. Any instrumented functions on this critical path will leave portions of the stack shadow poisoned.
If CPUs lose context and return to the kernel via a cold path, we restore a prior context saved in __cpu_suspend_enter are forgotten, and we never remove the poison they placed in the stack shadow area by functions calls between this and the actual exit of the kernel.
Thus, (depending on stackframe layout) subsequent calls to instrumented functions may hit this stale poison, resulting in (spurious) KASAN splats to the console.
To avoid this, clear any stale poison from the idle thread for a CPU prior to bringing a CPU online.
Quoted 1 line
From cited commit [2]
Extend to check for CONFIG_KASAN_STACK
[1] commit 0d97e6d8024c ("arm64: kasan: clear stale stack poison")
[2] commit d56a9ef84bd0 ("kasan, arm64: unpoison stack only with CONFIG_KASAN_STACK")
--- arch/arm/kernel/sleep.S | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/kernel/sleep.S +4 -0
@@ -127,6 +127,10 @@ cpu_resume_after_mmu: instr_sync #endif bl cpu_init @ restore the und/abt/irq banked regs +#if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK) + mov r0, sp + bl kasan_unpoison_task_stack_below +#endif mov r0, #0 @ return zero on success ldmfd sp!, {r4 - r11, pc} ENDPROC(cpu_resume_after_mmu)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 177/301 tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets
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 94062790aedb505bdda209b10bea47b294d6394f ]
TCP_SYN_RECV state is really special, it is only used by cross-syn connections, mostly used by fuzzers.
In the following crash [1], syzbot managed to trigger a divide by zero in tcp_rcv_space_adjust()
A socket makes the following state transitions, without ever calling tcp_init_transfer(), meaning tcp_init_buffer_space() is also not called.
TCP_CLOSEconnect()
TCP_SYN_SENT
TCP_SYN_RECVshutdown() -> tcp_shutdown(sk, SEND_SHUTDOWN)
TCP_FIN_WAIT1
To fix this issue, change tcp_shutdown() to not perform a TCP_SYN_RECV -> TCP_FIN_WAIT1 transition, which makes no sense anyway.
When tcp_rcv_state_process() later changes socket state from TCP_SYN_RECV to TCP_ESTABLISH, then look at sk->sk_shutdown to finally enter TCP_FIN_WAIT1 state, and send a FIN packet from a sane socket state.
This means tcp_send_fin() can now be called from BH context, and must use GFP_ATOMIC allocations.
[1]
divide error: 0000 [#1] PREEMPT SMP KASAN NOPTI
CPU: 1 PID: 5084 Comm: syz-executor358 Not tainted 6.9.0-rc6-syzkaller-00022-g98369dccd2f8 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 RIP: 0010:tcp_rcv_space_adjust+0x2df/0x890 net/ipv4/tcp_input.c:767 Code: e3 04 4c 01 eb 48 8b 44 24 38 0f b6 04 10 84 c0 49 89 d5 0f 85 a5 03 00 00 41 8b 8e c8 09 00 00 89 e8 29 c8 48 0f af c3 31 d2 <48> f7 f1 48 8d 1c 43 49 8d 96 76 08 00 00 48 89 d0 48 c1 e8 03 48 RSP: 0018:ffffc900031ef3f0 EFLAGS: 00010246 RAX: 0c677a10441f8f42 RBX: 000000004fb95e7e RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000027d4b11f R08: ffffffff89e535a4 R09: 1ffffffff25e6ab7 R10: dffffc0000000000 R11: ffffffff8135e920 R12: ffff88802a9f8d30 R13: dffffc0000000000 R14: ffff88802a9f8d00 R15: 1ffff1100553f2da FS: 00005555775c0380(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f1155bf2304 CR3: 000000002b9f2000 CR4: 0000000000350ef0 Call Trace: <TASK> tcp_recvmsg_locked+0x106d/0x25a0 net/ipv4/tcp.c:2513 tcp_recvmsg+0x25d/0x920 net/ipv4/tcp.c:2578 inet6_recvmsg+0x16a/0x730 net/ipv6/af_inet6.c:680 sock_recvmsg_nosec net/socket.c:1046 [inline] sock_recvmsg+0x109/0x280 net/socket.c:1068 ____sys_recvmsg+0x1db/0x470 net/socket.c:2803 ___sys_recvmsg net/socket.c:2845 [inline] do_recvmmsg+0x474/0xae0 net/socket.c:2939 __sys_recvmmsg net/socket.c:3018 [inline] __do_sys_recvmmsg net/socket.c:3041 [inline] __se_sys_recvmmsg net/socket.c:3034 [inline] __x64_sys_recvmmsg+0x199/0x250 net/socket.c:3034 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7faeb6363db9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 17 00 00 90 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:00007ffcc1997168 EFLAGS: 00000246 ORIG_RAX: 000000000000012b RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007faeb6363db9 RDX: 0000000000000001 RSI: 0000000020000bc0 RDI: 0000000000000005 RBP: 0000000000000000 R08: 0000000000000000 R09: 000000000000001c R10: 0000000000000122 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000001
--- net/ipv4/tcp.c | 4 ++-- net/ipv4/tcp_input.c | 2 ++ net/ipv4/tcp_output.c | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-)
net/ipv4/tcp.c +2 -2
@@ -2710,7 +2710,7 @@ void tcp_shutdown(struct sock *sk, int how)/* If we've already sent a FIN, or it's a closed state, skip this. */ if ((1 << sk->sk_state) & (TCPF_ESTABLISHED |TCPF_SYN_SENT | -TCPF_SYN_RECV |TCPF_CLOSE_WAIT )) { +TCPF_CLOSE_WAIT )) {/* Clear out any half completed packets. FIN if needed. */ if (tcp_close_state (sk))tcp_send_fin (sk);
@@ -2819,7 +2819,7 @@ void __tcp_close(struct sock *sk, long timeout)* machine. State transitions: * * TCP_ESTABLISHED -> TCP_FIN_WAIT1 -* TCP_SYN_RECV -> TCP_FIN_WAIT1 (forget it, it's impossible) +* TCP_SYN_RECV -> TCP_FIN_WAIT1 (it is difficult) * TCP_CLOSE_WAIT -> TCP_LAST_ACK * * are legal only when FIN has been sent (i.e. in window),
net/ipv4/tcp_input.c +2 -0
@@ -6627,6 +6627,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)tcp_initialize_rcv_mss (sk);tcp_fast_path_on (tp); +if (sk->sk_shutdown &SEND_SHUTDOWN ) +tcp_shutdown (sk,SEND_SHUTDOWN );break ;case TCP_FIN_WAIT1 : {
net/ipv4/tcp_output.c +3 -1
@@ -3533,7 +3533,9 @@ void tcp_send_fin(struct sock *sk)return ; } }else { - skb =alloc_skb_fclone (MAX_TCP_HEADER , sk->sk_allocation); + skb =alloc_skb_fclone (MAX_TCP_HEADER , +sk_gfp_mask (sk,GFP_ATOMIC | + __GFP_NOWARN));if (unlikely (!skb))return ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 178/301 tcp: Use refcount_inc_not_zero() in tcp_twsk_unique().
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 f2db7230f73a80dbb179deab78f88a7947f0ab7e ]
Anderson Nascimento reported a use-after-free splat in tcp_twsk_unique() with nice analysis.
Since commit ec94c2696f0b ("tcp/dccp: avoid one atomic operation for timewait hashdance"), inet_twsk_hashdance() sets TIME-WAIT socket's sk_refcnt after putting it into ehash and releasing the bucket lock.
Thus, there is a small race window where other threads could try to reuse the port during connect() and call sock_hold() in tcp_twsk_unique() for the TIME-WAIT socket with zero refcnt.
If that happens, the refcnt taken by tcp_twsk_unique() is overwritten and sock_put() will cause underflow, triggering a real use-after-free somewhere else.
To avoid the use-after-free, we need to use refcount_inc_not_zero() in tcp_twsk_unique() and give up on reusing the port if it returns false.
[0]:refcount_t: addition on 0; use-after-free.
WARNING: CPU: 0 PID: 1039313 at lib/refcount.c:25 refcount_warn_saturate+0xe5/0x110 CPU: 0 PID: 1039313 Comm: trigger Not tainted 6.8.6-200.fc39.x86_64 #1 Hardware name: VMware, Inc. VMware20,1/440BX Desktop Reference Platform, BIOS VMW201.00V.21805430.B64.2305221830 05/22/2023 RIP: 0010:refcount_warn_saturate+0xe5/0x110 Code: 42 8e ff 0f 0b c3 cc cc cc cc 80 3d aa 13 ea 01 00 0f 85 5e ff ff ff 48 c7 c7 f8 8e b7 82 c6 05 96 13 ea 01 01 e8 7b 42 8e ff <0f> 0b c3 cc cc cc cc 48 c7 c7 50 8f b7 82 c6 05 7a 13 ea 01 01 e8 RSP: 0018:ffffc90006b43b60 EFLAGS: 00010282 RAX: 0000000000000000 RBX: ffff888009bb3ef0 RCX: 0000000000000027 RDX: ffff88807be218c8 RSI: 0000000000000001 RDI: ffff88807be218c0 RBP: 0000000000069d70 R08: 0000000000000000 R09: ffffc90006b439f0 R10: ffffc90006b439e8 R11: 0000000000000003 R12: ffff8880029ede84 R13: 0000000000004e20 R14: ffffffff84356dc0 R15: ffff888009bb3ef0 FS: 00007f62c10926c0(0000) GS:ffff88807be00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020ccb000 CR3: 000000004628c005 CR4: 0000000000f70ef0 PKRU: 55555554 Call Trace: <TASK> ? refcount_warn_saturate+0xe5/0x110 ? __warn+0x81/0x130 ? refcount_warn_saturate+0xe5/0x110 ? report_bug+0x171/0x1a0 ? refcount_warn_saturate+0xe5/0x110 ? handle_bug+0x3c/0x80 ? exc_invalid_op+0x17/0x70 ? asm_exc_invalid_op+0x1a/0x20 ? refcount_warn_saturate+0xe5/0x110 tcp_twsk_unique+0x186/0x190 __inet_check_established+0x176/0x2d0 __inet_hash_connect+0x74/0x7d0 ? __pfx___inet_check_established+0x10/0x10 tcp_v4_connect+0x278/0x530 __inet_stream_connect+0x10f/0x3d0 inet_stream_connect+0x3a/0x60 __sys_connect+0xa8/0xd0 __x64_sys_connect+0x18/0x20 do_syscall_64+0x83/0x170 entry_SYSCALL_64_after_hwframe+0x78/0x80 RIP: 0033:0x7f62c11a885d 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 a3 45 0c 00 f7 d8 64 89 01 48 RSP: 002b:00007f62c1091e58 EFLAGS: 00000296 ORIG_RAX: 000000000000002a RAX: ffffffffffffffda RBX: 0000000020ccb004 RCX: 00007f62c11a885d RDX: 0000000000000010 RSI: 0000000020ccb000 RDI: 0000000000000003 RBP: 00007f62c1091e90 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000296 R12: 00007f62c10926c0 R13: ffffffffffffff88 R14: 0000000000000000 R15: 00007ffe237885b0 </TASK>
--- net/ipv4/tcp_ipv4.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/ipv4/tcp_ipv4.c +7 -1
@@ -154,6 +154,12 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp)if (tcptw->tw_ts_recent_stamp && (!twp || (reuse &&time_after32 (ktime_get_seconds (), tcptw->tw_ts_recent_stamp)))) { +/* inet_twsk_hashdance() sets sk_refcnt after putting twsk +* and releasing the bucket lock. +*/ +if (unlikely (!refcount_inc_not_zero (&sktw->sk_refcnt))) +return 0 ; +/* In case of repair and re-using TIME-WAIT sockets we still * want to be sure that it is safe as above but honor the * sequence numbers and time stamps set as part of the repair
@@ -174,7 +180,7 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp) tp->rx_opt.ts_recent = tcptw->tw_ts_recent; tp->rx_opt.ts_recent_stamp = tcptw->tw_ts_recent_stamp; } -sock_hold (sktw); +return 1 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 179/301 Bluetooth: Fix use-after-free bugs caused by sco_sock_timeout
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duoming Zhou <[email protected]>
[ Upstream commit 483bc08181827fc475643272ffb69c533007e546 ]
When the sco connection is established and then, the sco socket is releasing, timeout_work will be scheduled to judge whether the sco disconnection is timeout. The sock will be deallocated later, but it is dereferenced again in sco_sock_timeout. As a result, the use-after-free bugs will happen. The root cause is shown below:
Cleanup Thread | Worker Thread
sco_sock_release |
sco_sock_close |
__sco_sock_close |
sco_sock_set_timer |
schedule_delayed_work |
sco_sock_kill | (wait a time)
sock_put(sk) //FREE | sco_sock_timeout
| sock_hold(sk) //USEThe KASAN report triggered by POC is shown below:
[ 95.890016] ================================================================== [ 95.890496] BUG: KASAN: slab-use-after-free in sco_sock_timeout+0x5e/0x1c0 [ 95.890755] Write of size 4 at addr ffff88800c388080 by task kworker/0:0/7 ... [ 95.890755] Workqueue: events sco_sock_timeout [ 95.890755] Call Trace: [ 95.890755] <TASK> [ 95.890755] dump_stack_lvl+0x45/0x110 [ 95.890755] print_address_description+0x78/0x390 [ 95.890755] print_report+0x11b/0x250 [ 95.890755] ? __virt_addr_valid+0xbe/0xf0 [ 95.890755] ? sco_sock_timeout+0x5e/0x1c0 [ 95.890755] kasan_report+0x139/0x170 [ 95.890755] ? update_load_avg+0xe5/0x9f0 [ 95.890755] ? sco_sock_timeout+0x5e/0x1c0 [ 95.890755] kasan_check_range+0x2c3/0x2e0 [ 95.890755] sco_sock_timeout+0x5e/0x1c0 [ 95.890755] process_one_work+0x561/0xc50 [ 95.890755] worker_thread+0xab2/0x13c0 [ 95.890755] ? pr_cont_work+0x490/0x490 [ 95.890755] kthread+0x279/0x300 [ 95.890755] ? pr_cont_work+0x490/0x490 [ 95.890755] ? kthread_blkcg+0xa0/0xa0 [ 95.890755] ret_from_fork+0x34/0x60 [ 95.890755] ? kthread_blkcg+0xa0/0xa0 [ 95.890755] ret_from_fork_asm+0x11/0x20 [ 95.890755] </TASK> [ 95.890755] [ 95.890755] Allocated by task 506: [ 95.890755] kasan_save_track+0x3f/0x70 [ 95.890755] __kasan_kmalloc+0x86/0x90 [ 95.890755] __kmalloc+0x17f/0x360 [ 95.890755] sk_prot_alloc+0xe1/0x1a0 [ 95.890755] sk_alloc+0x31/0x4e0 [ 95.890755] bt_sock_alloc+0x2b/0x2a0 [ 95.890755] sco_sock_create+0xad/0x320 [ 95.890755] bt_sock_create+0x145/0x320 [ 95.890755] __sock_create+0x2e1/0x650 [ 95.890755] __sys_socket+0xd0/0x280 [ 95.890755] __x64_sys_socket+0x75/0x80 [ 95.890755] do_syscall_64+0xc4/0x1b0 [ 95.890755] entry_SYSCALL_64_after_hwframe+0x67/0x6f [ 95.890755] [ 95.890755] Freed by task 506: [ 95.890755] kasan_save_track+0x3f/0x70 [ 95.890755] kasan_save_free_info+0x40/0x50 [ 95.890755] poison_slab_object+0x118/0x180 [ 95.890755] __kasan_slab_free+0x12/0x30 [ 95.890755] kfree+0xb2/0x240 [ 95.890755] __sk_destruct+0x317/0x410 [ 95.890755] sco_sock_release+0x232/0x280 [ 95.890755] sock_close+0xb2/0x210 [ 95.890755] __fput+0x37f/0x770 [ 95.890755] task_work_run+0x1ae/0x210 [ 95.890755] get_signal+0xe17/0xf70 [ 95.890755] arch_do_signal_or_restart+0x3f/0x520 [ 95.890755] syscall_exit_to_user_mode+0x55/0x120 [ 95.890755] do_syscall_64+0xd1/0x1b0 [ 95.890755] entry_SYSCALL_64_after_hwframe+0x67/0x6f [ 95.890755] [ 95.890755] The buggy address belongs to the object at ffff88800c388000 [ 95.890755] which belongs to the cache kmalloc-1k of size 1024 [ 95.890755] The buggy address is located 128 bytes inside of [ 95.890755] freed 1024-byte region [ffff88800c388000, ffff88800c388400) [ 95.890755] [ 95.890755] The buggy address belongs to the physical page: [ 95.890755] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88800c38a800 pfn:0xc388 [ 95.890755] head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 [ 95.890755] anon flags: 0x100000000000840(slab|head|node=0|zone=1) [ 95.890755] page_type: 0xffffffff() [ 95.890755] raw: 0100000000000840 ffff888006842dc0 0000000000000000 0000000000000001 [ 95.890755] raw: ffff88800c38a800 000000000010000a 00000001ffffffff 0000000000000000 [ 95.890755] head: 0100000000000840 ffff888006842dc0 0000000000000000 0000000000000001 [ 95.890755] head: ffff88800c38a800 000000000010000a 00000001ffffffff 0000000000000000 [ 95.890755] head: 0100000000000003 ffffea000030e201 ffffea000030e248 00000000ffffffff [ 95.890755] head: 0000000800000000 0000000000000000 00000000ffffffff 0000000000000000 [ 95.890755] page dumped because: kasan: bad access detected [ 95.890755] [ 95.890755] Memory state around the buggy address: [ 95.890755] ffff88800c387f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 95.890755] ffff88800c388000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 95.890755] >ffff88800c388080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 95.890755] ^ [ 95.890755] ffff88800c388100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 95.890755] ffff88800c388180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 95.890755] ==================================================================
Fix this problem by adding a check protected by sco_conn_lock to judget whether the conn->hcon is null. Because the conn->hcon will be set to null, when the sock is releasing.
--- net/bluetooth/sco.c | 4 ++++ 1 file changed, 4 insertions(+)
net/bluetooth/sco.c +4 -0
@@ -83,6 +83,10 @@ static void sco_sock_timeout(struct work_struct *work)struct sock *sk;sco_conn_lock (conn); +if (!conn->hcon) { +sco_conn_unlock (conn); +return ; + } sk = conn->sk;if (sk)sock_hold (sk);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 180/301 Bluetooth: msft: fix slab-use-after-free in msft_do_close()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sungwoo Kim <[email protected]>
[ Upstream commit 10f9f426ac6e752c8d87bf4346930ba347aaabac ]
Tying the msft->data lifetime to hdev by freeing it in hci_release_dev() to fix the following case:
[use]msft_do_close()
msft = hdev->msft_data;
if (!msft) ...(1) <- passed.
return;
mutex_lock(&msft->filter_lock); ...(4) <- used after freed.
[free]msft_unregister()
msft = hdev->msft_data;
hdev->msft_data = NULL; ...(2)
kfree(msft); ...(3) <- msft is freed.
==================================================================
BUG: KASAN: slab-use-after-free in __mutex_lock_common kernel/locking/mutex.c:587 [inline] BUG: KASAN: slab-use-after-free in __mutex_lock+0x8f/0xc30 kernel/locking/mutex.c:752 Read of size 8 at addr ffff888106cbbca8 by task kworker/u5:2/309
--- net/bluetooth/hci_core.c | 3 +-- net/bluetooth/msft.c | 2 +- net/bluetooth/msft.h | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-)
net/bluetooth/hci_core.c +1 -2
@@ -2736,8 +2736,6 @@ void hci_unregister_dev(struct hci_dev *hdev)hci_unregister_suspend_notifier (hdev); -msft_unregister (hdev); -hci_dev_do_close (hdev); if (!test_bit(HCI_INIT, &hdev->flags) &&
@@ -2791,6 +2789,7 @@ void hci_release_dev(struct hci_dev *hdev)hci_discovery_filter_clear (hdev);hci_blocked_keys_clear (hdev);hci_codec_list_clear (&hdev->local_codecs); +msft_release (hdev);hci_dev_unlock (hdev);ida_destroy (&hdev->unset_handle_ida);
net/bluetooth/msft.c +1 -1
@@ -769,7 +769,7 @@ void msft_register(struct hci_dev *hdev)mutex_init (&msft->filter_lock); } -void msft_unregister (struct hci_dev *hdev) +void msft_release (struct hci_dev *hdev) {struct msft_data *msft = hdev->msft_data;
net/bluetooth/msft.h +2 -2
@@ -14,7 +14,7 @@bool msft_monitor_supported (struct hci_dev *hdev);void msft_register (struct hci_dev *hdev); -void msft_unregister (struct hci_dev *hdev); +void msft_release (struct hci_dev *hdev);void msft_do_open (struct hci_dev *hdev);void msft_do_close (struct hci_dev *hdev);void msft_vendor_evt (struct hci_dev *hdev,void *data,struct sk_buff *skb);
@@ -35,7 +35,7 @@ static inline bool msft_monitor_supported(struct hci_dev *hdev) }static inline void msft_register (struct hci_dev *hdev) {} -static inline void msft_unregister (struct hci_dev *hdev) {} +static inline void msft_release (struct hci_dev *hdev) {}static inline void msft_do_open (struct hci_dev *hdev) {}static inline void msft_do_close (struct hci_dev *hdev) {} static inline void msft_vendor_evt(struct hci_dev *hdev, void *data,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 181/301 Bluetooth: HCI: Fix potential null-ptr-deref
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sungwoo Kim <[email protected]>
[ Upstream commit d2706004a1b8b526592e823d7e52551b518a7941 ]
Fix potential null-ptr-deref in hci_le_big_sync_established_evt().
--- net/bluetooth/hci_event.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/hci_event.c +2 -0
@@ -7200,6 +7200,8 @@ static void hci_le_big_sync_established_evt(struct hci_dev *hdev, void *data,u16 handle =le16_to_cpu (ev->bis[i]); bis =hci_conn_hash_lookup_handle (hdev, handle); +if (!bis) +continue ;set_bit (HCI_CONN_BIG_SYNC_FAILED , &bis->flags);hci_connect_cfm (bis, ev->status);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 182/301 Bluetooth: l2cap: fix null-ptr-deref in l2cap_chan_timeout
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duoming Zhou <[email protected]>
[ Upstream commit adf0398cee86643b8eacde95f17d073d022f782c ]
There is a race condition between l2cap_chan_timeout() and l2cap_chan_del(). When we use l2cap_chan_del() to delete the channel, the chan->conn will be set to null. But the conn could be dereferenced again in the mutex_lock() of l2cap_chan_timeout(). As a result the null pointer dereference bug will happen. The KASAN report triggered by POC is shown below:
[ 472.074580] ================================================================== [ 472.075284] BUG: KASAN: null-ptr-deref in mutex_lock+0x68/0xc0 [ 472.075308] Write of size 8 at addr 0000000000000158 by task kworker/0:0/7 [ 472.075308] [ 472.075308] CPU: 0 PID: 7 Comm: kworker/0:0 Not tainted 6.9.0-rc5-00356-g78c0094a146b #36 [ 472.075308] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu4 [ 472.075308] Workqueue: events l2cap_chan_timeout [ 472.075308] Call Trace: [ 472.075308] <TASK> [ 472.075308] dump_stack_lvl+0x137/0x1a0 [ 472.075308] print_report+0x101/0x250 [ 472.075308] ? __virt_addr_valid+0x77/0x160 [ 472.075308] ? mutex_lock+0x68/0xc0 [ 472.075308] kasan_report+0x139/0x170 [ 472.075308] ? mutex_lock+0x68/0xc0 [ 472.075308] kasan_check_range+0x2c3/0x2e0 [ 472.075308] mutex_lock+0x68/0xc0 [ 472.075308] l2cap_chan_timeout+0x181/0x300 [ 472.075308] process_one_work+0x5d2/0xe00 [ 472.075308] worker_thread+0xe1d/0x1660 [ 472.075308] ? pr_cont_work+0x5e0/0x5e0 [ 472.075308] kthread+0x2b7/0x350 [ 472.075308] ? pr_cont_work+0x5e0/0x5e0 [ 472.075308] ? kthread_blkcg+0xd0/0xd0 [ 472.075308] ret_from_fork+0x4d/0x80 [ 472.075308] ? kthread_blkcg+0xd0/0xd0 [ 472.075308] ret_from_fork_asm+0x11/0x20 [ 472.075308] </TASK> [ 472.075308] ================================================================== [ 472.094860] Disabling lock debugging due to kernel taint [ 472.096136] BUG: kernel NULL pointer dereference, address: 0000000000000158 [ 472.096136] #PF: supervisor write access in kernel mode [ 472.096136] #PF: error_code(0x0002) - not-present page [ 472.096136] PGD 0 P4D 0 [ 472.096136] Oops: 0002 [#1] PREEMPT SMP KASAN NOPTI [ 472.096136] CPU: 0 PID: 7 Comm: kworker/0:0 Tainted: G B 6.9.0-rc5-00356-g78c0094a146b #36 [ 472.096136] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu4 [ 472.096136] Workqueue: events l2cap_chan_timeout [ 472.096136] RIP: 0010:mutex_lock+0x88/0xc0 [ 472.096136] Code: be 08 00 00 00 e8 f8 23 1f fd 4c 89 f7 be 08 00 00 00 e8 eb 23 1f fd 42 80 3c 23 00 74 08 48 88 [ 472.096136] RSP: 0018:ffff88800744fc78 EFLAGS: 00000246 [ 472.096136] RAX: 0000000000000000 RBX: 1ffff11000e89f8f RCX: ffffffff8457c865 [ 472.096136] RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff88800744fc78 [ 472.096136] RBP: 0000000000000158 R08: ffff88800744fc7f R09: 1ffff11000e89f8f [ 472.096136] R10: dffffc0000000000 R11: ffffed1000e89f90 R12: dffffc0000000000 [ 472.096136] R13: 0000000000000158 R14: ffff88800744fc78 R15: ffff888007405a00 [ 472.096136] FS: 0000000000000000(0000) GS:ffff88806d200000(0000) knlGS:0000000000000000 [ 472.096136] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 472.096136] CR2: 0000000000000158 CR3: 000000000da32000 CR4: 00000000000006f0 [ 472.096136] Call Trace: [ 472.096136] <TASK> [ 472.096136] ? __die_body+0x8d/0xe0 [ 472.096136] ? page_fault_oops+0x6b8/0x9a0 [ 472.096136] ? kernelmode_fixup_or_oops+0x20c/0x2a0 [ 472.096136] ? do_user_addr_fault+0x1027/0x1340 [ 472.096136] ? _printk+0x7a/0xa0 [ 472.096136] ? mutex_lock+0x68/0xc0 [ 472.096136] ? add_taint+0x42/0xd0 [ 472.096136] ? exc_page_fault+0x6a/0x1b0 [ 472.096136] ? asm_exc_page_fault+0x26/0x30 [ 472.096136] ? mutex_lock+0x75/0xc0 [ 472.096136] ? mutex_lock+0x88/0xc0 [ 472.096136] ? mutex_lock+0x75/0xc0 [ 472.096136] l2cap_chan_timeout+0x181/0x300 [ 472.096136] process_one_work+0x5d2/0xe00 [ 472.096136] worker_thread+0xe1d/0x1660 [ 472.096136] ? pr_cont_work+0x5e0/0x5e0 [ 472.096136] kthread+0x2b7/0x350 [ 472.096136] ? pr_cont_work+0x5e0/0x5e0 [ 472.096136] ? kthread_blkcg+0xd0/0xd0 [ 472.096136] ret_from_fork+0x4d/0x80 [ 472.096136] ? kthread_blkcg+0xd0/0xd0 [ 472.096136] ret_from_fork_asm+0x11/0x20 [ 472.096136] </TASK> [ 472.096136] Modules linked in: [ 472.096136] CR2: 0000000000000158 [ 472.096136] ---[ end trace 0000000000000000 ]--- [ 472.096136] RIP: 0010:mutex_lock+0x88/0xc0 [ 472.096136] Code: be 08 00 00 00 e8 f8 23 1f fd 4c 89 f7 be 08 00 00 00 e8 eb 23 1f fd 42 80 3c 23 00 74 08 48 88 [ 472.096136] RSP: 0018:ffff88800744fc78 EFLAGS: 00000246 [ 472.096136] RAX: 0000000000000000 RBX: 1ffff11000e89f8f RCX: ffffffff8457c865 [ 472.096136] RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff88800744fc78 [ 472.096136] RBP: 0000000000000158 R08: ffff88800744fc7f R09: 1ffff11000e89f8f [ 472.132932] R10: dffffc0000000000 R11: ffffed1000e89f90 R12: dffffc0000000000 [ 472.132932] R13: 0000000000000158 R14: ffff88800744fc78 R15: ffff888007405a00 [ 472.132932] FS: 0000000000000000(0000) GS:ffff88806d200000(0000) knlGS:0000000000000000 [ 472.132932] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 472.132932] CR2: 0000000000000158 CR3: 000000000da32000 CR4: 00000000000006f0 [ 472.132932] Kernel panic - not syncing: Fatal exception [ 472.132932] Kernel Offset: disabled [ 472.132932] ---[ end Kernel panic - not syncing: Fatal exception ]---
Add a check to judge whether the conn is null in l2cap_chan_timeout() in order to mitigate the bug.
--- net/bluetooth/l2cap_core.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/l2cap_core.c +3 -0
@@ -415,6 +415,9 @@ static void l2cap_chan_timeout(struct work_struct *work)BT_DBG ("chan %p state %s" , chan,state_to_string (chan->state)); +if (!conn) +return ; +mutex_lock (&conn->chan_lock);/* __set_chan_timer() calls l2cap_chan_hold(chan) while scheduling * this work. No need to call l2cap_chan_hold(chan) here again.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 183/301 net: ks8851: Queue RX packets in IRQ handler instead of disabling BHs
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 e0863634bf9f7cf36291ebb5bfa2d16632f79c49 ]
Currently the driver uses local_bh_disable()/local_bh_enable() in its IRQ handler to avoid triggering net_rx_action() softirq on exit from netif_rx(). The net_rx_action() could trigger this driver .start_xmit callback, which is protected by the same lock as the IRQ handler, so calling the .start_xmit from netif_rx() from the IRQ handler critical section protected by the lock could lead to an attempt to claim the already claimed lock, and a hang.
The local_bh_disable()/local_bh_enable() approach works only in case the IRQ handler is protected by a spinlock, but does not work if the IRQ handler is protected by mutex, i.e. this works for KS8851 with Parallel bus interface, but not for KS8851 with SPI bus interface.
Remove the BH manipulation and instead of calling netif_rx() inside the IRQ handler code protected by the lock, queue all the received SKBs in the IRQ handler into a queue first, and once the IRQ handler exits the critical section protected by the lock, dequeue all the queued SKBs and push them all into netif_rx(). At this point, it is safe to trigger the net_rx_action() softirq, since the netif_rx() call is outside of the lock that protects the IRQ handler.
--- drivers/net/ethernet/micrel/ks8851_common.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/net/ethernet/micrel/ks8851_common.c +10 -6
@@ -234,12 +234,13 @@ static void ks8851_dbg_dumpkkt(struct ks8851_net *ks, u8 *rxpkt)/** * ks8851_rx_pkts - receive packets from the host * @ks: The device information. +* @rxq: Queue of packets received in this function. * * This is called from the IRQ work queue when the system detects that there * are packets in the receive queue. Find out how many packets there are and * read them from the FIFO. */ -static void ks8851_rx_pkts (struct ks8851_net *ks) +static void ks8851_rx_pkts (struct ks8851_net *ks,struct sk_buff_head *rxq) {struct sk_buff *skb;unsigned rxfc;
@@ -299,7 +300,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)ks8851_dbg_dumpkkt (ks, rxpkt); skb->protocol =eth_type_trans (skb, ks->netdev); -__netif_rx (skb); +__skb_queue_tail (rxq, skb); ks->netdev->stats.rx_packets++; ks->netdev->stats.rx_bytes += rxlen;
@@ -326,11 +327,11 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)static irqreturn_t ks8851_irq (int irq,void *_ks) {struct ks8851_net *ks = _ks; +struct sk_buff_head rxq;unsigned handled =0 ;unsigned long flags;unsigned int status; - -local_bh_disable (); +struct sk_buff *skb;ks8851_lock (ks, &flags);
@@ -384,7 +385,8 @@ static irqreturn_t ks8851_irq(int irq, void *_ks)* from the device so do not bother masking just the RX * from the device. */ -ks8851_rx_pkts (ks); +__skb_queue_head_init (&rxq); +ks8851_rx_pkts (ks, &rxq); }/* if something stopped the rx process, probably due to wanting
@@ -408,7 +410,9 @@ static irqreturn_t ks8851_irq(int irq, void *_ks)if (status &IRQ_LCI )mii_check_link (&ks->mii); -local_bh_enable (); +if (status &IRQ_RXI ) +while ((skb =__skb_dequeue (&rxq))) +netif_rx (skb);return IRQ_HANDLED ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 184/301 rtnetlink: Correct nested IFLA_VF_VLAN_LIST attribute validation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roded Zats <[email protected]>
[ Upstream commit 1aec77b2bb2ed1db0f5efc61c4c1ca3813307489 ]
Each attribute inside a nested IFLA_VF_VLAN_LIST is assumed to be a struct ifla_vf_vlan_info so the size of such attribute needs to be at least of sizeof(struct ifla_vf_vlan_info) which is 14 bytes.
The current size validation in do_setvfinfo is against NLA_HDRLEN (4 bytes) which is less than sizeof(struct ifla_vf_vlan_info) so this validation is not enough and a too small attribute might be cast to a struct ifla_vf_vlan_info, this might result in an out of bands read access when accessing the saved (casted) entry in ivvl.
--- net/core/rtnetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/rtnetlink.c +1 -1
@@ -2519,7 +2519,7 @@ static int do_setvfinfo(struct net_device *dev, struct nlattr **tb)nla_for_each_nested (attr, tb[IFLA_VF_VLAN_LIST ], rem) {if (nla_type (attr) !=IFLA_VF_VLAN_INFO || -nla_len (attr) <NLA_HDRLEN ) { +nla_len (attr) <sizeof (struct ifla_vf_vlan_info )) {return -EINVAL ; }if (len >=MAX_VLAN_LIST_LEN )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 185/301 hwmon: (corsair-cpro) Use a separate buffer for sending commands
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksa Savic <[email protected]>
[ Upstream commit e0cd85dc666cb08e1bd313d560cb4eff4d04219e ]
Introduce cmd_buffer, a separate buffer for storing only the command that is sent to the device. Before this separation, the existing buffer was shared for both the command and the report received in ccp_raw_event(), which was copied into it.
However, because of hidraw, the raw event parsing may be triggered in the middle of sending a command, resulting in outputting gibberish to the device. Using a separate buffer resolves this.
--- drivers/hwmon/corsair-cpro.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/hwmon/corsair-cpro.c +12 -7
@@ -79,6 +79,7 @@ struct ccp_device {struct device *hwmon_dev;struct completion wait_input_report;struct mutex mutex;/* whenever buffer is used, lock before send_usb_cmd */ +u8 *cmd_buffer;u8 *buffer;int target[6 ];DECLARE_BITMAP (temp_cnct,NUM_TEMP_SENSORS );
@@ -111,15 +112,15 @@ static int send_usb_cmd(struct ccp_device *ccp, u8 command, u8 byte1, u8 byte2,unsigned long t;int ret; -memset (ccp->buffer,0x00 ,OUT_BUFFER_SIZE ); - ccp->buffer[0 ] = command; - ccp->buffer[1 ] = byte1; - ccp->buffer[2 ] = byte2; - ccp->buffer[3 ] = byte3; +memset (ccp->cmd_buffer,0x00 ,OUT_BUFFER_SIZE ); + ccp->cmd_buffer[0 ] = command; + ccp->cmd_buffer[1 ] = byte1; + ccp->cmd_buffer[2 ] = byte2; + ccp->cmd_buffer[3 ] = byte3;reinit_completion (&ccp->wait_input_report); - ret =hid_hw_output_report (ccp->hdev, ccp->buffer,OUT_BUFFER_SIZE ); + ret =hid_hw_output_report (ccp->hdev, ccp->cmd_buffer,OUT_BUFFER_SIZE );if (ret <0 )return ret;
@@ -492,7 +493,11 @@ static int ccp_probe(struct hid_device *hdev, const struct hid_device_id *id)if (!ccp)return -ENOMEM ; - ccp->buffer =devm_kmalloc (&hdev->dev,OUT_BUFFER_SIZE ,GFP_KERNEL ); + ccp->cmd_buffer =devm_kmalloc (&hdev->dev,OUT_BUFFER_SIZE ,GFP_KERNEL ); +if (!ccp->cmd_buffer) +return -ENOMEM ; + + ccp->buffer =devm_kmalloc (&hdev->dev,IN_BUFFER_SIZE ,GFP_KERNEL );if (!ccp->buffer)return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 186/301 hwmon: (corsair-cpro) Use complete_all() instead of complete() in ccp_raw_event()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksa Savic <[email protected]>
[ Upstream commit 3a034a7b0715eb51124a5263890b1ed39978ed3a ]
In ccp_raw_event(), the ccp->wait_input_report completion is completed once. Since we're waiting for exactly one report in send_usb_cmd(), use complete_all() instead of complete() to mark the completion as spent.
--- drivers/hwmon/corsair-cpro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/corsair-cpro.c +1 -1
@@ -140,7 +140,7 @@ static int ccp_raw_event(struct hid_device *hdev, struct hid_report *report, u8return 0 ;memcpy (ccp->buffer, data,min (IN_BUFFER_SIZE , size)); -complete (&ccp->wait_input_report); +complete_all (&ccp->wait_input_report);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 187/301 hwmon: (corsair-cpro) Protect ccp->wait_input_report with a spinlock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksa Savic <[email protected]>
[ Upstream commit d02abd57e79469a026213f7f5827a98d909f236a ]
Through hidraw, userspace can cause a status report to be sent from the device. The parsing in ccp_raw_event() may happen in parallel to a send_usb_cmd() call (which resets the completion for tracking the report) if it's running on a different CPU where bottom half interrupts are not disabled.
Add a spinlock around the complete_all() in ccp_raw_event() and reinit_completion() in send_usb_cmd() to prevent race issues.
--- drivers/hwmon/corsair-cpro.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
drivers/hwmon/corsair-cpro.c +19 -5
@@ -16,6 +16,7 @@#include <linux/module.h> #include <linux/mutex.h> #include <linux/slab.h> +#include <linux/spinlock.h> #include <linux/types.h> #define USB_VENDOR_ID_CORSAIR 0x1b1c
@@ -77,6 +78,8 @@struct ccp_device {struct hid_device *hdev;struct device *hwmon_dev; +/* For reinitializing the completion below */ +spinlock_t wait_input_report_lock;struct completion wait_input_report;struct mutex mutex;/* whenever buffer is used, lock before send_usb_cmd */ u8 *cmd_buffer;
@@ -118,7 +121,15 @@ static int send_usb_cmd(struct ccp_device *ccp, u8 command, u8 byte1, u8 byte2, ccp->cmd_buffer[2 ] = byte2; ccp->cmd_buffer[3 ] = byte3; +/* +* Disable raw event parsing for a moment to safely reinitialize the +* completion. Reinit is done because hidraw could have triggered +* the raw event parsing and marked the ccp->wait_input_report +* completion as done. +*/ +spin_lock_bh (&ccp->wait_input_report_lock);reinit_completion (&ccp->wait_input_report); +spin_unlock_bh (&ccp->wait_input_report_lock); ret =hid_hw_output_report (ccp->hdev, ccp->cmd_buffer,OUT_BUFFER_SIZE );if (ret <0 )
@@ -136,11 +147,12 @@ static int ccp_raw_event(struct hid_device *hdev, struct hid_report *report, u8struct ccp_device *ccp =hid_get_drvdata (hdev);/* only copy buffer when requested */ -if (completion_done (&ccp->wait_input_report)) -return 0 ; - -memcpy (ccp->buffer, data,min (IN_BUFFER_SIZE , size)); -complete_all (&ccp->wait_input_report); +spin_lock (&ccp->wait_input_report_lock); +if (!completion_done (&ccp->wait_input_report)) { +memcpy (ccp->buffer, data,min (IN_BUFFER_SIZE , size)); +complete_all (&ccp->wait_input_report); + } +spin_unlock (&ccp->wait_input_report_lock);return 0 ; }
@@ -515,7 +527,9 @@ static int ccp_probe(struct hid_device *hdev, const struct hid_device_id *id) ccp->hdev = hdev;hid_set_drvdata (hdev, ccp); +mutex_init (&ccp->mutex); +spin_lock_init (&ccp->wait_input_report_lock);init_completion (&ccp->wait_input_report);hid_device_io_start (hdev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 188/301 phonet: fix rtm_phonet_notify() skb allocation
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 d8cac8568618dcb8a51af3db1103e8d4cc4aeea7 ]
fill_route() stores three components in the skb:
- struct rtmsg
- RTA_DST (u8)
- RTA_OIF (u32)
Therefore, rtm_phonet_notify() should use
NLMSG_ALIGN(sizeof(struct rtmsg)) +nla_total_size(1) +nla_total_size(4)
--- net/phonet/pn_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/phonet/pn_netlink.c +1 -1
@@ -193,7 +193,7 @@ void rtm_phonet_notify(int event, struct net_device *dev, u8 dst)struct sk_buff *skb;int err = -ENOBUFS ; - skb =nlmsg_new (NLMSG_ALIGN (sizeof (struct ifaddrmsg )) + + skb =nlmsg_new (NLMSG_ALIGN (sizeof (struct rtmsg )) +nla_total_size (1 ) +nla_total_size (4 ),GFP_KERNEL );if (skb ==NULL ) goto errout;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 189/301 nfc: nci: Fix kcov check in nci_rx_work()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 19e35f24750ddf860c51e51c68cf07ea181b4881 ]
Commit 7e8cdc97148c ("nfc: Add KCOV annotations") added kcov_remote_start_common()/kcov_remote_stop() pair into nci_rx_work(), with an assumption that kcov_remote_stop() is called upon continue of the for loop. But commit d24b03535e5e ("nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet") forgot to call kcov_remote_stop() before break of the for loop.
--- net/nfc/nci/core.c | 1 + 1 file changed, 1 insertion(+)
net/nfc/nci/core.c +1 -0
@@ -1518,6 +1518,7 @@ static void nci_rx_work(struct work_struct *work)if (!nci_plen (skb->data)) {kfree_skb (skb); +kcov_remote_stop ();break ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 190/301 net: bridge: fix corrupted ethernet header on multicast-to-unicast
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 86b29d830ad69eecff25b22dc96c14c6573718e6 ]
The change from skb_copy to pskb_copy unfortunately changed the data copying to omit the ethernet header, since it was pulled before reaching this point. Fix this by calling __skb_push/pull around pskb_copy.
--- net/bridge/br_forward.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/bridge/br_forward.c +7 -2
@@ -258,6 +258,7 @@ static void maybe_deliver_addr(struct net_bridge_port *p, struct sk_buff *skb, {struct net_device *dev =BR_INPUT_SKB_CB (skb)->brdev;const unsigned char *src =eth_hdr (skb)->h_source; +struct sk_buff *nskb;if (!should_deliver (p, skb))return ;
@@ -266,12 +267,16 @@ static void maybe_deliver_addr(struct net_bridge_port *p, struct sk_buff *skb,if (skb->dev == p->dev &ðer_addr_equal (src, addr))return ; - skb =pskb_copy (skb,GFP_ATOMIC ); -if (!skb) { +__skb_push (skb,ETH_HLEN ); + nskb =pskb_copy (skb,GFP_ATOMIC ); +__skb_pull (skb,ETH_HLEN ); +if (!nskb) {DEV_STATS_INC (dev, tx_dropped);return ; } + skb = nskb; +__skb_pull (skb,ETH_HLEN );if (!is_broadcast_ether_addr (addr))memcpy (eth_hdr (skb)->h_dest, addr,ETH_ALEN );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 191/301 ipv6: Fix potential uninit-value access in __ip6_make_skb()
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 4e13d3a9c25b7080f8a619f961e943fe08c2672c ]
As it was done in commit fc1092f51567 ("ipv4: Fix uninit-value access in __ip_make_skb()") for IPv4, check FLOWI_FLAG_KNOWN_NH on fl6->flowi6_flags instead of testing HDRINCL on the socket to avoid a race condition which causes uninit-value access.
--- net/ipv6/ip6_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_output.c +1 -1
@@ -2003,7 +2003,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk,u8 icmp6_type;if (sk->sk_socket->type ==SOCK_RAW && - !inet_test_bit (HDRINCL , sk)) + !(fl6->flowi6_flags &FLOWI_FLAG_KNOWN_NH )) icmp6_type = fl6->fl6_icmp_type;else icmp6_type =icmp6_hdr (skb)->icmp6_type;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 192/301 selftests/net: convert test_bridge_neigh_suppress.sh to run it in unique namespace
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 312abe3d93a35f9c486a4703d39cab52457266f0 ]
Here is the test result after conversion.
]# ./test_bridge_neigh_suppress.sh
Per-port ARP suppression - VLAN 10
----------------------------------
TEST: arping [ OK ]
TEST: ARP suppression [ OK ]
...
TEST: NS suppression (VLAN 20) [ OK ]
Tests passed: 148
Tests failed: 0
Stable-dep-of: 9a169c267e94 ("selftests: test_bridge_neigh_suppress.sh: Fix failures due to duplicate MAC")
--- .../net/test_bridge_neigh_suppress.sh | 331 +++++++++--------- 1 file changed, 162 insertions(+), 169 deletions(-)
tools/testing/selftests/net/test_bridge_neigh_suppress.sh +162 -169
@@ -45,9 +45,8 @@ # | sw1 | | sw2 | # +------------------------------------+ +------------------------------------+ +source lib.sh ret=0 -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=4 # All tests in this script. Can be overridden with -t option. TESTS="
@@ -140,9 +139,6 @@ setup_topo_ns() { local ns=$1; shift - ip netns add $ns - ip -n $ns link set dev lo up - ip netns exec $ns sysctl -qw net.ipv6.conf.all.keep_addr_on_down=1 ip netns exec $ns sysctl -qw net.ipv6.conf.default.ignore_routes_with_linkdown=1 ip netns exec $ns sysctl -qw net.ipv6.conf.all.accept_dad=0
@@ -153,21 +149,22 @@ setup_topo() { local ns - for ns in h1 h2 sw1 sw2; do + setup_ns h1 h2 sw1 sw2 + for ns in $h1 $h2 $sw1 $sw2; do setup_topo_ns $ns done ip link add name veth0 type veth peer name veth1 - ip link set dev veth0 netns h1 name eth0 - ip link set dev veth1 netns sw1 name swp1 + ip link set dev veth0 netns $h1 name eth0 + ip link set dev veth1 netns $sw1 name swp1 ip link add name veth0 type veth peer name veth1 - ip link set dev veth0 netns sw1 name veth0 - ip link set dev veth1 netns sw2 name veth0 + ip link set dev veth0 netns $sw1 name veth0 + ip link set dev veth1 netns $sw2 name veth0 ip link add name veth0 type veth peer name veth1 - ip link set dev veth0 netns h2 name eth0 - ip link set dev veth1 netns sw2 name swp1 + ip link set dev veth0 netns $h2 name eth0 + ip link set dev veth1 netns $sw2 name swp1 } setup_host_common()
@@ -190,7 +187,7 @@ setup_host_common() setup_h1() { - local ns=h1 + local ns=$h1 local v4addr1=192.0.2.1/28 local v4addr2=192.0.2.17/28 local v6addr1=2001:db8:1::1/64
@@ -201,7 +198,7 @@ setup_h1() setup_h2() { - local ns=h2 + local ns=$h2 local v4addr1=192.0.2.2/28 local v4addr2=192.0.2.18/28 local v6addr1=2001:db8:1::2/64
@@ -254,7 +251,7 @@ setup_sw_common() setup_sw1() { - local ns=sw1 + local ns=$sw1 local local_addr=192.0.2.33 local remote_addr=192.0.2.34 local veth_addr=192.0.2.49
@@ -265,7 +262,7 @@ setup_sw1() setup_sw2() { - local ns=sw2 + local ns=$sw2 local local_addr=192.0.2.34 local remote_addr=192.0.2.33 local veth_addr=192.0.2.50
@@ -291,11 +288,7 @@ setup() cleanup() { - local ns - - for ns in h1 h2 sw1 sw2; do - ip netns del $ns &> /dev/null - done + cleanup_ns $h1 $h2 $sw1 $sw2 } ################################################################################
@@ -312,80 +305,80 @@ neigh_suppress_arp_common() echo "Per-port ARP suppression - VLAN $vid" echo "----------------------------------" - run_cmd "tc -n sw1 qdisc replace dev vx0 clsact" - run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 101 proto 0x0806 flower indev swp1 arp_tip $tip arp_sip $sip arp_op request action pass" + run_cmd "tc -n $sw1 qdisc replace dev vx0 clsact" + run_cmd "tc -n $sw1 filter replace dev vx0 egress pref 1 handle 101 proto 0x0806 flower indev swp1 arp_tip $tip arp_sip $sip arp_op request action pass" # Initial state - check that ARP requests are not suppressed and that # ARP replies are received. - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" log_test $? 0 "arping" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "ARP suppression" # Enable neighbor suppression and check that nothing changes compared # to the initial state. - run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress on" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_suppress on" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" log_test $? 0 "\"neigh_suppress\" is on" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" log_test $? 0 "arping" - tc_check_packets sw1 "dev vx0 egress" 101 2 + tc_check_packets $sw1 "dev vx0 egress" 101 2 log_test $? 0 "ARP suppression" # Install an FDB entry for the remote host and check that nothing # changes compared to the initial state. - h2_mac=$(ip -n h2 -j -p link show eth0.$vid | jq -r '.[]["address"]') - run_cmd "bridge -n sw1 fdb replace $h2_mac dev vx0 master static vlan $vid" + h2_mac=$(ip -n $h2 -j -p link show eth0.$vid | jq -r '.[]["address"]') + run_cmd "bridge -n $sw1 fdb replace $h2_mac dev vx0 master static vlan $vid" log_test $? 0 "FDB entry installation" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" log_test $? 0 "arping" - tc_check_packets sw1 "dev vx0 egress" 101 3 + tc_check_packets $sw1 "dev vx0 egress" 101 3 log_test $? 0 "ARP suppression" # Install a neighbor on the matching SVI interface and check that ARP # requests are suppressed. - run_cmd "ip -n sw1 neigh replace $tip lladdr $h2_mac nud permanent dev br0.$vid" + run_cmd "ip -n $sw1 neigh replace $tip lladdr $h2_mac nud permanent dev br0.$vid" log_test $? 0 "Neighbor entry installation" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" log_test $? 0 "arping" - tc_check_packets sw1 "dev vx0 egress" 101 3 + tc_check_packets $sw1 "dev vx0 egress" 101 3 log_test $? 0 "ARP suppression" # Take the second host down and check that ARP requests are suppressed # and that ARP replies are received. - run_cmd "ip -n h2 link set dev eth0.$vid down" + run_cmd "ip -n $h2 link set dev eth0.$vid down" log_test $? 0 "H2 down" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" log_test $? 0 "arping" - tc_check_packets sw1 "dev vx0 egress" 101 3 + tc_check_packets $sw1 "dev vx0 egress" 101 3 log_test $? 0 "ARP suppression" - run_cmd "ip -n h2 link set dev eth0.$vid up" + run_cmd "ip -n $h2 link set dev eth0.$vid up" log_test $? 0 "H2 up" # Disable neighbor suppression and check that ARP requests are no # longer suppressed. - run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress off" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress off\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_suppress off" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_suppress off\"" log_test $? 0 "\"neigh_suppress\" is off" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" log_test $? 0 "arping" - tc_check_packets sw1 "dev vx0 egress" 101 4 + tc_check_packets $sw1 "dev vx0 egress" 101 4 log_test $? 0 "ARP suppression" # Take the second host down and check that ARP requests are not # suppressed and that ARP replies are not received. - run_cmd "ip -n h2 link set dev eth0.$vid down" + run_cmd "ip -n $h2 link set dev eth0.$vid down" log_test $? 0 "H2 down" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" log_test $? 1 "arping" - tc_check_packets sw1 "dev vx0 egress" 101 5 + tc_check_packets $sw1 "dev vx0 egress" 101 5 log_test $? 0 "ARP suppression" }
@@ -415,80 +408,80 @@ neigh_suppress_ns_common() echo "Per-port NS suppression - VLAN $vid" echo "---------------------------------" - run_cmd "tc -n sw1 qdisc replace dev vx0 clsact" - run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 101 proto ipv6 flower indev swp1 ip_proto icmpv6 dst_ip $maddr src_ip $saddr type 135 code 0 action pass" + run_cmd "tc -n $sw1 qdisc replace dev vx0 clsact" + run_cmd "tc -n $sw1 filter replace dev vx0 egress pref 1 handle 101 proto ipv6 flower indev swp1 ip_proto icmpv6 dst_ip $maddr src_ip $saddr type 135 code 0 action pass" # Initial state - check that NS messages are not suppressed and that ND # messages are received. - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" log_test $? 0 "ndisc6" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "NS suppression" # Enable neighbor suppression and check that nothing changes compared # to the initial state. - run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress on" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_suppress on" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" log_test $? 0 "\"neigh_suppress\" is on" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" log_test $? 0 "ndisc6" - tc_check_packets sw1 "dev vx0 egress" 101 2 + tc_check_packets $sw1 "dev vx0 egress" 101 2 log_test $? 0 "NS suppression" # Install an FDB entry for the remote host and check that nothing # changes compared to the initial state. - h2_mac=$(ip -n h2 -j -p link show eth0.$vid | jq -r '.[]["address"]') - run_cmd "bridge -n sw1 fdb replace $h2_mac dev vx0 master static vlan $vid" + h2_mac=$(ip -n $h2 -j -p link show eth0.$vid | jq -r '.[]["address"]') + run_cmd "bridge -n $sw1 fdb replace $h2_mac dev vx0 master static vlan $vid" log_test $? 0 "FDB entry installation" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" log_test $? 0 "ndisc6" - tc_check_packets sw1 "dev vx0 egress" 101 3 + tc_check_packets $sw1 "dev vx0 egress" 101 3 log_test $? 0 "NS suppression" # Install a neighbor on the matching SVI interface and check that NS # messages are suppressed. - run_cmd "ip -n sw1 neigh replace $daddr lladdr $h2_mac nud permanent dev br0.$vid" + run_cmd "ip -n $sw1 neigh replace $daddr lladdr $h2_mac nud permanent dev br0.$vid" log_test $? 0 "Neighbor entry installation" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" log_test $? 0 "ndisc6" - tc_check_packets sw1 "dev vx0 egress" 101 3 + tc_check_packets $sw1 "dev vx0 egress" 101 3 log_test $? 0 "NS suppression" # Take the second host down and check that NS messages are suppressed # and that ND messages are received. - run_cmd "ip -n h2 link set dev eth0.$vid down" + run_cmd "ip -n $h2 link set dev eth0.$vid down" log_test $? 0 "H2 down" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" log_test $? 0 "ndisc6" - tc_check_packets sw1 "dev vx0 egress" 101 3 + tc_check_packets $sw1 "dev vx0 egress" 101 3 log_test $? 0 "NS suppression" - run_cmd "ip -n h2 link set dev eth0.$vid up" + run_cmd "ip -n $h2 link set dev eth0.$vid up" log_test $? 0 "H2 up" # Disable neighbor suppression and check that NS messages are no longer # suppressed. - run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress off" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress off\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_suppress off" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_suppress off\"" log_test $? 0 "\"neigh_suppress\" is off" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" log_test $? 0 "ndisc6" - tc_check_packets sw1 "dev vx0 egress" 101 4 + tc_check_packets $sw1 "dev vx0 egress" 101 4 log_test $? 0 "NS suppression" # Take the second host down and check that NS messages are not # suppressed and that ND messages are not received. - run_cmd "ip -n h2 link set dev eth0.$vid down" + run_cmd "ip -n $h2 link set dev eth0.$vid down" log_test $? 0 "H2 down" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" log_test $? 2 "ndisc6" - tc_check_packets sw1 "dev vx0 egress" 101 5 + tc_check_packets $sw1 "dev vx0 egress" 101 5 log_test $? 0 "NS suppression" }
@@ -524,118 +517,118 @@ neigh_vlan_suppress_arp() echo "Per-{Port, VLAN} ARP suppression" echo "--------------------------------" - run_cmd "tc -n sw1 qdisc replace dev vx0 clsact" - run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 101 proto 0x0806 flower indev swp1 arp_tip $tip1 arp_sip $sip1 arp_op request action pass" - run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 102 proto 0x0806 flower indev swp1 arp_tip $tip2 arp_sip $sip2 arp_op request action pass" + run_cmd "tc -n $sw1 qdisc replace dev vx0 clsact" + run_cmd "tc -n $sw1 filter replace dev vx0 egress pref 1 handle 101 proto 0x0806 flower indev swp1 arp_tip $tip1 arp_sip $sip1 arp_op request action pass" + run_cmd "tc -n $sw1 filter replace dev vx0 egress pref 1 handle 102 proto 0x0806 flower indev swp1 arp_tip $tip2 arp_sip $sip2 arp_op request action pass" - h2_mac1=$(ip -n h2 -j -p link show eth0.$vid1 | jq -r '.[]["address"]') - h2_mac2=$(ip -n h2 -j -p link show eth0.$vid2 | jq -r '.[]["address"]') - run_cmd "bridge -n sw1 fdb replace $h2_mac1 dev vx0 master static vlan $vid1" - run_cmd "bridge -n sw1 fdb replace $h2_mac2 dev vx0 master static vlan $vid2" - run_cmd "ip -n sw1 neigh replace $tip1 lladdr $h2_mac1 nud permanent dev br0.$vid1" - run_cmd "ip -n sw1 neigh replace $tip2 lladdr $h2_mac2 nud permanent dev br0.$vid2" + h2_mac1=$(ip -n $h2 -j -p link show eth0.$vid1 | jq -r '.[]["address"]') + h2_mac2=$(ip -n $h2 -j -p link show eth0.$vid2 | jq -r '.[]["address"]') + run_cmd "bridge -n $sw1 fdb replace $h2_mac1 dev vx0 master static vlan $vid1" + run_cmd "bridge -n $sw1 fdb replace $h2_mac2 dev vx0 master static vlan $vid2" + run_cmd "ip -n $sw1 neigh replace $tip1 lladdr $h2_mac1 nud permanent dev br0.$vid1" + run_cmd "ip -n $sw1 neigh replace $tip2 lladdr $h2_mac2 nud permanent dev br0.$vid2" # Enable per-{Port, VLAN} neighbor suppression and check that ARP # requests are not suppressed and that ARP replies are received. - run_cmd "bridge -n sw1 link set dev vx0 neigh_vlan_suppress on" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_vlan_suppress on\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_vlan_suppress on" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_vlan_suppress on\"" log_test $? 0 "\"neigh_vlan_suppress\" is on" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" log_test $? 0 "arping (VLAN $vid1)" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" log_test $? 0 "arping (VLAN $vid2)" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "ARP suppression (VLAN $vid1)" - tc_check_packets sw1 "dev vx0 egress" 102 1 + tc_check_packets $sw1 "dev vx0 egress" 102 1 log_test $? 0 "ARP suppression (VLAN $vid2)" # Enable neighbor suppression on VLAN 10 and check that only on this # VLAN ARP requests are suppressed. - run_cmd "bridge -n sw1 vlan set vid $vid1 dev vx0 neigh_suppress on" - run_cmd "bridge -n sw1 -d vlan show dev vx0 vid $vid1 | grep \"neigh_suppress on\"" + run_cmd "bridge -n $sw1 vlan set vid $vid1 dev vx0 neigh_suppress on" + run_cmd "bridge -n $sw1 -d vlan show dev vx0 vid $vid1 | grep \"neigh_suppress on\"" log_test $? 0 "\"neigh_suppress\" is on (VLAN $vid1)" - run_cmd "bridge -n sw1 -d vlan show dev vx0 vid $vid2 | grep \"neigh_suppress off\"" + run_cmd "bridge -n $sw1 -d vlan show dev vx0 vid $vid2 | grep \"neigh_suppress off\"" log_test $? 0 "\"neigh_suppress\" is off (VLAN $vid2)" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" log_test $? 0 "arping (VLAN $vid1)" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" log_test $? 0 "arping (VLAN $vid2)" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "ARP suppression (VLAN $vid1)" - tc_check_packets sw1 "dev vx0 egress" 102 2 + tc_check_packets $sw1 "dev vx0 egress" 102 2 log_test $? 0 "ARP suppression (VLAN $vid2)" # Enable neighbor suppression on the port and check that it has no # effect compared to previous state. - run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress on" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_suppress on" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" log_test $? 0 "\"neigh_suppress\" is on" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" log_test $? 0 "arping (VLAN $vid1)" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" log_test $? 0 "arping (VLAN $vid2)" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "ARP suppression (VLAN $vid1)" - tc_check_packets sw1 "dev vx0 egress" 102 3 + tc_check_packets $sw1 "dev vx0 egress" 102 3 log_test $? 0 "ARP suppression (VLAN $vid2)" # Disable neighbor suppression on the port and check that it has no # effect compared to previous state. - run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress off" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress off\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_suppress off" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_suppress off\"" log_test $? 0 "\"neigh_suppress\" is off" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" log_test $? 0 "arping (VLAN $vid1)" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" log_test $? 0 "arping (VLAN $vid2)" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "ARP suppression (VLAN $vid1)" - tc_check_packets sw1 "dev vx0 egress" 102 4 + tc_check_packets $sw1 "dev vx0 egress" 102 4 log_test $? 0 "ARP suppression (VLAN $vid2)" # Disable neighbor suppression on VLAN 10 and check that ARP requests # are no longer suppressed on this VLAN. - run_cmd "bridge -n sw1 vlan set vid $vid1 dev vx0 neigh_suppress off" - run_cmd "bridge -n sw1 -d vlan show dev vx0 vid $vid1 | grep \"neigh_suppress off\"" + run_cmd "bridge -n $sw1 vlan set vid $vid1 dev vx0 neigh_suppress off" + run_cmd "bridge -n $sw1 -d vlan show dev vx0 vid $vid1 | grep \"neigh_suppress off\"" log_test $? 0 "\"neigh_suppress\" is off (VLAN $vid1)" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" log_test $? 0 "arping (VLAN $vid1)" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" log_test $? 0 "arping (VLAN $vid2)" - tc_check_packets sw1 "dev vx0 egress" 101 2 + tc_check_packets $sw1 "dev vx0 egress" 101 2 log_test $? 0 "ARP suppression (VLAN $vid1)" - tc_check_packets sw1 "dev vx0 egress" 102 5 + tc_check_packets $sw1 "dev vx0 egress" 102 5 log_test $? 0 "ARP suppression (VLAN $vid2)" # Disable per-{Port, VLAN} neighbor suppression, enable neighbor # suppression on the port and check that on both VLANs ARP requests are # suppressed. - run_cmd "bridge -n sw1 link set dev vx0 neigh_vlan_suppress off" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_vlan_suppress off\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_vlan_suppress off" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_vlan_suppress off\"" log_test $? 0 "\"neigh_vlan_suppress\" is off" - run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress on" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_suppress on" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" log_test $? 0 "\"neigh_suppress\" is on" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" log_test $? 0 "arping (VLAN $vid1)" - run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" + run_cmd "ip netns exec $h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" log_test $? 0 "arping (VLAN $vid2)" - tc_check_packets sw1 "dev vx0 egress" 101 2 + tc_check_packets $sw1 "dev vx0 egress" 101 2 log_test $? 0 "ARP suppression (VLAN $vid1)" - tc_check_packets sw1 "dev vx0 egress" 102 5 + tc_check_packets $sw1 "dev vx0 egress" 102 5 log_test $? 0 "ARP suppression (VLAN $vid2)" }
@@ -655,118 +648,118 @@ neigh_vlan_suppress_ns() echo "Per-{Port, VLAN} NS suppression" echo "-------------------------------" - run_cmd "tc -n sw1 qdisc replace dev vx0 clsact" - run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 101 proto ipv6 flower indev swp1 ip_proto icmpv6 dst_ip $maddr src_ip $saddr1 type 135 code 0 action pass" - run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 102 proto ipv6 flower indev swp1 ip_proto icmpv6 dst_ip $maddr src_ip $saddr2 type 135 code 0 action pass" + run_cmd "tc -n $sw1 qdisc replace dev vx0 clsact" + run_cmd "tc -n $sw1 filter replace dev vx0 egress pref 1 handle 101 proto ipv6 flower indev swp1 ip_proto icmpv6 dst_ip $maddr src_ip $saddr1 type 135 code 0 action pass" + run_cmd "tc -n $sw1 filter replace dev vx0 egress pref 1 handle 102 proto ipv6 flower indev swp1 ip_proto icmpv6 dst_ip $maddr src_ip $saddr2 type 135 code 0 action pass" - h2_mac1=$(ip -n h2 -j -p link show eth0.$vid1 | jq -r '.[]["address"]') - h2_mac2=$(ip -n h2 -j -p link show eth0.$vid2 | jq -r '.[]["address"]') - run_cmd "bridge -n sw1 fdb replace $h2_mac1 dev vx0 master static vlan $vid1" - run_cmd "bridge -n sw1 fdb replace $h2_mac2 dev vx0 master static vlan $vid2" - run_cmd "ip -n sw1 neigh replace $daddr1 lladdr $h2_mac1 nud permanent dev br0.$vid1" - run_cmd "ip -n sw1 neigh replace $daddr2 lladdr $h2_mac2 nud permanent dev br0.$vid2" + h2_mac1=$(ip -n $h2 -j -p link show eth0.$vid1 | jq -r '.[]["address"]') + h2_mac2=$(ip -n $h2 -j -p link show eth0.$vid2 | jq -r '.[]["address"]') + run_cmd "bridge -n $sw1 fdb replace $h2_mac1 dev vx0 master static vlan $vid1" + run_cmd "bridge -n $sw1 fdb replace $h2_mac2 dev vx0 master static vlan $vid2" + run_cmd "ip -n $sw1 neigh replace $daddr1 lladdr $h2_mac1 nud permanent dev br0.$vid1" + run_cmd "ip -n $sw1 neigh replace $daddr2 lladdr $h2_mac2 nud permanent dev br0.$vid2" # Enable per-{Port, VLAN} neighbor suppression and check that NS # messages are not suppressed and that ND messages are received. - run_cmd "bridge -n sw1 link set dev vx0 neigh_vlan_suppress on" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_vlan_suppress on\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_vlan_suppress on" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_vlan_suppress on\"" log_test $? 0 "\"neigh_vlan_suppress\" is on" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" log_test $? 0 "ndisc6 (VLAN $vid1)" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" log_test $? 0 "ndisc6 (VLAN $vid2)" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "NS suppression (VLAN $vid1)" - tc_check_packets sw1 "dev vx0 egress" 102 1 + tc_check_packets $sw1 "dev vx0 egress" 102 1 log_test $? 0 "NS suppression (VLAN $vid2)" # Enable neighbor suppression on VLAN 10 and check that only on this # VLAN NS messages are suppressed. - run_cmd "bridge -n sw1 vlan set vid $vid1 dev vx0 neigh_suppress on" - run_cmd "bridge -n sw1 -d vlan show dev vx0 vid $vid1 | grep \"neigh_suppress on\"" + run_cmd "bridge -n $sw1 vlan set vid $vid1 dev vx0 neigh_suppress on" + run_cmd "bridge -n $sw1 -d vlan show dev vx0 vid $vid1 | grep \"neigh_suppress on\"" log_test $? 0 "\"neigh_suppress\" is on (VLAN $vid1)" - run_cmd "bridge -n sw1 -d vlan show dev vx0 vid $vid2 | grep \"neigh_suppress off\"" + run_cmd "bridge -n $sw1 -d vlan show dev vx0 vid $vid2 | grep \"neigh_suppress off\"" log_test $? 0 "\"neigh_suppress\" is off (VLAN $vid2)" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" log_test $? 0 "ndisc6 (VLAN $vid1)" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" log_test $? 0 "ndisc6 (VLAN $vid2)" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "NS suppression (VLAN $vid1)" - tc_check_packets sw1 "dev vx0 egress" 102 2 + tc_check_packets $sw1 "dev vx0 egress" 102 2 log_test $? 0 "NS suppression (VLAN $vid2)" # Enable neighbor suppression on the port and check that it has no # effect compared to previous state. - run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress on" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_suppress on" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" log_test $? 0 "\"neigh_suppress\" is on" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" log_test $? 0 "ndisc6 (VLAN $vid1)" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" log_test $? 0 "ndisc6 (VLAN $vid2)" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "NS suppression (VLAN $vid1)" - tc_check_packets sw1 "dev vx0 egress" 102 3 + tc_check_packets $sw1 "dev vx0 egress" 102 3 log_test $? 0 "NS suppression (VLAN $vid2)" # Disable neighbor suppression on the port and check that it has no # effect compared to previous state. - run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress off" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress off\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_suppress off" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_suppress off\"" log_test $? 0 "\"neigh_suppress\" is off" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" log_test $? 0 "ndisc6 (VLAN $vid1)" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" log_test $? 0 "ndisc6 (VLAN $vid2)" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "NS suppression (VLAN $vid1)" - tc_check_packets sw1 "dev vx0 egress" 102 4 + tc_check_packets $sw1 "dev vx0 egress" 102 4 log_test $? 0 "NS suppression (VLAN $vid2)" # Disable neighbor suppression on VLAN 10 and check that NS messages # are no longer suppressed on this VLAN. - run_cmd "bridge -n sw1 vlan set vid $vid1 dev vx0 neigh_suppress off" - run_cmd "bridge -n sw1 -d vlan show dev vx0 vid $vid1 | grep \"neigh_suppress off\"" + run_cmd "bridge -n $sw1 vlan set vid $vid1 dev vx0 neigh_suppress off" + run_cmd "bridge -n $sw1 -d vlan show dev vx0 vid $vid1 | grep \"neigh_suppress off\"" log_test $? 0 "\"neigh_suppress\" is off (VLAN $vid1)" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" log_test $? 0 "ndisc6 (VLAN $vid1)" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" log_test $? 0 "ndisc6 (VLAN $vid2)" - tc_check_packets sw1 "dev vx0 egress" 101 2 + tc_check_packets $sw1 "dev vx0 egress" 101 2 log_test $? 0 "NS suppression (VLAN $vid1)" - tc_check_packets sw1 "dev vx0 egress" 102 5 + tc_check_packets $sw1 "dev vx0 egress" 102 5 log_test $? 0 "NS suppression (VLAN $vid2)" # Disable per-{Port, VLAN} neighbor suppression, enable neighbor # suppression on the port and check that on both VLANs NS messages are # suppressed. - run_cmd "bridge -n sw1 link set dev vx0 neigh_vlan_suppress off" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_vlan_suppress off\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_vlan_suppress off" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_vlan_suppress off\"" log_test $? 0 "\"neigh_vlan_suppress\" is off" - run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress on" - run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" + run_cmd "bridge -n $sw1 link set dev vx0 neigh_suppress on" + run_cmd "bridge -n $sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" log_test $? 0 "\"neigh_suppress\" is on" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" log_test $? 0 "ndisc6 (VLAN $vid1)" - run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" + run_cmd "ip netns exec $h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" log_test $? 0 "ndisc6 (VLAN $vid2)" - tc_check_packets sw1 "dev vx0 egress" 101 2 + tc_check_packets $sw1 "dev vx0 egress" 101 2 log_test $? 0 "NS suppression (VLAN $vid1)" - tc_check_packets sw1 "dev vx0 egress" 102 5 + tc_check_packets $sw1 "dev vx0 egress" 102 5 log_test $? 0 "NS suppression (VLAN $vid2)" }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 193/301 selftests: test_bridge_neigh_suppress.sh: Fix failures due to duplicate MAC
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 9a169c267e946b0f47f67e8ccc70134708ccf3d4 ]
When creating the topology for the test, three veth pairs are created in the initial network namespace before being moved to one of the network namespaces created by the test.
On systems where systemd-udev uses MACAddressPolicy=persistent (default since systemd version 242), this will result in some net devices having the same MAC address since they were created with the same name in the initial network namespace. In turn, this leads to arping / ndisc6 failing since packets are dropped by the bridge's loopback filter.
Fix by creating each net device in the correct network namespace instead of moving it there from the initial network namespace.
--- .../selftests/net/test_bridge_neigh_suppress.sh | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
tools/testing/selftests/net/test_bridge_neigh_suppress.sh +3 -11
@@ -154,17 +154,9 @@ setup_topo() setup_topo_ns $ns done - ip link add name veth0 type veth peer name veth1 - ip link set dev veth0 netns $h1 name eth0 - ip link set dev veth1 netns $sw1 name swp1 - - ip link add name veth0 type veth peer name veth1 - ip link set dev veth0 netns $sw1 name veth0 - ip link set dev veth1 netns $sw2 name veth0 - - ip link add name veth0 type veth peer name veth1 - ip link set dev veth0 netns $h2 name eth0 - ip link set dev veth1 netns $sw2 name swp1 + ip -n $h1 link add name eth0 type veth peer name swp1 netns $sw1 + ip -n $sw1 link add name veth0 type veth peer name veth0 netns $sw2 + ip -n $h2 link add name eth0 type veth peer name swp1 netns $sw2 } setup_host_common()
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 194/301 rxrpc: Fix the names of the fields in the ACK trailer struct
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 17469ae0582aaacad36e8e858f58b86c369f21ef ]
Quoted 1 line
From AFS-3.3 a trailer containing extra info was added to the ACK packet
format - but AF_RXRPC has the names of some of the fields mixed up compared to other AFS implementations.
Rename the struct and the fields to make them match.
Stable-dep-of: ba4e103848d3 ("rxrpc: Fix congestion control algorithm")
--- include/trace/events/rxrpc.h | 2 +- net/rxrpc/conn_event.c | 16 ++++++++-------- net/rxrpc/input.c | 22 +++++++++++----------- net/rxrpc/output.c | 14 +++++++------- net/rxrpc/protocol.h | 6 +++--- 5 files changed, 30 insertions(+), 30 deletions(-)
include/trace/events/rxrpc.h +1 -1
@@ -83,7 +83,7 @@ EM(rxrpc_badmsg_bad_abort, "bad-abort") \ EM(rxrpc_badmsg_bad_jumbo, "bad-jumbo") \ EM(rxrpc_badmsg_short_ack, "short-ack") \ - EM(rxrpc_badmsg_short_ack_info, "short-ack-info") \ + EM(rxrpc_badmsg_short_ack_trailer, "short-ack-trailer") \ EM(rxrpc_badmsg_short_hdr, "short-hdr") \ EM(rxrpc_badmsg_unsupported_packet, "unsup-pkt") \EM (rxrpc_badmsg_zero_call,"zero-call" ) \
net/rxrpc/conn_event.c +8 -8
@@ -88,7 +88,7 @@ void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn,struct rxrpc_ackpacket ack; }; } __attribute__((packed)) pkt; -struct rxrpc_ackinfo ack_info; +struct rxrpc_acktrailer trailer;size_t len;int ret, ioc;u32 serial, mtu, call_id, padding;
@@ -122,8 +122,8 @@ void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, iov[0 ].iov_len =sizeof (pkt.whdr); iov[1 ].iov_base = &padding; iov[1 ].iov_len =3 ; - iov[2 ].iov_base = &ack_info; - iov[2 ].iov_len =sizeof (ack_info); + iov[2 ].iov_base = &trailer; + iov[2 ].iov_len =sizeof (trailer); serial =rxrpc_get_next_serial (conn);
@@ -158,14 +158,14 @@ void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, pkt.ack.serial =htonl (skb ? sp->hdr.serial :0 ); pkt.ack.reason = skb ?RXRPC_ACK_DUPLICATE :RXRPC_ACK_IDLE ; pkt.ack.nAcks =0 ; - ack_info.rxMTU =htonl (rxrpc_rx_mtu); - ack_info.maxMTU =htonl (mtu); - ack_info.rwind =htonl (rxrpc_rx_window_size); - ack_info.jumbo_max =htonl (rxrpc_rx_jumbo_max); + trailer.maxMTU =htonl (rxrpc_rx_mtu); + trailer.ifMTU =htonl (mtu); + trailer.rwind =htonl (rxrpc_rx_window_size); + trailer.jumbo_max =htonl (rxrpc_rx_jumbo_max); pkt.whdr.flags |=RXRPC_SLOW_START_OK ; padding =0 ; iov[0 ].iov_len +=sizeof (pkt.ack); - len +=sizeof (pkt.ack) +3 +sizeof (ack_info); + len +=sizeof (pkt.ack) +3 +sizeof (trailer); ioc =3 ; trace_rxrpc_tx_ack(chan->call_debug_id, serial,
net/rxrpc/input.c +11 -11
@@ -670,14 +670,14 @@ static void rxrpc_complete_rtt_probe(struct rxrpc_call *call,/* * Process the extra information that may be appended to an ACK packet */ -static void rxrpc_input_ackinfo (struct rxrpc_call *call,struct sk_buff *skb, -struct rxrpc_ackinfo *ackinfo) +static void rxrpc_input_ack_trailer (struct rxrpc_call *call,struct sk_buff *skb, +struct rxrpc_acktrailer *trailer) {struct rxrpc_skb_priv *sp =rxrpc_skb (skb);struct rxrpc_peer *peer;unsigned int mtu;bool wake = false; -u32 rwind =ntohl (ackinfo->rwind); +u32 rwind =ntohl (trailer->rwind);if (rwind >RXRPC_TX_MAX_WINDOW ) rwind =RXRPC_TX_MAX_WINDOW ;
@@ -691,7 +691,7 @@ static void rxrpc_input_ackinfo(struct rxrpc_call *call, struct sk_buff *skb,if (call->cong_ssthresh > rwind) call->cong_ssthresh = rwind; - mtu =min (ntohl (ackinfo->rxMTU),ntohl (ackinfo->maxMTU)); + mtu =min (ntohl (trailer->maxMTU),ntohl (trailer->ifMTU)); peer = call->peer;if (mtu < peer->maxdata) {
@@ -837,7 +837,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)struct rxrpc_ack_summary summary = {0 };struct rxrpc_ackpacket ack;struct rxrpc_skb_priv *sp =rxrpc_skb (skb); -struct rxrpc_ackinfo info; +struct rxrpc_acktrailer trailer;rxrpc_serial_t ack_serial, acked_serial;rxrpc_seq_t first_soft_ack, hard_ack, prev_pkt, since;int nr_acks, offset, ioffset;
@@ -917,11 +917,11 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) goto send_response; } - info.rxMTU =0 ; + trailer.maxMTU =0 ; ioffset = offset + nr_acks +3 ; -if (skb->len >= ioffset +sizeof (info) && -skb_copy_bits (skb, ioffset, &info,sizeof (info)) <0 ) -return rxrpc_proto_abort (call,0 , rxrpc_badmsg_short_ack_info); +if (skb->len >= ioffset +sizeof (trailer) && +skb_copy_bits (skb, ioffset, &trailer,sizeof (trailer)) <0 ) +return rxrpc_proto_abort (call,0 , rxrpc_badmsg_short_ack_trailer);if (nr_acks >0 )skb_condense (skb);
@@ -950,8 +950,8 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) }/* Parse rwind and mtu sizes if provided. */ -if (info.rxMTU) -rxrpc_input_ackinfo (call, skb, &info); +if (trailer.maxMTU) +rxrpc_input_ack_trailer (call, skb, &trailer);if (first_soft_ack ==0 )return rxrpc_proto_abort (call,0 , rxrpc_eproto_ackr_zero);
net/rxrpc/output.c +7 -7
@@ -83,7 +83,7 @@ static size_t rxrpc_fill_out_ack(struct rxrpc_connection *conn,struct rxrpc_txbuf *txb, u16 *_rwind) { - struct rxrpc_ackinfo ackinfo; + struct rxrpc_acktrailer trailer;unsigned int qsize, sack, wrap, to;rxrpc_seq_t window, wtop;int rsize;
@@ -126,16 +126,16 @@ static size_t rxrpc_fill_out_ack(struct rxrpc_connection *conn, qsize = (window -1 ) - call->rx_consumed; rsize =max_t (int, call->rx_winsize - qsize,0 ); *_rwind = rsize; - ackinfo.rxMTU =htonl (rxrpc_rx_mtu); - ackinfo.maxMTU =htonl (mtu); - ackinfo.rwind =htonl (rsize); - ackinfo.jumbo_max =htonl (jmax); + trailer.maxMTU =htonl (rxrpc_rx_mtu); + trailer.ifMTU =htonl (mtu); + trailer.rwind =htonl (rsize); + trailer.jumbo_max =htonl (jmax); *ackp++ =0 ; *ackp++ =0 ; *ackp++ =0 ; -memcpy (ackp, &ackinfo,sizeof (ackinfo)); -return txb->ack.nAcks +3 +sizeof (ackinfo); +memcpy (ackp, &trailer,sizeof (trailer)); +return txb->ack.nAcks +3 +sizeof (trailer); }/*
net/rxrpc/protocol.h +3 -3
@@ -135,9 +135,9 @@ struct rxrpc_ackpacket {/* * ACK packets can have a further piece of information tagged on the end */ -struct rxrpc_ackinfo { -__be32 rxMTU;/* maximum Rx MTU size (bytes) [AFS 3.3] */ -__be32 maxMTU;/* maximum interface MTU size (bytes) [AFS 3.3] */ +struct rxrpc_acktrailer { +__be32 maxMTU;/* maximum Rx MTU size (bytes) [AFS 3.3] */ +__be32 ifMTU;/* maximum interface MTU size (bytes) [AFS 3.3] */ __be32 rwind;/* Rx window size (packets) [AFS 3.4] */ __be32 jumbo_max;/* max packets to stick into a jumbo packet [AFS 3.5] */ };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 195/301 rxrpc: Fix congestion control algorithm
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit ba4e103848d3a2a28a0445e39f4a9564187efe54 ]
Make the following fixes to the congestion control algorithm:
(1) Don't vary the cwnd starting value by the size of RXRPC_TX_SMSS since that's currently held constant - set to the size of a jumbo subpacket payload so that we can create jumbo packets on the fly. The current code invariably picks 3 as the starting value.
Further, the starting cwnd needs to be an even number because we ack every other packet, so set it to 4.
(2) Don't cut ssthresh when we see an ACK come from the peer with a receive window (rwind) less than ssthresh. ssthresh keeps track of characteristics of the connection whereas rwind may be reduced by the peer for any reason - and may be reduced to 0.
--- net/rxrpc/ar-internal.h | 2 +- net/rxrpc/call_object.c | 7 +------ net/rxrpc/input.c | 3 --- 3 files changed, 2 insertions(+), 10 deletions(-)
net/rxrpc/ar-internal.h +1 -1
@@ -688,7 +688,7 @@ struct rxrpc_call {* packets) rather than bytes. */ #define RXRPC_TX_SMSS RXRPC_JUMBO_DATALEN -#define RXRPC_MIN_CWND (RXRPC_TX_SMSS > 2190 ? 2 : RXRPC_TX_SMSS > 1095 ? 3 : 4) +#define RXRPC_MIN_CWND 4u8 cong_cwnd;/* Congestion window size */ u8 cong_extra;/* Extra to send for congestion management */ u8 cong_ssthresh;/* Slow-start threshold */
net/rxrpc/call_object.c +1 -6
@@ -175,12 +175,7 @@ struct rxrpc_call *rxrpc_alloc_call(struct rxrpc_sock *rx, gfp_t gfp, call->rx_winsize = rxrpc_rx_window_size; call->tx_winsize =16 ; -if (RXRPC_TX_SMSS >2190 ) - call->cong_cwnd =2 ; -else if (RXRPC_TX_SMSS >1095 ) - call->cong_cwnd =3 ; -else - call->cong_cwnd =4 ; + call->cong_cwnd =RXRPC_MIN_CWND ; call->cong_ssthresh =RXRPC_TX_MAX_WINDOW ; call->rxnet = rxnet;
net/rxrpc/input.c +0 -3
@@ -688,9 +688,6 @@ static void rxrpc_input_ack_trailer(struct rxrpc_call *call, struct sk_buff *skb call->tx_winsize = rwind; } -if (call->cong_ssthresh > rwind) - call->cong_ssthresh = rwind; - mtu =min (ntohl (trailer->maxMTU),ntohl (trailer->ifMTU)); peer = call->peer;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 196/301 rxrpc: Only transmit one ACK per jumbo packet received
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 012b7206918dcc5a4dcf1432b3e643114c95957e ]
Only generate one ACK packet for all the subpackets in a jumbo packet. If we would like to generate more than one ACK, we prioritise them base on their reason code, in the order, highest first:
OutOfSeq > NoSpace > ExceedsWin > Duplicate > Requested > Delay > Idle
For the first four, we reference the lowest offending subpacket; for the last three, the highest.
This reduces the number of ACKs we end up transmitting to one per UDP packet transmitted to reduce network loading and packet parsing.
--- net/rxrpc/input.c | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-)
net/rxrpc/input.c +35 -11
@@ -9,6 +9,17 @@#include "ar-internal.h" +/* Override priority when generating ACKs for received DATA */ +static const u8 rxrpc_ack_priority[RXRPC_ACK__INVALID ] = { + [RXRPC_ACK_IDLE ] =1 , + [RXRPC_ACK_DELAY ] =2 , + [RXRPC_ACK_REQUESTED ] =3 , + [RXRPC_ACK_DUPLICATE ] =4 , + [RXRPC_ACK_EXCEEDS_WINDOW ] =5 , + [RXRPC_ACK_NOSPACE ] =6 , + [RXRPC_ACK_OUT_OF_SEQUENCE ] =7 , +}; +static void rxrpc_proto_abort (struct rxrpc_call *call,rxrpc_seq_t seq,enum rxrpc_abort_reason why) {
@@ -366,7 +377,7 @@ static void rxrpc_input_queue_data(struct rxrpc_call *call, struct sk_buff *skb,* Process a DATA packet. */ static void rxrpc_input_data_one (struct rxrpc_call *call,struct sk_buff *skb, -bool *_notify) +bool *_notify,rxrpc_serial_t *_ack_serial,int *_ack_reason) {struct rxrpc_skb_priv *sp =rxrpc_skb (skb);struct sk_buff *oos;
@@ -419,8 +430,6 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,/* Send an immediate ACK if we fill in a hole */ else if (!skb_queue_empty(&call->rx_oos_queue)) ack_reason =RXRPC_ACK_DELAY ; - else - call->ackr_nr_unacked++; window++;if (after (window, wtop)) {
@@ -498,12 +507,16 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb, } send_ack: -if (ack_reason >=0 ) -rxrpc_send_ACK (call, ack_reason, serial, - rxrpc_propose_ack_input_data); -else -rxrpc_propose_delay_ACK (call, serial, - rxrpc_propose_ack_input_data); +if (ack_reason >=0 ) { +if (rxrpc_ack_priority[ack_reason] > rxrpc_ack_priority[*_ack_reason]) { + *_ack_serial = serial; + *_ack_reason = ack_reason; + }else if (rxrpc_ack_priority[ack_reason] == rxrpc_ack_priority[*_ack_reason] && + ack_reason ==RXRPC_ACK_REQUESTED ) { + *_ack_serial = serial; + *_ack_reason = ack_reason; + } + } }/*
@@ -514,9 +527,11 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skbstruct rxrpc_jumbo_header jhdr;struct rxrpc_skb_priv *sp =rxrpc_skb (skb), *jsp;struct sk_buff *jskb; +rxrpc_serial_t ack_serial =0 ;unsigned int offset =sizeof (struct rxrpc_wire_header );unsigned int len = skb->len - offset;bool notify = false; +int ack_reason =0 ;while (sp->hdr.flags &RXRPC_JUMBO_PACKET ) {if (len <RXRPC_JUMBO_SUBPKTLEN )
@@ -536,7 +551,7 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb jsp =rxrpc_skb (jskb); jsp->offset = offset; jsp->len =RXRPC_JUMBO_DATALEN ; -rxrpc_input_data_one (call, jskb, ¬ify); +rxrpc_input_data_one (call, jskb, ¬ify, &ack_serial, &ack_reason);rxrpc_free_skb (jskb, rxrpc_skb_put_jumbo_subpacket); sp->hdr.flags = jhdr.flags;
@@ -549,7 +564,16 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb sp->offset = offset; sp->len = len; -rxrpc_input_data_one (call, skb, ¬ify); +rxrpc_input_data_one (call, skb, ¬ify, &ack_serial, &ack_reason); + +if (ack_reason >0 ) { +rxrpc_send_ACK (call, ack_reason, ack_serial, + rxrpc_propose_ack_input_data); + }else { + call->ackr_nr_unacked++; +rxrpc_propose_delay_ACK (call, sp->hdr.serial, + rxrpc_propose_ack_input_data); + }if (notify) {trace_rxrpc_notify_socket (call->debug_id, sp->hdr.serial);rxrpc_notify_socket (call);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 197/301 dt-bindings: net: mediatek: remove wrongly added clocks and SerDes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
[ Upstream commit cc349b0771dccebf0fa9f5e1822ac444aef11448 ]
Several clocks as well as both sgmiisys phandles were added by mistake to the Ethernet bindings for MT7988. Also, the total number of clocks didn't match with the actual number of items listed.
This happened because the vendor driver which served as a reference uses a high number of syscon phandles to access various parts of the SoC which wasn't acceptable upstream. Hence several parts which have never previously been supported (such SerDes PHY and USXGMII PCS) are going to be implemented by separate drivers. As a result the device tree will look much more sane.
Quickly align the bindings with the upcoming reality of the drivers actually adding support for the remaining Ethernet-related features of the MT7988 SoC.
--- .../devicetree/bindings/net/mediatek,net.yaml | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-)
Documentation/devicetree/bindings/net/mediatek,net.yaml +2 -20
@@ -337,8 +337,8 @@ allOf: minItems: 4 clocks: - minItems: 34 - maxItems: 34 + minItems: 24 + maxItems: 24 clock-names: items:
@@ -351,18 +351,6 @@ allOf: - const: ethwarp_wocpu1 - const: ethwarp_wocpu0 - const: esw - - const: netsys0 - - const: netsys1 - - const: sgmii_tx250m - - const: sgmii_rx250m - - const: sgmii2_tx250m - - const: sgmii2_rx250m - - const: top_usxgmii0_sel - - const: top_usxgmii1_sel - - const: top_sgm0_sel - - const: top_sgm1_sel - - const: top_xfi_phy0_xtal_sel - - const: top_xfi_phy1_xtal_sel - const: top_eth_gmii_sel - const: top_eth_refck_50m_sel - const: top_eth_sys_200m_sel
@@ -375,16 +363,10 @@ allOf: - const: top_netsys_sync_250m_sel - const: top_netsys_ppefb_250m_sel - const: top_netsys_warp_sel - - const: wocpu1 - - const: wocpu0 - const: xgp1 - const: xgp2 - const: xgp3 - mediatek,sgmiisys: - minItems: 2 - maxItems: 2 - patternProperties: "^mac@[0-1]$": type: object
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 198/301 ipv6: fib6_rules: avoid possible NULL dereference in fib6_rule_action()
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 d101291b2681e5ab938554e3e323f7a7ee33e3aa ]
syzbot is able to trigger the following crash [1], caused by unsafe ip6_dst_idev() use.
Indeed ip6_dst_idev() can return NULL, and must always be checked.
[1]
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 0 PID: 31648 Comm: syz-executor.0 Not tainted 6.9.0-rc4-next-20240417-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 RIP: 0010:__fib6_rule_action net/ipv6/fib6_rules.c:237 [inline] RIP: 0010:fib6_rule_action+0x241/0x7b0 net/ipv6/fib6_rules.c:267 Code: 02 00 00 49 8d 9f d8 00 00 00 48 89 d8 48 c1 e8 03 42 80 3c 20 00 74 08 48 89 df e8 f9 32 bf f7 48 8b 1b 48 89 d8 48 c1 e8 03 <42> 80 3c 20 00 74 08 48 89 df e8 e0 32 bf f7 4c 8b 03 48 89 ef 4c RSP: 0018:ffffc9000fc1f2f0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 1a772f98c8186700 RDX: 0000000000000003 RSI: ffffffff8bcac4e0 RDI: ffffffff8c1f9760 RBP: ffff8880673fb980 R08: ffffffff8fac15ef R09: 1ffffffff1f582bd R10: dffffc0000000000 R11: fffffbfff1f582be R12: dffffc0000000000 R13: 0000000000000080 R14: ffff888076509000 R15: ffff88807a029a00 FS: 00007f55e82ca6c0(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b31d23000 CR3: 0000000022b66000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> fib_rules_lookup+0x62c/0xdb0 net/core/fib_rules.c:317 fib6_rule_lookup+0x1fd/0x790 net/ipv6/fib6_rules.c:108 ip6_route_output_flags_noref net/ipv6/route.c:2637 [inline] ip6_route_output_flags+0x38e/0x610 net/ipv6/route.c:2649 ip6_route_output include/net/ip6_route.h:93 [inline] ip6_dst_lookup_tail+0x189/0x11a0 net/ipv6/ip6_output.c:1120 ip6_dst_lookup_flow+0xb9/0x180 net/ipv6/ip6_output.c:1250 sctp_v6_get_dst+0x792/0x1e20 net/sctp/ipv6.c:326 sctp_transport_route+0x12c/0x2e0 net/sctp/transport.c:455 sctp_assoc_add_peer+0x614/0x15c0 net/sctp/associola.c:662 sctp_connect_new_asoc+0x31d/0x6c0 net/sctp/socket.c:1099 __sctp_connect+0x66d/0xe30 net/sctp/socket.c:1197 sctp_connect net/sctp/socket.c:4819 [inline] sctp_inet_connect+0x149/0x1f0 net/sctp/socket.c:4834 __sys_connect_file net/socket.c:2048 [inline] __sys_connect+0x2df/0x310 net/socket.c:2065 __do_sys_connect net/socket.c:2075 [inline] __se_sys_connect net/socket.c:2072 [inline] __x64_sys_connect+0x7a/0x90 net/socket.c:2072 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- net/ipv6/fib6_rules.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/ipv6/fib6_rules.c +5 -1
@@ -233,8 +233,12 @@ static int __fib6_rule_action(struct fib_rule *rule, struct flowi *flp, rt =pol_lookup_func (lookup, net, table, flp6, arg->lookup_data, flags);if (rt != net->ipv6.ip6_null_entry) { +struct inet6_dev *idev =ip6_dst_idev (&rt->dst); + +if (!idev) + goto again; err =fib6_rule_saddr (net, rule, flags, flp6, -ip6_dst_idev (&rt->dst)->dev); + idev->dev);if (err == -EAGAIN ) goto again;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 199/301 net-sysfs: convert dev->operstate reads to lockless ones
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 004d138364fd10dd5ff8ceb54cfdc2d792a7b338 ]
operstate_show() can omit dev_base_lock acquisition only to read dev->operstate.
Annotate accesses to dev->operstate.
Writers still acquire dev_base_lock for mutual exclusion.
Stable-dep-of: 4893b8b3ef8d ("hsr: Simplify code for announcing HSR nodes timer setup")
--- net/bridge/br_netlink.c | 3 ++- net/core/link_watch.c | 4 ++-- net/core/net-sysfs.c | 4 +--- net/core/rtnetlink.c | 4 ++-- net/hsr/hsr_device.c | 10 +++++----- net/ipv6/addrconf.c | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-)
net/bridge/br_netlink.c +2 -1
@@ -455,7 +455,8 @@ static int br_fill_ifinfo(struct sk_buff *skb, u32 filter_mask, const struct net_device *dev, bool getlink) { - u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN; + u8 operstate = netif_running(dev) ? READ_ONCE(dev->operstate) : +IF_OPER_DOWN ;struct nlattr *af =NULL ;struct net_bridge *br;struct ifinfomsg *hdr;
net/core/link_watch.c +2 -2
@@ -67,7 +67,7 @@ static void rfc2863_policy(struct net_device *dev) {unsigned char operstate =default_operstate (dev); -if (operstate == dev->operstate) +if (operstate ==READ_ONCE (dev->operstate))return ;write_lock (&dev_base_lock);
@@ -87,7 +87,7 @@ static void rfc2863_policy(struct net_device *dev)break ; } - dev->operstate = operstate; +WRITE_ONCE (dev->operstate, operstate);write_unlock (&dev_base_lock); }
net/core/net-sysfs.c +1 -3
@@ -307,11 +307,9 @@ static ssize_t operstate_show(struct device *dev,const struct net_device *netdev =to_net_dev (dev);unsigned char operstate; -read_lock (&dev_base_lock); - operstate = netdev->operstate; + operstate =READ_ONCE (netdev->operstate);if (!netif_running (netdev)) operstate =IF_OPER_DOWN ; -read_unlock (&dev_base_lock);if (operstate >=ARRAY_SIZE (operstates))return -EINVAL ;/* should not happen */
net/core/rtnetlink.c +2 -2
@@ -880,9 +880,9 @@ static void set_operstate(struct net_device *dev, unsigned char transition)break ; } -if (dev->operstate != operstate) { +if (READ_ONCE (dev->operstate) != operstate) {write_lock (&dev_base_lock); - dev->operstate = operstate; +WRITE_ONCE (dev->operstate, operstate);write_unlock (&dev_base_lock);netdev_state_change (dev); }
net/hsr/hsr_device.c +5 -5
@@ -31,8 +31,8 @@ static bool is_slave_up(struct net_device *dev)static void __hsr_set_operstate (struct net_device *dev,int transition) {write_lock (&dev_base_lock); -if (dev->operstate != transition) { - dev->operstate = transition; +if (READ_ONCE (dev->operstate) != transition) { +WRITE_ONCE (dev->operstate, transition);write_unlock (&dev_base_lock);netdev_state_change (dev); }else {
@@ -78,14 +78,14 @@ static void hsr_check_announce(struct net_device *hsr_dev, hsr =netdev_priv (hsr_dev); -if (hsr_dev->operstate ==IF_OPER_UP && old_operstate !=IF_OPER_UP ) { +if (READ_ONCE (hsr_dev->operstate) ==IF_OPER_UP && old_operstate !=IF_OPER_UP ) {/* Went up */ hsr->announce_count =0 ;mod_timer (&hsr->announce_timer, jiffies +msecs_to_jiffies (HSR_ANNOUNCE_INTERVAL )); } -if (hsr_dev->operstate !=IF_OPER_UP && old_operstate ==IF_OPER_UP ) +if (READ_ONCE (hsr_dev->operstate) !=IF_OPER_UP && old_operstate ==IF_OPER_UP )/* Went down */ del_timer (&hsr->announce_timer); }
@@ -100,7 +100,7 @@ void hsr_check_carrier_and_operstate(struct hsr_priv *hsr)/* netif_stacked_transfer_operstate() cannot be used here since * it doesn't set IF_OPER_LOWERLAYERDOWN (?) */ - old_operstate = master->dev->operstate; + old_operstate =READ_ONCE (master->dev->operstate); has_carrier =hsr_check_carrier (master);hsr_set_operstate (master, has_carrier);hsr_check_announce (master->dev, old_operstate);
net/ipv6/addrconf.c +1 -1
@@ -6011,7 +6011,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, (dev->ifindex !=dev_get_iflink (dev) &&nla_put_u32 (skb,IFLA_LINK ,dev_get_iflink (dev))) ||nla_put_u8 (skb,IFLA_OPERSTATE , - netif_running(dev) ? dev->operstate : IF_OPER_DOWN)) + netif_running(dev) ? READ_ONCE(dev->operstate) : IF_OPER_DOWN)) goto nla_put_failure; protoinfo =nla_nest_start_noflag (skb,IFLA_PROTINFO );if (!protoinfo)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 200/301 hsr: Simplify code for announcing HSR nodes timer setup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Majewski <[email protected]>
[ Upstream commit 4893b8b3ef8db2b182d1a1bebf6c7acf91405000 ]
Up till now the code to start HSR announce timer, which triggers sending supervisory frames, was assuming that hsr_netdev_notify() would be called at least twice for hsrX interface. This was required to have different values for old and current values of network device's operstate.
This is problematic for a case where hsrX interface is already in the operational state when hsr_netdev_notify() is called, so timer is not configured to trigger and as a result the hsrX is not sending supervisory frames to HSR ring.
This error has been discovered when hsr_ping.sh script was run. To be more specific - for the hsr1 and hsr2 the hsr_netdev_notify() was called at least twice with different IF_OPER_{LOWERDOWN|DOWN|UP} states assigned in hsr_check_carrier_and_operstate(hsr). As a result there was no issue with sending supervisory frames.
However, with hsr3, the notify function was called only once with operstate set to IF_OPER_UP and timer responsible for triggering supervisory frames was not fired.
The solution is to use netif_oper_up() and netif_running() helper functions to assess if network hsrX device is up.
Only then, when the timer is not already pending, it is started. Otherwise it is deactivated.
--- net/hsr/hsr_device.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-)
net/hsr/hsr_device.c +12 -15
@@ -71,39 +71,36 @@ static bool hsr_check_carrier(struct hsr_port *master)return false; } -static void hsr_check_announce (struct net_device *hsr_dev, -unsigned char old_operstate) +static void hsr_check_announce (struct net_device *hsr_dev) {struct hsr_priv *hsr; hsr =netdev_priv (hsr_dev); - -if (READ_ONCE (hsr_dev->operstate) ==IF_OPER_UP && old_operstate !=IF_OPER_UP ) { -/* Went up */ - hsr->announce_count =0 ; -mod_timer (&hsr->announce_timer, - jiffies +msecs_to_jiffies (HSR_ANNOUNCE_INTERVAL )); +if (netif_running (hsr_dev) &&netif_oper_up (hsr_dev)) { +/* Enable announce timer and start sending supervisory frames */ +if (!timer_pending (&hsr->announce_timer)) { + hsr->announce_count =0 ; +mod_timer (&hsr->announce_timer, jiffies + +msecs_to_jiffies (HSR_ANNOUNCE_INTERVAL )); + } + }else { +/* Deactivate the announce timer */ +timer_delete (&hsr->announce_timer); } - -if (READ_ONCE (hsr_dev->operstate) !=IF_OPER_UP && old_operstate ==IF_OPER_UP ) -/* Went down */ -del_timer (&hsr->announce_timer); }void hsr_check_carrier_and_operstate (struct hsr_priv *hsr) {struct hsr_port *master; -unsigned char old_operstate;bool has_carrier; master =hsr_port_get_hsr (hsr,HSR_PT_MASTER );/* netif_stacked_transfer_operstate() cannot be used here since * it doesn't set IF_OPER_LOWERLAYERDOWN (?) */ - old_operstate =READ_ONCE (master->dev->operstate); has_carrier =hsr_check_carrier (master);hsr_set_operstate (master, has_carrier); -hsr_check_announce (master->dev, old_operstate); +hsr_check_announce (master->dev); }int hsr_get_max_mtu (struct hsr_priv *hsr)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 201/301 ipv6: annotate data-races around cnf.disable_ipv6
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 d289ab65b89c1d4d88417cb6c03e923f21f95fae ]
disable_ipv6 is read locklessly, add appropriate READ_ONCE() and WRITE_ONCE() annotations.
v2: do not preload net before rtnl_trylock() in
addrconf_disable_ipv6() (Jiri)
Stable-dep-of: 4db783d68b9b ("ipv6: prevent NULL dereference in ip6_output()")
--- net/ipv6/addrconf.c | 9 +++++---- net/ipv6/ip6_input.c | 4 ++-- net/ipv6/ip6_output.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-)
net/ipv6/addrconf.c +5 -4
@@ -4160,7 +4160,7 @@ static void addrconf_dad_work(struct work_struct *w)if (!ipv6_generate_eui64 (addr.s6_addr +8 , idev->dev) &&ipv6_addr_equal (&ifp->addr, &addr)) {/* DAD failed for link-local based on MAC */ - idev->cnf.disable_ipv6 =1 ; +WRITE_ONCE (idev->cnf.disable_ipv6,1 );pr_info ("%s: IPv6 being disabled!\n" , ifp->idev->dev->name);
@@ -6321,7 +6321,8 @@ static void addrconf_disable_change(struct net *net, __s32 newf) idev =__in6_dev_get (dev);if (idev) {int changed = (!idev->cnf.disable_ipv6) ^ (!newf); - idev->cnf.disable_ipv6 = newf; + +WRITE_ONCE (idev->cnf.disable_ipv6, newf);if (changed)dev_disable_change (idev); }
@@ -6338,7 +6339,7 @@ static int addrconf_disable_ipv6(struct ctl_table *table, int *p, int newf) net = (struct net *)table->extra2; old = *p; - *p = newf; +WRITE_ONCE (*p, newf);if (p == &net->ipv6.devconf_dflt->disable_ipv6) {rtnl_unlock ();
@@ -6346,7 +6347,7 @@ static int addrconf_disable_ipv6(struct ctl_table *table, int *p, int newf) }if (p == &net->ipv6.devconf_all->disable_ipv6) { - net->ipv6.devconf_dflt->disable_ipv6 = newf; +WRITE_ONCE (net->ipv6.devconf_dflt->disable_ipv6, newf);addrconf_disable_change (net, newf); }else if ((!newf) ^ (!old))dev_disable_change ((struct inet6_dev *)table->extra1);
net/ipv6/ip6_input.c +2 -2
@@ -168,9 +168,9 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev,SKB_DR_SET (reason,NOT_SPECIFIED );if ((skb =skb_share_check (skb,GFP_ATOMIC )) ==NULL || - !idev ||unlikely (idev->cnf.disable_ipv6)) { + !idev ||unlikely (READ_ONCE (idev->cnf.disable_ipv6))) {__IP6_INC_STATS (net, idev,IPSTATS_MIB_INDISCARDS ); -if (idev &&unlikely (idev->cnf.disable_ipv6)) +if (idev &&unlikely (READ_ONCE (idev->cnf.disable_ipv6)))SKB_DR_SET (reason,IPV6DISABLED ); goto drop; }
net/ipv6/ip6_output.c +1 -1
@@ -227,7 +227,7 @@ int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb) skb->protocol =htons (ETH_P_IPV6 ); skb->dev = dev; -if (unlikely (idev->cnf.disable_ipv6)) { +if (unlikely (READ_ONCE (idev->cnf.disable_ipv6))) {IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTDISCARDS );kfree_skb_reason (skb,SKB_DROP_REASON_IPV6DISABLED );return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 202/301 ipv6: prevent NULL dereference in ip6_output()
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 4db783d68b9b39a411a96096c10828ff5dfada7a ]
According to syzbot, there is a chance that ip6_dst_idev() returns NULL in ip6_output(). Most places in IPv6 stack deal with a NULL idev just fine, but not here.
syzbot reported:
general protection fault, probably for non-canonical address 0xdffffc00000000bc: 0000 [#1] PREEMPT SMP KASAN PTI KASAN: null-ptr-deref in range [0x00000000000005e0-0x00000000000005e7] CPU: 0 PID: 9775 Comm: syz-executor.4 Not tainted 6.9.0-rc5-syzkaller-00157-g6a30653b604a #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 RIP: 0010:ip6_output+0x231/0x3f0 net/ipv6/ip6_output.c:237 Code: 3c 1e 00 49 89 df 74 08 4c 89 ef e8 19 58 db f7 48 8b 44 24 20 49 89 45 00 49 89 c5 48 8d 9d e0 05 00 00 48 89 d8 48 c1 e8 03 <42> 0f b6 04 38 84 c0 4c 8b 74 24 28 0f 85 61 01 00 00 8b 1b 31 ff RSP: 0018:ffffc9000927f0d8 EFLAGS: 00010202 RAX: 00000000000000bc RBX: 00000000000005e0 RCX: 0000000000040000 RDX: ffffc900131f9000 RSI: 0000000000004f47 RDI: 0000000000004f48 RBP: 0000000000000000 R08: ffffffff8a1f0b9a R09: 1ffffffff1f51fad R10: dffffc0000000000 R11: fffffbfff1f51fae R12: ffff8880293ec8c0 R13: ffff88805d7fc000 R14: 1ffff1100527d91a R15: dffffc0000000000 FS: 00007f135c6856c0(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020000080 CR3: 0000000064096000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> NF_HOOK include/linux/netfilter.h:314 [inline] ip6_xmit+0xefe/0x17f0 net/ipv6/ip6_output.c:358 sctp_v6_xmit+0x9f2/0x13f0 net/sctp/ipv6.c:248 sctp_packet_transmit+0x26ad/0x2ca0 net/sctp/output.c:653 sctp_packet_singleton+0x22c/0x320 net/sctp/outqueue.c:783 sctp_outq_flush_ctrl net/sctp/outqueue.c:914 [inline] sctp_outq_flush+0x6d5/0x3e20 net/sctp/outqueue.c:1212 sctp_side_effects net/sctp/sm_sideeffect.c:1198 [inline] sctp_do_sm+0x59cc/0x60c0 net/sctp/sm_sideeffect.c:1169 sctp_primitive_ASSOCIATE+0x95/0xc0 net/sctp/primitive.c:73 __sctp_connect+0x9cd/0xe30 net/sctp/socket.c:1234 sctp_connect net/sctp/socket.c:4819 [inline] sctp_inet_connect+0x149/0x1f0 net/sctp/socket.c:4834 __sys_connect_file net/socket.c:2048 [inline] __sys_connect+0x2df/0x310 net/socket.c:2065 __do_sys_connect net/socket.c:2075 [inline] __se_sys_connect net/socket.c:2072 [inline] __x64_sys_connect+0x7a/0x90 net/socket.c:2072 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- net/ipv6/ip6_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_output.c +1 -1
@@ -227,7 +227,7 @@ int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb) skb->protocol =htons (ETH_P_IPV6 ); skb->dev = dev; -if (unlikely (READ_ONCE (idev->cnf.disable_ipv6))) { +if (unlikely (!idev ||READ_ONCE (idev->cnf.disable_ipv6))) {IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTDISCARDS );kfree_skb_reason (skb,SKB_DROP_REASON_IPV6DISABLED );return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 203/301 net/smc: fix neighbour and rtable leak in smc_ib_find_route()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wen Gu <[email protected]>
[ Upstream commit 2ddc0dd7fec86ee53b8928a5cca5fbddd4fc7c06 ]
In smc_ib_find_route(), the neighbour found by neigh_lookup() and rtable resolved by ip_route_output_flow() are not released or put before return. It may cause the refcount leak, so fix it.
--- net/smc/smc_ib.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
net/smc/smc_ib.c +12 -7
@@ -209,13 +209,18 @@ int smc_ib_find_route(struct net *net, __be32 saddr, __be32 daddr,if (IS_ERR (rt)) goto out;if (rt->rt_uses_gateway && rt->rt_gw_family !=AF_INET ) - goto out; - neigh = rt->dst.ops->neigh_lookup (&rt->dst,NULL , &fl4.daddr); -if (neigh) { -memcpy (nexthop_mac, neigh->ha,ETH_ALEN ); - *uses_gateway = rt->rt_uses_gateway; -return 0 ; - } + goto out_rt; + neigh =dst_neigh_lookup (&rt->dst, &fl4.daddr); +if (!neigh) + goto out_rt; +memcpy (nexthop_mac, neigh->ha,ETH_ALEN ); + *uses_gateway = rt->rt_uses_gateway; +neigh_release (neigh); +ip_rt_put (rt); +return 0 ; + +out_rt: +ip_rt_put (rt); out:return -ENOENT ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 204/301 net: hns3: using user configure after hardware reset
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peiyang Wang <[email protected]>
[ Upstream commit 05eb60e9648cca0beeebdbcd263b599fb58aee48 ]
When a reset occurring, it's supposed to recover user's configuration. Currently, the port info(speed, duplex and autoneg) is stored in hclge_mac and will be scheduled updated. Consider the case that reset was happened consecutively. During the first reset, the port info is configured with a temporary value cause the PHY is reset and looking for best link config. Second reset start and use pervious configuration which is not the user's. The specific process is as follows:
+------+ +----+ +----+
| USER | | PF | | HW |
+---+--+ +-+--+ +-+--+
| ethtool --reset | |
+------------------->| reset command |
| ethtool --reset +-------------------->|
+------------------->| +---+
| +---+ | |
| | |reset currently | | HW RESET
| | |and wait to do | |
| |<--+ | |
| | send pervious cfg |<--+
| | (1000M FULL AN_ON) |
| +-------------------->|
| | read cfg(time task) |
| | (10M HALF AN_OFF) +---+
| |<--------------------+ | cfg take effect
| | reset command |<--+
| +-------------------->|
| | +---+
| | send pervious cfg | | HW RESET
| | (10M HALF AN_OFF) |<--+
| +-------------------->|
| | read cfg(time task) |
| | (10M HALF AN_OFF) +---+
| |<--------------------+ | cfg take effect
| | | |
| | read cfg(time task) |<--+
| | (10M HALF AN_OFF) |
| |<--------------------+
| | |
v v vTo avoid aboved situation, this patch introduced req_speed, req_duplex, req_autoneg to store user's configuration and it only be used after hardware reset and to recover user's configuration
--- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 15 +++++++++------ .../ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 3 +++ 2 files changed, 12 insertions(+), 6 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +9 -6
@@ -1526,6 +1526,9 @@ static int hclge_configure(struct hclge_dev *hdev) cfg.default_speed, ret);return ret; } + hdev->hw.mac.req_speed = hdev->hw.mac.speed; + hdev->hw.mac.req_autoneg =AUTONEG_ENABLE ; + hdev->hw.mac.req_duplex =DUPLEX_FULL ;hclge_parse_link_mode (hdev, cfg.speed_ability);
@@ -3331,9 +3334,9 @@ hclge_set_phy_link_ksettings(struct hnae3_handle *handle,return ret; } - hdev->hw.mac.autoneg = cmd->base.autoneg; - hdev->hw.mac.speed = cmd->base.speed; - hdev->hw.mac.duplex = cmd->base.duplex; + hdev->hw.mac.req_autoneg = cmd->base.autoneg; + hdev->hw.mac.req_speed = cmd->base.speed; + hdev->hw.mac.req_duplex = cmd->base.duplex;linkmode_copy (hdev->hw.mac.advertising, cmd->link_modes.advertising);return 0 ;
@@ -3366,9 +3369,9 @@ static int hclge_tp_port_init(struct hclge_dev *hdev)if (!hnae3_dev_phy_imp_supported (hdev))return 0 ; - cmd.base.autoneg = hdev->hw.mac.autoneg; - cmd.base.speed = hdev->hw.mac.speed; - cmd.base.duplex = hdev->hw.mac.duplex; + cmd.base.autoneg = hdev->hw.mac.req_autoneg; + cmd.base.speed = hdev->hw.mac.req_speed; + cmd.base.duplex = hdev->hw.mac.req_duplex;linkmode_copy (cmd.link_modes.advertising, hdev->hw.mac.advertising);return hclge_set_phy_link_ksettings (&hdev->vport->nic, &cmd);
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +3 -0
@@ -263,11 +263,14 @@ struct hclge_mac {u8 media_type;/* port media type, e.g. fibre/copper/backplane */ u8 mac_addr[ETH_ALEN ];u8 autoneg; +u8 req_autoneg;u8 duplex; +u8 req_duplex;u8 support_autoneg;u8 speed_type;/* 0: sfp speed, 1: active speed */ u8 lane_num;u32 speed; +u32 req_speed;u32 max_speed;u32 speed_ability;/* speed ability supported by current media */ u32 module_type;/* sub media type, e.g. kr/cr/sr/lr */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 205/301 net: hns3: direct return when receive a unknown mailbox message
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jian Shen <[email protected]>
[ Upstream commit 669554c512d2107e2f21616f38e050d40655101f ]
Currently, the driver didn't return when receive a unknown mailbox message, and continue checking whether need to generate a response. It's unnecessary and may be incorrect.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +4 -3
@@ -1077,12 +1077,13 @@ static void hclge_mbx_request_handling(struct hclge_mbx_ops_param *param) hdev = param->vport->back; cmd_func = hclge_mbx_ops_list[param->req->msg.code]; -if (cmd_func) - ret =cmd_func (param); -else +if (!cmd_func) {dev_err (&hdev->pdev->dev,"un-supported mailbox message, code = %u\n" , param->req->msg.code); +return ; + } + ret =cmd_func (param);/* PF driver should not reply IMP */ if (hnae3_get_bit(param->req->mbx_need_resp, HCLGE_MBX_NEED_RESP_B) &&
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 206/301 net: hns3: change type of numa_node_mask as nodemask_t
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peiyang Wang <[email protected]>
[ Upstream commit 6639a7b953212ac51aa4baa7d7fb855bf736cf56 ]
It provides nodemask_t to describe the numa node mask in kernel. To improve transportability, change the type of numa_node_mask as nodemask_t.
--- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 ++++-- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 7 ++++--- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hnae3.h +1 -1
@@ -890,7 +890,7 @@ struct hnae3_handle {struct hnae3_roce_private_info rinfo; }; -u32 numa_node_mask;/* for multi-chip support */ +nodemask_t numa_node_mask;/* for multi-chip support */ enum hnae3_port_base_vlan_state port_base_vlan_state;
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +4 -2
@@ -1758,7 +1758,8 @@ static int hclge_vport_setup(struct hclge_vport *vport, u16 num_tqps) nic->pdev = hdev->pdev; nic->ae_algo = &ae_algo; - nic->numa_node_mask = hdev->numa_node_mask; +bitmap_copy (nic->numa_node_mask.bits, hdev->numa_node_mask.bits, +MAX_NUMNODES ); nic->kinfo.io_base = hdev->hw.hw.io_base; ret = hclge_knic_setup(vport, num_tqps,
@@ -2450,7 +2451,8 @@ static int hclge_init_roce_base_info(struct hclge_vport *vport) roce->pdev = nic->pdev; roce->ae_algo = nic->ae_algo; - roce->numa_node_mask = nic->numa_node_mask; +bitmap_copy (roce->numa_node_mask.bits, nic->numa_node_mask.bits, +MAX_NUMNODES );return 0 ; }
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +1 -1
@@ -878,7 +878,7 @@ struct hclge_dev {u16 fdir_pf_filter_count;/* Num of guaranteed filters for this PF */ u16 num_alloc_vport;/* Num vports this driver supports */ -u32 numa_node_mask; +nodemask_t numa_node_mask;u16 rx_buf_len;u16 num_tx_desc;/* desc num of per tx queue */ u16 num_rx_desc;/* desc num of per rx queue */
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +4 -3
@@ -412,7 +412,8 @@ static int hclgevf_set_handle_info(struct hclgevf_dev *hdev) nic->ae_algo = &ae_algovf; nic->pdev = hdev->pdev; - nic->numa_node_mask = hdev->numa_node_mask; +bitmap_copy (nic->numa_node_mask.bits, hdev->numa_node_mask.bits, +MAX_NUMNODES ); nic->flags |=HNAE3_SUPPORT_VF ; nic->kinfo.io_base = hdev->hw.hw.io_base;
@@ -2082,8 +2083,8 @@ static int hclgevf_init_roce_base_info(struct hclgevf_dev *hdev) roce->pdev = nic->pdev; roce->ae_algo = nic->ae_algo; - roce->numa_node_mask = nic->numa_node_mask; - +bitmap_copy (roce->numa_node_mask.bits, nic->numa_node_mask.bits, +MAX_NUMNODES );return 0 ; }
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h +1 -1
@@ -236,7 +236,7 @@ struct hclgevf_dev {u16 rss_size_max;/* HW defined max RSS task queue */ u16 num_alloc_vport;/* num vports this driver supports */ -u32 numa_node_mask; +nodemask_t numa_node_mask;u16 rx_buf_len;u16 num_tx_desc;/* desc num of per tx queue */ u16 num_rx_desc;/* desc num of per rx queue */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 207/301 net: hns3: release PTP resources if pf initialization failed
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peiyang Wang <[email protected]>
[ Upstream commit 950aa42399893a170d9b57eda0e4a3ff91fd8b70 ]
During the PF initialization process, hclge_update_port_info may return an error code for some reason. At this point, the ptp initialization has been completed. To void memory leaks, the resources that are applied by ptp should be released. Therefore, when hclge_update_port_info returns an error code, hclge_ptp_uninit is called to release the corresponding resources.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +3 -1
@@ -11752,7 +11752,7 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) ret =hclge_update_port_info (hdev);if (ret) - goto err_mdiobus_unreg; + goto err_ptp_uninit;INIT_KFIFO (hdev->mac_tnl_log);
@@ -11803,6 +11803,8 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)devl_unlock (hdev->devlink);return 0 ; +err_ptp_uninit: +hclge_ptp_uninit (hdev); err_mdiobus_unreg:if (hdev->hw.mac.phydev)mdiobus_unregister (hdev->hw.mac.mdio_bus);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 208/301 net: hns3: use appropriate barrier function after setting a bit value
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peiyang Wang <[email protected]>
[ Upstream commit 094c281228529d333458208fd02fcac3b139d93b ]
There is a memory barrier in followed case. When set the port down, hclgevf_set_timmer will set DOWN in state. Meanwhile, the service task has different behaviour based on whether the state is DOWN. Thus, to make sure service task see DOWN, use smp_mb__after_atomic after calling set_bit().
CPU0 CPU1
========================== ===================================hclgevf_set_timer_task() hclgevf_periodic_service_task()
set_bit(DOWN,state) test_bit(DOWN,state)
pf also has this issue.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +-- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +1 -2
@@ -7945,8 +7945,7 @@ static void hclge_set_timer_task(struct hnae3_handle *handle, bool enable)/* Set the DOWN flag here to disable link updating */ set_bit (HCLGE_STATE_DOWN , &hdev->state); -/* flush memory to make sure DOWN is seen by service task */ -smp_mb__before_atomic (); +smp_mb__after_atomic ();/* flush memory to make sure DOWN is seen by service task */ hclge_flush_link_update (hdev); } }
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +1 -2
@@ -2181,8 +2181,7 @@ static void hclgevf_set_timer_task(struct hnae3_handle *handle, bool enable) }else {set_bit (HCLGEVF_STATE_DOWN , &hdev->state); -/* flush memory to make sure DOWN is seen by service task */ -smp_mb__before_atomic (); +smp_mb__after_atomic ();/* flush memory to make sure DOWN is seen by service task */ hclgevf_flush_link_update (hdev); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 209/301 net: hns3: fix port vlan filter not disabled issue
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonglong Liu <[email protected]>
[ Upstream commit f5db7a3b65c84d723ca5e2bb6e83115180ab6336 ]
According to hardware limitation, for device support modify VLAN filter state but not support bypass port VLAN filter, it should always disable the port VLAN filter. but the driver enables port VLAN filter when initializing, if there is no VLAN(except VLAN 0) id added, the driver will disable it in service task. In most time, it works fine. But there is a time window before the service task shceduled and net device being registered. So if user adds VLAN at this time, the driver will not update the VLAN filter state, and the port VLAN filter remains enabled.
To fix the problem, if support modify VLAN filter state but not support bypass port VLAN filter, set the port vlan filter to "off".
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +6 -1
@@ -9898,6 +9898,7 @@ static int hclge_set_vlan_protocol_type(struct hclge_dev *hdev)static int hclge_init_vlan_filter (struct hclge_dev *hdev) {struct hclge_vport *vport; +bool enable = true;int ret;int i;
@@ -9917,8 +9918,12 @@ static int hclge_init_vlan_filter(struct hclge_dev *hdev) vport->cur_vlan_fltr_en = true; } +if (test_bit (HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B , hdev->ae_dev->caps) && + !test_bit (HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B , hdev->ae_dev->caps)) + enable = false; +return hclge_set_vlan_filter_ctrl (hdev,HCLGE_FILTER_TYPE_PORT , -HCLGE_FILTER_FE_INGRESS , true,0 ); +HCLGE_FILTER_FE_INGRESS , enable,0 ); }static int hclge_init_vlan_type (struct hclge_dev *hdev)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 210/301 net: hns3: fix kernel crash when devlink reload during initialization
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonglong Liu <[email protected]>
[ Upstream commit 35d92abfbad88cf947c010baf34b075e40566095 ]
The devlink reload process will access the hardware resources, but the register operation is done before the hardware is initialized. So, processing the devlink reload during initialization may lead to kernel crash.
This patch fixes this by registering the devlink after hardware initialization.
--- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 17 +++++------------ .../hisilicon/hns3/hns3vf/hclgevf_main.c | 10 ++++------ 2 files changed, 9 insertions(+), 18 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +5 -12
@@ -11619,16 +11619,10 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)if (ret) goto out; - ret =hclge_devlink_init (hdev); -if (ret) - goto err_pci_uninit; - -devl_lock (hdev->devlink); -/* Firmware command queue initialize */ ret =hclge_comm_cmd_queue_init (hdev->pdev, &hdev->hw.hw);if (ret) - goto err_devlink_uninit; + goto err_pci_uninit;/* Firmware command initialize */ ret = hclge_comm_cmd_init(hdev->ae_dev, &hdev->hw.hw, &hdev->fw_version,
@@ -11796,6 +11790,10 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)dev_warn (&pdev->dev,"failed to wake on lan init, ret = %d\n" , ret); + ret =hclge_devlink_init (hdev); +if (ret) + goto err_ptp_uninit; +hclge_state_init (hdev); hdev->last_reset_time = jiffies;
@@ -11803,8 +11801,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) HCLGE_DRIVER_NAME);hclge_task_schedule (hdev,round_jiffies_relative (HZ )); - -devl_unlock (hdev->devlink);return 0 ; err_ptp_uninit:
@@ -11818,9 +11814,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)pci_free_irq_vectors (pdev); err_cmd_uninit:hclge_comm_cmd_uninit (hdev->ae_dev, &hdev->hw.hw); -err_devlink_uninit: -devl_unlock (hdev->devlink); -hclge_devlink_uninit (hdev); err_pci_uninit:pcim_iounmap (pdev, hdev->hw.hw.io_base);pci_release_regions (pdev);
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +4 -6
@@ -2845,10 +2845,6 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)if (ret)return ret; - ret =hclgevf_devlink_init (hdev); -if (ret) - goto err_devlink_init; - ret =hclge_comm_cmd_queue_init (hdev->pdev, &hdev->hw.hw);if (ret) goto err_cmd_queue_init;
@@ -2941,6 +2937,10 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)hclgevf_init_rxd_adv_layout (hdev); + ret =hclgevf_devlink_init (hdev); +if (ret) + goto err_config; +set_bit (HCLGEVF_STATE_SERVICE_INITED , &hdev->state); hdev->last_reset_time = jiffies;
@@ -2960,8 +2960,6 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev) err_cmd_init:hclge_comm_cmd_uninit (hdev->ae_dev, &hdev->hw.hw); err_cmd_queue_init: -hclgevf_devlink_uninit (hdev); -err_devlink_init:hclgevf_pci_uninit (hdev);clear_bit (HCLGEVF_STATE_IRQ_INITED , &hdev->state);return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 211/301 net: dsa: mv88e6xxx: add phylink_get_caps for the mv88e6320/21 family
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Bätz <[email protected]>
[ Upstream commit f39bf3cf08a49e7d20c44bc8bc8e390fea69959a ]
As of commit de5c9bf40c45 ("net: phylink: require supported_interfaces to be filled")
Marvell 88e6320/21 switches fail to be probed:
...
mv88e6085 30be0000.ethernet-1:00: phylink: error: empty supported_interfaces error creating PHYLINK: -22
...
The problem stems from the use of mv88e6185_phylink_get_caps() to get the device capabilities.
Since there are serdes only ports 0/1 included, create a new dedicated phylink_get_caps for the 6320 and 6321 to properly support their set of capabilities.
--- drivers/net/dsa/mv88e6xxx/chip.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +14 -2
@@ -697,6 +697,18 @@ static void mv88e6352_phylink_get_caps(struct mv88e6xxx_chip *chip, int port, } } +static void mv88e632x_phylink_get_caps (struct mv88e6xxx_chip *chip,int port, +struct phylink_config *config) +{ +unsigned long *supported = config->supported_interfaces; + +/* Translate the default cmode */ +mv88e6xxx_translate_cmode (chip->ports[port].cmode, supported); + + config->mac_capabilities =MAC_SYM_PAUSE |MAC_10 |MAC_100 | +MAC_1000FD ; +} +static void mv88e6341_phylink_get_caps (struct mv88e6xxx_chip *chip,int port,struct phylink_config *config) {
@@ -4976,7 +4988,7 @@ static const struct mv88e6xxx_ops mv88e6320_ops = { .gpio_ops = &mv88e6352_gpio_ops, .avb_ops = &mv88e6352_avb_ops, .ptp_ops = &mv88e6352_ptp_ops, - .phylink_get_caps = mv88e6185_phylink_get_caps, + .phylink_get_caps = mv88e632x_phylink_get_caps, };static const struct mv88e6xxx_ops mv88e6321_ops = {
@@ -5022,7 +5034,7 @@ static const struct mv88e6xxx_ops mv88e6321_ops = { .gpio_ops = &mv88e6352_gpio_ops, .avb_ops = &mv88e6352_avb_ops, .ptp_ops = &mv88e6352_ptp_ops, - .phylink_get_caps = mv88e6185_phylink_get_caps, + .phylink_get_caps = mv88e632x_phylink_get_caps, };static const struct mv88e6xxx_ops mv88e6341_ops = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 212/301 drm/meson: dw-hdmi: power up phy on device init
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Brunet <[email protected]>
[ Upstream commit 04703bfd7f99c016a823c74712b97f8b5590ce87 ]
The phy is not in a useful state right after init. It will become useful, including for auxiliary function such as CEC or ARC, after the first mode is set. This is a problem on systems where the display is using another interface like DSI or CVBS.
This change refactor the init and mode change callback to power up the PHY on init and leave only what is necessary for mode changes in the related function. This is enough to fix CEC operation when HDMI display is not enabled.
--- drivers/gpu/drm/meson/meson_dw_hdmi.c | 51 +++++++++------------------ 1 file changed, 17 insertions(+), 34 deletions(-)
drivers/gpu/drm/meson/meson_dw_hdmi.c +17 -34
@@ -384,26 +384,6 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, dw_hdmi_bus_fmt_is_420(hdmi)) mode_is_420 = true; -/* Enable clocks */ -regmap_update_bits (priv->hhi,HHI_HDMI_CLK_CNTL ,0xffff ,0x100 ); - -/* Bring HDMITX MEM output of power down */ -regmap_update_bits (priv->hhi,HHI_MEM_PD_REG0 ,0xff <<8 ,0 ); - -/* Bring out of reset */ - dw_hdmi->data->top_write (dw_hdmi,HDMITX_TOP_SW_RESET ,0 ); - -/* Enable internal pixclk, tmds_clk, spdif_clk, i2s_clk, cecclk */ -dw_hdmi_top_write_bits (dw_hdmi,HDMITX_TOP_CLK_CNTL , -0x3 ,0x3 ); - -/* Enable cec_clk and hdcp22_tmdsclk_en */ -dw_hdmi_top_write_bits (dw_hdmi,HDMITX_TOP_CLK_CNTL , -0x3 <<4 ,0x3 <<4 ); - -/* Enable normal output to PHY */ - dw_hdmi->data->top_write (dw_hdmi,HDMITX_TOP_BIST_CNTL ,BIT (12 )); -/* TMDS pattern setup */ if (mode->clock >340000 && !mode_is_420) { dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_01,
@@ -425,20 +405,6 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,/* Setup PHY parameters */ meson_hdmi_phy_setup_mode (dw_hdmi, mode, mode_is_420); -/* Setup PHY */ -regmap_update_bits (priv->hhi,HHI_HDMI_PHY_CNTL1 , -0xffff <<16 ,0x0390 <<16 ); - -/* BIT_INVERT */ -if (dw_hdmi_is_compatible (dw_hdmi,"amlogic,meson-gxl-dw-hdmi" ) || -dw_hdmi_is_compatible (dw_hdmi,"amlogic,meson-gxm-dw-hdmi" ) || -dw_hdmi_is_compatible (dw_hdmi,"amlogic,meson-g12a-dw-hdmi" )) -regmap_update_bits (priv->hhi,HHI_HDMI_PHY_CNTL1 , -BIT (17 ),0 ); -else -regmap_update_bits (priv->hhi,HHI_HDMI_PHY_CNTL1 , -BIT (17 ),BIT (17 )); -/* Disable clock, fifo, fifo_wr */ regmap_update_bits (priv->hhi,HHI_HDMI_PHY_CNTL1 ,0xf ,0 );
@@ -656,6 +622,23 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi) meson_dw_hdmi->data->top_write (meson_dw_hdmi,HDMITX_TOP_CLK_CNTL ,0xff ); +/* Enable normal output to PHY */ + meson_dw_hdmi->data->top_write (meson_dw_hdmi,HDMITX_TOP_BIST_CNTL ,BIT (12 )); + +/* Setup PHY */ +regmap_update_bits (priv->hhi,HHI_HDMI_PHY_CNTL1 , +0xffff <<16 ,0x0390 <<16 ); + +/* BIT_INVERT */ +if (dw_hdmi_is_compatible (meson_dw_hdmi,"amlogic,meson-gxl-dw-hdmi" ) || +dw_hdmi_is_compatible (meson_dw_hdmi,"amlogic,meson-gxm-dw-hdmi" ) || +dw_hdmi_is_compatible (meson_dw_hdmi,"amlogic,meson-g12a-dw-hdmi" )) +regmap_update_bits (priv->hhi,HHI_HDMI_PHY_CNTL1 , +BIT (17 ),0 ); +else +regmap_update_bits (priv->hhi,HHI_HDMI_PHY_CNTL1 , +BIT (17 ),BIT (17 )); +/* Enable HDMI-TX Interrupt */ meson_dw_hdmi->data->top_write (meson_dw_hdmi,HDMITX_TOP_INTR_STAT_CLR ,HDMITX_TOP_INTR_CORE );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 213/301 drm/meson: dw-hdmi: add bandgap setting for g12
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Brunet <[email protected]>
[ Upstream commit 08001033121dd92b8297a5b7333636b466c30f13 ]
When no mode is set, the utility pin appears to be grounded. No signal is getting through.
This is problematic because ARC and eARC use this line and may do so even if no display mode is set.
This change enable the bandgap setting on g12 chip, which fix the problem with the utility pin. This is done by restoring init values on PHY init and disable.
--- drivers/gpu/drm/meson/meson_dw_hdmi.c | 43 ++++++++++++++++----------- 1 file changed, 26 insertions(+), 17 deletions(-)
drivers/gpu/drm/meson/meson_dw_hdmi.c +26 -17
@@ -106,6 +106,8 @@#define HHI_HDMI_CLK_CNTL 0x1cc/* 0x73 */ #define HHI_HDMI_PHY_CNTL0 0x3a0/* 0xe8 */ #define HHI_HDMI_PHY_CNTL1 0x3a4/* 0xe9 */ +#define PHY_CNTL1_INIT 0x03900000 +#define PHY_INVERT BIT(17)#define HHI_HDMI_PHY_CNTL2 0x3a8/* 0xea */ #define HHI_HDMI_PHY_CNTL3 0x3ac/* 0xeb */ #define HHI_HDMI_PHY_CNTL4 0x3b0/* 0xec */
@@ -130,6 +132,8 @@ struct meson_dw_hdmi_data { unsigned int addr);void (*dwc_write)(struct meson_dw_hdmi *dw_hdmi,unsigned int addr,unsigned int data); +u32 cntl0_init; +u32 cntl1_init; };struct meson_dw_hdmi {
@@ -458,7 +462,9 @@ static void dw_hdmi_phy_disable(struct dw_hdmi *hdmi,DRM_DEBUG_DRIVER ("\n" ); -regmap_write (priv->hhi,HHI_HDMI_PHY_CNTL0 ,0 ); +/* Fallback to init mode */ +regmap_write (priv->hhi,HHI_HDMI_PHY_CNTL1 , dw_hdmi->data->cntl1_init); +regmap_write (priv->hhi,HHI_HDMI_PHY_CNTL0 , dw_hdmi->data->cntl0_init); } static enum drm_connector_status dw_hdmi_read_hpd(struct dw_hdmi *hdmi,
@@ -576,11 +582,22 @@ static const struct regmap_config meson_dw_hdmi_regmap_config = { .fast_io = true, }; -static const struct meson_dw_hdmi_data meson_dw_hdmi_gx_data = { +static const struct meson_dw_hdmi_data meson_dw_hdmi_gxbb_data = { .top_read = dw_hdmi_top_read, .top_write = dw_hdmi_top_write, .dwc_read = dw_hdmi_dwc_read, .dwc_write = dw_hdmi_dwc_write, + .cntl0_init =0x0 , + .cntl1_init =PHY_CNTL1_INIT |PHY_INVERT , +}; + +static const struct meson_dw_hdmi_data meson_dw_hdmi_gxl_data = { + .top_read = dw_hdmi_top_read, + .top_write = dw_hdmi_top_write, + .dwc_read = dw_hdmi_dwc_read, + .dwc_write = dw_hdmi_dwc_write, + .cntl0_init =0x0 , + .cntl1_init =PHY_CNTL1_INIT , };static const struct meson_dw_hdmi_data meson_dw_hdmi_g12a_data = {
@@ -588,6 +605,8 @@ static const struct meson_dw_hdmi_data meson_dw_hdmi_g12a_data = { .top_write = dw_hdmi_g12a_top_write, .dwc_read = dw_hdmi_g12a_dwc_read, .dwc_write = dw_hdmi_g12a_dwc_write, + .cntl0_init = 0x000b4242, /* Bandgap */ + .cntl1_init = PHY_CNTL1_INIT, };static void meson_dw_hdmi_init (struct meson_dw_hdmi *meson_dw_hdmi)
@@ -626,18 +645,8 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi) meson_dw_hdmi->data->top_write (meson_dw_hdmi,HDMITX_TOP_BIST_CNTL ,BIT (12 ));/* Setup PHY */ -regmap_update_bits (priv->hhi,HHI_HDMI_PHY_CNTL1 , -0xffff <<16 ,0x0390 <<16 ); - -/* BIT_INVERT */ -if (dw_hdmi_is_compatible (meson_dw_hdmi,"amlogic,meson-gxl-dw-hdmi" ) || -dw_hdmi_is_compatible (meson_dw_hdmi,"amlogic,meson-gxm-dw-hdmi" ) || -dw_hdmi_is_compatible (meson_dw_hdmi,"amlogic,meson-g12a-dw-hdmi" )) -regmap_update_bits (priv->hhi,HHI_HDMI_PHY_CNTL1 , -BIT (17 ),0 ); -else -regmap_update_bits (priv->hhi,HHI_HDMI_PHY_CNTL1 , -BIT (17 ),BIT (17 )); +regmap_write (priv->hhi,HHI_HDMI_PHY_CNTL1 , meson_dw_hdmi->data->cntl1_init); +regmap_write (priv->hhi,HHI_HDMI_PHY_CNTL0 , meson_dw_hdmi->data->cntl0_init);/* Enable HDMI-TX Interrupt */ meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_INTR_STAT_CLR,
@@ -848,11 +857,11 @@ static const struct dev_pm_ops meson_dw_hdmi_pm_ops = {static const struct of_device_id meson_dw_hdmi_of_table[] = { { .compatible ="amlogic,meson-gxbb-dw-hdmi" , - .data = &meson_dw_hdmi_gx_data }, + .data = &meson_dw_hdmi_gxbb_data }, { .compatible ="amlogic,meson-gxl-dw-hdmi" , - .data = &meson_dw_hdmi_gx_data }, + .data = &meson_dw_hdmi_gxl_data }, { .compatible ="amlogic,meson-gxm-dw-hdmi" , - .data = &meson_dw_hdmi_gx_data }, + .data = &meson_dw_hdmi_gxl_data }, { .compatible ="amlogic,meson-g12a-dw-hdmi" , .data = &meson_dw_hdmi_g12a_data }, { }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 214/301 drm/connector: Add \n to message about demoting connector force-probes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 6897204ea3df808d342c8e4613135728bc538bcd ]
The debug print clearly lacks a \n at the end. Add it.
--- drivers/gpu/drm/drm_connector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_connector.c +1 -1
@@ -2925,7 +2925,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, dev->mode_config.max_width, dev->mode_config.max_height); else - drm_dbg_kms(dev, "User-space requested a forced probe on [CONNECTOR:%d:%s] but is not the DRM master, demoting to read-only probe", + drm_dbg_kms(dev, "User-space requested a forced probe on [CONNECTOR:%d:%s] but is not the DRM master, demoting to read-only probe\n", connector->base.id, connector->name); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 215/301 dm/amd/pm: Fix problems with reboot/shutdown for some SMU 13.0.4/13.0.11 users
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 cd94d1b182d2986378550c9087571991bfee01d4 ]
Limit the workaround introduced by commit 31729e8c21ec ("drm/amd/pm: fixes a random hang in S4 for SMU v13.0.4/11") to only run in the s4 path.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c +1 -1
@@ -226,7 +226,7 @@ static int smu_v13_0_4_system_features_control(struct smu_context *smu, bool en)struct amdgpu_device *adev = smu->adev;int ret =0 ; -if (!en && !adev->in_s0ix) { +if (!en && adev->in_s4) {/* Adds a GFX reset as workaround just before sending the * MP1_UNLOAD message to prevent GC/RLC/PMFW from entering * an invalid state.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 216/301 gpiolib: cdev: Fix use after free in lineinfo_changed_notify
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhongqiu Han <[email protected]>
[ Upstream commit 02f6b0e1ec7e0e7d059dddc893645816552039da ]
The use-after-free issue occurs as follows: when the GPIO chip device file is being closed by invoking gpio_chrdev_release(), watched_lines is freed by bitmap_free(), but the unregistration of lineinfo_changed_nb notifier chain failed due to waiting write rwsem. Additionally, one of the GPIO chip's lines is also in the release process and holds the notifier chain's read rwsem. Consequently, a race condition leads to the use-after-free of watched_lines.
Here is the typical stack when issue happened:
[free]gpio_chrdev_release()
--> bitmap_free(cdev->watched_lines) <-- freed
--> blocking_notifier_chain_unregister()
--> down_write(&nh->rwsem) <-- waiting rwsem
--> __down_write_common()
--> rwsem_down_write_slowpath()
--> schedule_preempt_disabled()
--> schedule()[use]st54spi_gpio_dev_release()
--> gpio_free()
--> gpiod_free()
--> gpiod_free_commit()
--> gpiod_line_state_notify()
--> blocking_notifier_call_chain()
--> down_read(&nh->rwsem); <-- held rwsem
--> notifier_call_chain()
--> lineinfo_changed_notify()
--> test_bit(xxxx, cdev->watched_lines) <-- use after freeThe side effect of the use-after-free issue is that a GPIO line event is being generated for userspace where it shouldn't. However, since the chrdev is being closed, userspace won't have the chance to read that event anyway.
To fix the issue, call the bitmap_free() function after the unregistration of lineinfo_changed_nb notifier chain.
--- drivers/gpio/gpiolib-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib-cdev.c +1 -1
@@ -2816,11 +2816,11 @@ static int gpio_chrdev_release(struct inode *inode, struct file *file)struct gpio_chardev_data *cdev = file->private_data;struct gpio_device *gdev = cdev->gdev; -bitmap_free (cdev->watched_lines);blocking_notifier_chain_unregister (&gdev->device_notifier, &cdev->device_unregistered_nb);blocking_notifier_chain_unregister (&gdev->line_state_notifier, &cdev->lineinfo_changed_nb); +bitmap_free (cdev->watched_lines);gpio_device_put (gdev);kfree (cdev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 217/301 gpiolib: cdev: relocate debounce_period_us from struct gpio_desc
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kent Gibson <[email protected]>
[ Upstream commit 9344e34e7992fec95ce6210d95ac01437dd327ab ]
Store the debounce period for a requested line locally, rather than in the debounce_period_us field in the gpiolib struct gpio_desc.
Add a global tree of lines containing supplemental line information to make the debounce period available to be reported by the GPIO_V2_GET_LINEINFO_IOCTL and the line change notifier.
Stable-dep-of: ee0166b637a5 ("gpiolib: cdev: fix uninitialised kfifo")
--- drivers/gpio/gpiolib-cdev.c | 165 +++++++++++++++++++++++++++++++----- 1 file changed, 142 insertions(+), 23 deletions(-)
drivers/gpio/gpiolib-cdev.c +142 -23
@@ -5,6 +5,7 @@#include <linux/bitmap.h> #include <linux/build_bug.h> #include <linux/cdev.h> +#include <linux/cleanup.h> #include <linux/compat.h> #include <linux/compiler.h> #include <linux/device.h>
@@ -21,6 +22,7 @@#include <linux/mutex.h> #include <linux/pinctrl/consumer.h> #include <linux/poll.h> +#include <linux/rbtree.h> #include <linux/seq_file.h> #include <linux/spinlock.h> #include <linux/timekeeping.h>
@@ -461,6 +463,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)/** * struct line - contains the state of a requested line +* @node: to store the object in supinfo_tree if supplemental * @desc: the GPIO descriptor for this line. * @req: the corresponding line request * @irq: the interrupt triggered in response to events on this GPIO
@@ -473,6 +476,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)* @line_seqno: the seqno for the current edge event in the sequence of * events for this line. * @work: the worker that implements software debouncing +* @debounce_period_us: the debounce period in microseconds * @sw_debounced: flag indicating if the software debouncer is active * @level: the current debounced physical level of the line * @hdesc: the Hardware Timestamp Engine (HTE) descriptor
@@ -481,6 +485,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)* @last_seqno: the last sequence number before debounce period expires */ struct line { +struct rb_node node;struct gpio_desc *desc;/* * -- edge detector specific fields --
@@ -514,6 +519,15 @@ struct line {* -- debouncer specific fields -- */ struct delayed_work work; +/* +* debounce_period_us is accessed by debounce_irq_handler() and +* process_hw_ts() which are disabled when modified by +* debounce_setup(), edge_detector_setup() or edge_detector_stop() +* or can live with a stale version when updated by +* edge_detector_update(). +* The modifying functions are themselves mutually exclusive. +*/ +unsigned int debounce_period_us;/* * sw_debounce is accessed by linereq_set_config(), which is the * only setter, and linereq_get_values(), which can live with a
@@ -546,6 +560,17 @@ struct line {#endif /* CONFIG_HTE */ }; +/* +* a rbtree of the struct lines containing supplemental info. +* Used to populate gpio_v2_line_info with cdev specific fields not contained +* in the struct gpio_desc. +* A line is determined to contain supplemental information by +* line_has_supinfo(). +*/ +static struct rb_root supinfo_tree =RB_ROOT ; +/* covers supinfo_tree */ +static DEFINE_SPINLOCK (supinfo_lock); +/** * struct linereq - contains the state of a userspace line request * @gdev: the GPIO device the line request pertains to
@@ -559,7 +584,8 @@ struct line {* this line request. Note that this is not used when @num_lines is 1, as * the line_seqno is then the same and is cheaper to calculate. * @config_mutex: mutex for serializing ioctl() calls to ensure consistency -* of configuration, particularly multi-step accesses to desc flags. +* of configuration, particularly multi-step accesses to desc flags and +* changes to supinfo status. * @lines: the lines held by this line request, with @num_lines elements. */ struct linereq {
@@ -575,6 +601,103 @@ struct linereq {struct line lines[]; }; +static void supinfo_insert (struct line *line) +{ +struct rb_node **new = &(supinfo_tree.rb_node), *parent =NULL ; +struct line *entry; + +guard (spinlock)(&supinfo_lock); + +while (*new) { + entry = container_of(*new, struct line, node); + + parent = *new; +if (line->desc < entry->desc) { + new = &((*new)->rb_left); + }else if (line->desc > entry->desc) { + new = &((*new)->rb_right); + }else { +/* this should never happen */ +WARN (1 ,"duplicate line inserted" ); +return ; + } + } + +rb_link_node (&line->node, parent, new); +rb_insert_color (&line->node, &supinfo_tree); +} + +static void supinfo_erase (struct line *line) +{ +guard (spinlock)(&supinfo_lock); + +rb_erase (&line->node, &supinfo_tree); +} + +static struct line *supinfo_find (struct gpio_desc *desc) +{ +struct rb_node *node = supinfo_tree.rb_node; +struct line *line; + +while (node) { + line = container_of(node, struct line, node); +if (desc < line->desc) + node = node->rb_left; +else if (desc > line->desc) + node = node->rb_right; +else +return line; + } +return NULL ; +} + +static void supinfo_to_lineinfo (struct gpio_desc *desc, +struct gpio_v2_line_info *info) +{ +struct gpio_v2_line_attribute *attr; +struct line *line; + +guard (spinlock)(&supinfo_lock); + + line =supinfo_find (desc); +if (!line) +return ; + + attr = &info->attrs[info->num_attrs]; + attr->id =GPIO_V2_LINE_ATTR_ID_DEBOUNCE ; + attr->debounce_period_us =READ_ONCE (line->debounce_period_us); + info->num_attrs++; +} + +static inline bool line_has_supinfo (struct line *line) +{ +return READ_ONCE (line->debounce_period_us); +} + +/* +* Checks line_has_supinfo() before and after the change to avoid unnecessary +* supinfo_tree access. +* Called indirectly by linereq_create() or linereq_set_config() so line +* is already protected from concurrent changes. +*/ +static void line_set_debounce_period (struct line *line, +unsigned int debounce_period_us) +{ +bool was_suppl =line_has_supinfo (line); + +WRITE_ONCE (line->debounce_period_us, debounce_period_us); + +/* if supinfo status is unchanged then we're done */ +if (line_has_supinfo (line) == was_suppl) +return ; + +/* supinfo status has changed, so update the tree */ +if (was_suppl) +supinfo_erase (line); +else +supinfo_insert (line); +} +#define GPIO_V2_LINE_BIAS_FLAGS \ (GPIO_V2_LINE_FLAG_BIAS_PULL_UP | \ GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN | \
@@ -742,7 +865,7 @@ static enum hte_return process_hw_ts(struct hte_ts_data *ts, void *p) line->total_discard_seq++; line->last_seqno = ts->seq;mod_delayed_work (system_wq, &line->work, -usecs_to_jiffies (READ_ONCE (line->desc->debounce_period_us))); +usecs_to_jiffies (READ_ONCE (line->debounce_period_us))); }else {if (unlikely (ts->seq < line->line_seqno))return HTE_CB_HANDLED ;
@@ -883,7 +1006,7 @@ static irqreturn_t debounce_irq_handler(int irq, void *p)struct line *line = p;mod_delayed_work (system_wq, &line->work, -usecs_to_jiffies (READ_ONCE (line->desc->debounce_period_us))); +usecs_to_jiffies (READ_ONCE (line->debounce_period_us)));return IRQ_HANDLED ; }
@@ -966,7 +1089,7 @@ static int debounce_setup(struct line *line, unsigned int debounce_period_us)/* try hardware */ ret =gpiod_set_debounce (line->desc, debounce_period_us);if (!ret) { -WRITE_ONCE (line->desc->debounce_period_us, debounce_period_us); +line_set_debounce_period (line, debounce_period_us);return ret; }if (ret != -ENOTSUPP )
@@ -1051,8 +1174,7 @@ static void edge_detector_stop(struct line *line)cancel_delayed_work_sync (&line->work);WRITE_ONCE (line->sw_debounced,0 );WRITE_ONCE (line->edflags,0 ); -if (line->desc) -WRITE_ONCE (line->desc->debounce_period_us,0 ); +line_set_debounce_period (line,0 );/* do not change line->level - see comment in debounced_value() */ }
@@ -1078,7 +1200,7 @@ static int edge_detector_setup(struct line *line, ret =debounce_setup (line, debounce_period_us);if (ret)return ret; -WRITE_ONCE (line->desc->debounce_period_us, debounce_period_us); +line_set_debounce_period (line, debounce_period_us); }/* detection disabled or sw debouncer will provide edge detection */
@@ -1126,12 +1248,12 @@ static int edge_detector_update(struct line *line,gpio_v2_line_config_debounce_period (lc, line_idx);if ((active_edflags == edflags) && - (READ_ONCE (line->desc->debounce_period_us) == debounce_period_us)) + (READ_ONCE (line->debounce_period_us) == debounce_period_us))return 0 ;/* sw debounced and still will be...*/ if (debounce_period_us &&READ_ONCE (line->sw_debounced)) { -WRITE_ONCE (line->desc->debounce_period_us, debounce_period_us); +line_set_debounce_period (line, debounce_period_us);return 0 ; }
@@ -1606,6 +1728,7 @@ static ssize_t linereq_read(struct file *file, char __user *buf,static void linereq_free (struct linereq *lr) { +struct line *line;unsigned int i;if (lr->device_unregistered_nb.notifier_call)
@@ -1613,10 +1736,14 @@ static void linereq_free(struct linereq *lr) &lr->device_unregistered_nb);for (i =0 ; i < lr->num_lines; i++) { -if (lr->lines[i].desc) { -edge_detector_stop (&lr->lines[i]); -gpiod_free (lr->lines[i].desc); - } + line = &lr->lines[i]; +if (!line->desc) +continue ; + +edge_detector_stop (line); +if (line_has_supinfo (line)) +supinfo_erase (line); +gpiod_free (line->desc); }kfifo_free (&lr->events);kfree (lr->label);
@@ -2316,8 +2443,6 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc,struct gpio_chip *gc = desc->gdev->chip;bool ok_for_pinctrl;unsigned long flags; -u32 debounce_period_us; -unsigned int num_attrs =0 ;memset (info,0 ,sizeof (*info)); info->offset =gpio_chip_hwgpio (desc);
@@ -2384,14 +2509,6 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc,else if (test_bit (FLAG_EVENT_CLOCK_HTE , &desc->flags)) info->flags |=GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE ; - debounce_period_us =READ_ONCE (desc->debounce_period_us); -if (debounce_period_us) { - info->attrs[num_attrs].id =GPIO_V2_LINE_ATTR_ID_DEBOUNCE ; - info->attrs[num_attrs].debounce_period_us = debounce_period_us; - num_attrs++; - } - info->num_attrs = num_attrs; -spin_unlock_irqrestore (&gpio_lock, flags); }
@@ -2498,6 +2615,7 @@ static int lineinfo_get(struct gpio_chardev_data *cdev, void __user *ip,return -EBUSY ; }gpio_desc_to_lineinfo (desc, &lineinfo); +supinfo_to_lineinfo (desc, &lineinfo);if (copy_to_user (ip, &lineinfo,sizeof (lineinfo))) {if (watch)
@@ -2596,6 +2714,7 @@ static int lineinfo_changed_notify(struct notifier_block *nb, chg.event_type = action; chg.timestamp_ns =ktime_get_ns ();gpio_desc_to_lineinfo (desc, &chg.info); +supinfo_to_lineinfo (desc, &chg.info); ret =kfifo_in_spinlocked (&cdev->events, &chg,1 , &cdev->wait.lock);if (ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 218/301 gpiolib: cdev: fix uninitialised kfifo
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kent Gibson <[email protected]>
[ Upstream commit ee0166b637a5e376118e9659e5b4148080f1d27e ]
If a line is requested with debounce, and that results in debouncing in software, and the line is subsequently reconfigured to enable edge detection then the allocation of the kfifo to contain edge events is overlooked. This results in events being written to and read from an uninitialised kfifo. Read events are returned to userspace.
Initialise the kfifo in the case where the software debounce is already active.
--- drivers/gpio/gpiolib-cdev.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpio/gpiolib-cdev.c +14 -0
@@ -1243,6 +1243,8 @@ static int edge_detector_update(struct line *line,struct gpio_v2_line_config *lc, unsigned int line_idx, u64 edflags) { + u64 eflags; +int ret;u64 active_edflags =READ_ONCE (line->edflags);unsigned int debounce_period_us =gpio_v2_line_config_debounce_period (lc, line_idx);
@@ -1254,6 +1256,18 @@ static int edge_detector_update(struct line *line,/* sw debounced and still will be...*/ if (debounce_period_us &&READ_ONCE (line->sw_debounced)) {line_set_debounce_period (line, debounce_period_us); +/* +* ensure event fifo is initialised if edge detection +* is now enabled. +*/ + eflags = edflags &GPIO_V2_LINE_EDGE_FLAGS ; +if (eflags && !kfifo_initialized (&line->req->events)) { + ret =kfifo_alloc (&line->req->events, + line->req->event_buffer_size, +GFP_KERNEL ); +if (ret) +return ret; + }return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 219/301 drm/amd/display: Atom Integrated System Info v2_2 for DCN35
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabe Teeger <[email protected]>
[ Upstream commit 9a35d205f466501dcfe5625ca313d944d0ac2d60 ]
New request from KMD/VBIOS in order to support new UMA carveout model. This fixes a null dereference from accessing Ctx->dc_bios->integrated_info while it was NULL.
DAL parses through the BIOS and extracts the necessary integrated_info but was missing a case for the new BIOS version 2.3.
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +1 -0
@@ -2961,6 +2961,7 @@ static enum bp_result construct_integrated_info( result =get_integrated_info_v2_1 (bp, info);break ;case 2 : +case 3 : result =get_integrated_info_v2_2 (bp, info);break ;default :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 220/301 drm/amdgpu: Fix comparison in amdgpu_res_cpu_visible
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
commit 8d2c930735f850e5be6860aeb39b27ac73ca192f upstream.
It incorrectly claimed a resource isn't CPU visible if it's located at the very end of CPU visible VRAM.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -432,7 +432,7 @@ bool amdgpu_res_cpu_visible(struct amdgpamdgpu_res_first (res,0 , res->size, &cursor);while (cursor.remaining) { -if ((cursor.start + cursor.size) >= adev->gmc.visible_vram_size) +if ((cursor.start + cursor.size) > adev->gmc.visible_vram_size)return false;amdgpu_res_next (&cursor, cursor.size); }
Greg Kroah-Hartman
maintainerPATCH 221/301 drm/amdgpu: once more fix the call oder in amdgpu_ttm_move() v2
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
commit d3a9331a6591e9df64791e076f6591f440af51c3 upstream.
This reverts drm/amdgpu: fix ftrace event amdgpu_bo_move always move on same heap. The basic problem here is that after the move the old location is simply not available any more.
Some fixes were suggested, but essentially we should call the move notification before actually moving things because only this way we have the correct order for DMA-buf and VM move notifications as well.
Also rework the statistic handling so that we don't update the eviction counter before the move.
v2: add missing NULL check
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 14 +++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 48 +++++++++++++++-------------- 3 files changed, 38 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +9 -5
@@ -1249,14 +1249,18 @@ int amdgpu_bo_get_metadata(struct amdgpu* amdgpu_bo_move_notify - notification about a memory move * @bo: pointer to a buffer object * @evict: if this move is evicting the buffer from the graphics address space +* @new_mem: new resource for backing the BO * * Marks the corresponding &amdgpu_bo buffer object as invalid, also performs * bookkeeping. * TTM driver callback which is called when ttm moves a buffer. */ -void amdgpu_bo_move_notify (struct ttm_buffer_object *bo,bool evict) +void amdgpu_bo_move_notify (struct ttm_buffer_object *bo, +bool evict, +struct ttm_resource *new_mem) {struct amdgpu_device *adev =amdgpu_ttm_adev (bo->bdev); +struct ttm_resource *old_mem = bo->resource;struct amdgpu_bo *abo;if (!amdgpu_bo_is_amdgpu_bo (bo))
@@ -1268,12 +1272,12 @@ void amdgpu_bo_move_notify(struct ttm_buamdgpu_bo_kunmap (abo);if (abo->tbo.base.dma_buf && !abo->tbo.base.import_attach && - bo->resource->mem_type !=TTM_PL_SYSTEM ) + old_mem && old_mem->mem_type !=TTM_PL_SYSTEM )dma_buf_move_notify (abo->tbo.base.dma_buf); -/* remember the eviction */ -if (evict) -atomic64_inc (&adev->num_evictions); +/* move_notify is called before move happens */ +trace_amdgpu_bo_move (abo, new_mem ? new_mem->mem_type :-1 , + old_mem ? old_mem->mem_type :-1 ); } void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +3 -1
@@ -328,7 +328,9 @@ int amdgpu_bo_set_metadata (struct amdgpint amdgpu_bo_get_metadata (struct amdgpu_bo *bo,void *buffer,size_t buffer_size,uint32_t *metadata_size,uint64_t *flags); -void amdgpu_bo_move_notify (struct ttm_buffer_object *bo,bool evict); +void amdgpu_bo_move_notify (struct ttm_buffer_object *bo, +bool evict, +struct ttm_resource *new_mem);void amdgpu_bo_release_notify (struct ttm_buffer_object *bo);vm_fault_t amdgpu_bo_fault_reserve_notify (struct ttm_buffer_object *bo); void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence,
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +26 -22
97 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 222/301 btrfs: fix kvcalloc() arguments order in btrfs_ioctl_send()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
commit 6ff09b6b8c2fb6b3edda4ffaa173153a40653067 upstream.
When compiling with gcc version 14.0.0 20231220 (experimental) and W=1, I've noticed the following warning:
fs/btrfs/send.c: In function 'btrfs_ioctl_send':fs/btrfs/send.c:8208:44: warning: 'kvcalloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
8208 | sctx->clone_roots = kvcalloc(sizeof(*sctx->clone_roots),
| ^
Since 'n' and 'size' arguments of 'kvcalloc()' are multiplied to calculate the final size, their actual order doesn't affect the result and so this is not a bug. But it's still worth to fix it.
--- fs/btrfs/send.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/send.c +2 -2
@@ -8222,8 +8222,8 @@ long btrfs_ioctl_send(struct inode *inod goto out; } - sctx->clone_roots =kvcalloc (sizeof (*sctx->clone_roots), - arg->clone_sources_count +1 , + sctx->clone_roots =kvcalloc (arg->clone_sources_count +1 , +sizeof (*sctx->clone_roots),GFP_KERNEL );if (!sctx->clone_roots) { ret = -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 223/301 firewire: nosy: ensure user_length is taken into account when fetching packet contents
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thanassis Avgerinos <[email protected]>
commit 38762a0763c10c24a4915feee722d7aa6e73eb98 upstream.
Ensure that packet_buffer_get respects the user_length provided. If the length of the head packet exceeds the user_length, packet_buffer_get will now return 0 to signify to the user that no data were read and a larger buffer size is required. Helps prevent user space overflows.
--- drivers/firewire/nosy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/firewire/nosy.c +4 -2
@@ -148,10 +148,12 @@ packet_buffer_get(struct client *client,if (atomic_read (&buffer->size) ==0 )return -ENODEV ; -/* FIXME: Check length <= user_length. */ + length = buffer->head->length; + +if (length > user_length) +return 0 ; end = buffer->data + buffer->capacity; - length = buffer->head->length;if (&buffer->head->data[length] < end) {if (copy_to_user (data, buffer->head->data, length))
Greg Kroah-Hartman
maintainerPATCH 224/301 Reapply "drm/qxl: simplify qxl_fence_wait"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 3628e0383dd349f02f882e612ab6184e4bb3dc10 upstream.
This reverts commit 07ed11afb68d94eadd4ffc082b97c2331307c5ea.
Stephen Rostedt reports:
"I went to run my tests on my VMs and the tests hung on boot up.
Unfortunately, the most I ever got out was:
[ 93.607888] Testing event system initcall: OK [ 93.667730] Running tests on all trace events: [ 93.669757] Testing all events: OK [ 95.631064] ------------[ cut here ]------------ Timed out after 60 seconds"
and further debugging points to a possible circular locking dependency between the console_owner locking and the worker pool locking.
Reverting the commit allows Steve's VM to boot to completion again.
[ This may obviously result in the "[TTM] Buffer eviction failed"
messages again, which was the reason for that original revert. But at this point this seems preferable to a non-booting system... ]
--- drivers/gpu/drm/qxl/qxl_release.c | 50 +++----------------------------------- include/linux/dma-fence.h | 7 ----- 2 files changed, 5 insertions(+), 52 deletions(-)
drivers/gpu/drm/qxl/qxl_release.c +5 -45
@@ -58,56 +58,16 @@ static long qxl_fence_wait(struct dma_fe signed long timeout) {struct qxl_device *qdev; -struct qxl_release *release; -int count =0 , sc =0 ; -bool have_drawable_releases;unsigned long cur, end = jiffies + timeout; qdev = container_of(fence->lock, struct qxl_device, release_lock); - release = container_of(fence, struct qxl_release, base); - have_drawable_releases = release->type ==QXL_RELEASE_DRAWABLE ; -retry: - sc++; - -if (dma_fence_is_signaled (fence)) - goto signaled; - -qxl_io_notify_oom (qdev); - -for (count =0 ; count <11 ; count++) { -if (!qxl_queue_garbage_collect (qdev, true)) -break ; - -if (dma_fence_is_signaled (fence)) - goto signaled; - } - -if (dma_fence_is_signaled (fence)) - goto signaled; - -if (have_drawable_releases || sc <4 ) { -if (sc >2 ) -/* back off */ -usleep_range (500 ,1000 ); - -if (time_after (jiffies, end)) -return 0 ; - -if (have_drawable_releases && sc >300 ) { -DMA_FENCE_WARN (fence, -"failed to wait on release %llu after spincount %d\n" , - fence->context & ~0xf0000000 , sc); - goto signaled; - } - goto retry; - } -/* -* yeah, original sync_obj_wait gave up after 3 spins when -* have_drawable_releases is not set. -*/ +if (!wait_event_timeout (qdev->release_event, + (dma_fence_is_signaled (fence) || + (qxl_io_notify_oom (qdev),0 )), + timeout)) +return 0 ; -signaled: cur = jiffies;if (time_after (cur, end))return 0 ;
include/linux/dma-fence.h +0 -7
@@ -681,11 +681,4 @@ static inline bool dma_fence_is_containe return dma_fence_is_array(fence) || dma_fence_is_chain(fence); } -#define DMA_FENCE_WARN(f, fmt, args...) \ - do { \ - struct dma_fence *__ff = (f); \ - pr_warn("f %llu#%llu: " fmt, __ff->context, __ff->seqno,\ - ##args); \ - } while (0) -#endif /* __LINUX_DMA_FENCE_H */
Greg Kroah-Hartman
maintainerPATCH 225/301 usb: typec: ucsi: Check for notifications after init
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian A. Ehrhardt <[email protected]>
commit 808a8b9e0b87bbc72bcc1f7ddfe5d04746e7ce56 upstream.
The completion notification for the final SET_NOTIFICATION_ENABLE command during initialization can include a connector change notification. However, at the time this completion notification is processed, the ucsi struct is not ready to handle this notification. As a result the notification is ignored and the controller never sends an interrupt again.
Re-check CCI for a pending connector state change after initialization is complete. Adjust the corresponding debug message accordingly.
--- drivers/usb/typec/ucsi/ucsi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi.c +9 -1
@@ -972,7 +972,7 @@ void ucsi_connector_change(struct ucsi *struct ucsi_connector *con = &ucsi->connector[num -1 ];if (!(ucsi->ntfy &UCSI_ENABLE_NTFY_CONNECTOR_CHANGE )) { -dev_dbg (ucsi->dev,"Bogus connector change event\n" ); +dev_dbg (ucsi->dev,"Early connector change event\n" );return ; }
@@ -1403,6 +1403,7 @@ static int ucsi_init(struct ucsi *ucsi) {struct ucsi_connector *con, *connector;u64 command, ntfy; +u32 cci;int ret;int i;
@@ -1455,6 +1456,13 @@ static int ucsi_init(struct ucsi *ucsi) ucsi->connector = connector; ucsi->ntfy = ntfy; + + ret = ucsi->ops->read (ucsi,UCSI_CCI , &cci,sizeof (cci)); +if (ret) +return ret; +if (UCSI_CCI_CONNECTOR (READ_ONCE (cci))) +ucsi_connector_change (ucsi, cci); +return 0 ; err_unregister:
Greg Kroah-Hartman
maintainerPATCH 226/301 usb: typec: ucsi: Fix connector check on init
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian A. Ehrhardt <[email protected]>
commit ce4c8d21054ae9396cd759fe6e8157b525616dc4 upstream.
Fix issues when initially checking for a connector change:
- Use the correct connector number not the entire CCI.
- Call ->read under the PPM lock.
- Remove a bogus READ_ONCE.
--- drivers/usb/typec/ucsi/ucsi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/typec/ucsi/ucsi.c +4 -2
@@ -1457,11 +1457,13 @@ static int ucsi_init(struct ucsi *ucsi) ucsi->connector = connector; ucsi->ntfy = ntfy; +mutex_lock (&ucsi->ppm_lock); ret = ucsi->ops->read (ucsi,UCSI_CCI , &cci,sizeof (cci)); +mutex_unlock (&ucsi->ppm_lock);if (ret)return ret; -if (UCSI_CCI_CONNECTOR (READ_ONCE (cci))) -ucsi_connector_change (ucsi, cci); +if (UCSI_CCI_CONNECTOR (cci)) +ucsi_connector_change (ucsi,UCSI_CCI_CONNECTOR (cci));return 0 ;
Greg Kroah-Hartman
maintainerPATCH 227/301 usb: Fix regression caused by invalid ep0 maxpacket in virtual SuperSpeed device
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit c78c3644b772e356ca452ae733a3c4de0fb11dc8 upstream.
A virtual SuperSpeed device in the FreeBSD BVCP package
(https://bhyve.npulse.net/) presents an invalid ep0 maxpacket size of 256. It stopped working with Linux following a recent commit because now we check these sizes more carefully than before.
Fix this regression by using the bMaxpacketSize0 value in the device descriptor for SuperSpeed or faster devices, even if it is invalid. This is a very simple-minded change; we might want to check more carefully for values that actually make some sense (for instance, no smaller than 64).
--- drivers/usb/core/hub.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/core/hub.c +3 -2
@@ -5077,9 +5077,10 @@ hub_port_init(struct usb_hub *hub, struc }if (usb_endpoint_maxp (&udev->ep0.desc) == i) { ;/* Initial ep0 maxpacket guess is right */ - }else if ((udev->speed ==USB_SPEED_FULL || + }else if (((udev->speed ==USB_SPEED_FULL || udev->speed ==USB_SPEED_HIGH ) && - (i ==8 || i ==16 || i ==32 || i ==64 )) { + (i ==8 || i ==16 || i ==32 || i ==64 )) || + (udev->speed >=USB_SPEED_SUPER && i >0 )) {/* Initial guess is wrong; use the descriptor's value */ if (udev->speed ==USB_SPEED_FULL )dev_dbg (&udev->dev,"ep0 maxpacket = %d\n" , i);
Greg Kroah-Hartman
maintainerPATCH 228/301 usb: ohci: Prevent missed ohci interrupts
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 fe81f354841641c7f71163b84912b25c169ed8ec upstream.
Testing ohci functionality with qemu's pci-ohci emulation often results in ohci interface stalls, resulting in hung task timeouts.
The problem is caused by lost interrupts between the emulation and the Linux kernel code. Additional interrupts raised while the ohci interrupt handler in Linux is running and before the handler clears the interrupt status are not handled. The fix for a similar problem in ehci suggests that the problem is likely caused by edge-triggered MSI interrupts. See commit 0b60557230ad ("usb: ehci: Prevent missed ehci interrupts with edge-triggered MSI") for details.
Ensure that the ohci interrupt code handles all pending interrupts before returning to solve the problem.
--- drivers/usb/host/ohci-hcd.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/usb/host/ohci-hcd.c +8 -0
@@ -888,6 +888,7 @@ static irqreturn_t ohci_irq (struct usb_/* Check for an all 1's result which is a typical consequence * of dead, unclocked, or unplugged (CardBus...) devices */ +again:if (ints == ~(u32 )0 ) { ohci->rh_state =OHCI_RH_HALTED ;ohci_dbg (ohci,"device removed!\n" );
@@ -982,6 +983,13 @@ static irqreturn_t ohci_irq (struct usb_ }spin_unlock (&ohci->lock); +/* repeat until all enabled interrupts are handled */ +if (ohci->rh_state !=OHCI_RH_HALTED ) { + ints =ohci_readl (ohci, ®s->intrstatus); +if (ints && (ints &ohci_readl (ohci, ®s->intrenable))) + goto again; + } +return IRQ_HANDLED ; }
Greg Kroah-Hartman
maintainerPATCH 229/301 USB: core: Fix access violation during port device removal
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit a4b46d450c49f32e9d4247b421e58083fde304ce upstream.
Testing with KASAN and syzkaller revealed a bug in port.c:disable_store():usb_hub_to_struct_hub() can return NULL if the hub that the port belongs to is concurrently removed, but the function does not check for this possibility before dereferencing the returned value.
It turns out that the first dereference is unnecessary, since hub->intfdev is the parent of the port device, so it can be changed easily. Adding a check for hub == NULL prevents further problems.
The same bug exists in the disable_show() routine, and it can be fixed the same way.
--- drivers/usb/core/port.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/core/port.c +6 -2
@@ -50,13 +50,15 @@ static ssize_t disable_show(struct devicstruct usb_port *port_dev =to_usb_port (dev);struct usb_device *hdev =to_usb_device (dev->parent->parent);struct usb_hub *hub =usb_hub_to_struct_hub (hdev); -struct usb_interface *intf =to_usb_interface (hub->intfdev); +struct usb_interface *intf =to_usb_interface (dev->parent);int port1 = port_dev->portnum;u16 portstatus, unused;bool disabled;int rc;struct kernfs_node *kn; +if (!hub) +return -ENODEV ;hub_get (hub); rc =usb_autopm_get_interface (intf);if (rc <0 )
@@ -100,12 +102,14 @@ static ssize_t disable_store(struct devistruct usb_port *port_dev =to_usb_port (dev);struct usb_device *hdev =to_usb_device (dev->parent->parent);struct usb_hub *hub =usb_hub_to_struct_hub (hdev); -struct usb_interface *intf =to_usb_interface (hub->intfdev); +struct usb_interface *intf =to_usb_interface (dev->parent);int port1 = port_dev->portnum;bool disabled;int rc;struct kernfs_node *kn; +if (!hub) +return -ENODEV ; rc =kstrtobool (buf, &disabled);if (rc)return rc;
Greg Kroah-Hartman
maintainerPATCH 230/301 usb: gadget: composite: fix OS descriptors w_value logic
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Korsgaard <[email protected]>
commit ec6ce7075ef879b91a8710829016005dc8170f17 upstream.
The OS descriptors logic had the high/low byte of w_value inverted, causing the extended properties to not be accessible for interface != 0.
Quoted 1 line
From the Microsoft documentation:
OS_Desc_CompatID.doc (w_index = 0x4):
- wValue:
High Byte = InterfaceNumber. InterfaceNumber is set to the number of the interface or function that is associated with the descriptor, typically 0x00. Because a device can have only one extended compat ID descriptor, it should ignore InterfaceNumber, regardless of the value, and simply return the descriptor.
Low Byte = 0. PageNumber is used to retrieve descriptors that are larger than 64 KB. The header section is 16 bytes, so PageNumber is set to 0 for this request.
We currently do not support >64KB compat ID descriptors, so verify that the low byte is 0.
OS_Desc_Ext_Prop.doc (w_index = 0x5):
- wValue:
High byte = InterfaceNumber. The high byte of wValue is set to the number of the interface or function that is associated with the descriptor.
Low byte = PageNumber. The low byte of wValue is used to retrieve descriptors that are larger than 64 KB. The header section is 10 bytes, so PageNumber is set to 0 for this request.
We also don't support >64KB extended properties, so verify that the low byte is 0 and use the high byte for the interface number.
--- drivers/usb/gadget/composite.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/gadget/composite.c +3 -3
@@ -2112,7 +2112,7 @@ unknown: buf[5 ] =0x01 ;switch (ctrl->bRequestType &USB_RECIP_MASK ) {case USB_RECIP_DEVICE : -if (w_index !=0x4 || (w_value >>8 )) +if (w_index !=0x4 || (w_value &0xff ))break ; buf[6 ] = w_index;/* Number of ext compat interfaces */
@@ -2128,9 +2128,9 @@ unknown: }break ;case USB_RECIP_INTERFACE : -if (w_index !=0x5 || (w_value >>8 )) +if (w_index !=0x5 || (w_value &0xff ))break ; - interface = w_value &0xFF ; + interface = w_value >>8 ;if (interface >=MAX_CONFIG_INTERFACES || !os_desc_cfg->interface[interface])break ;
Greg Kroah-Hartman
maintainerPATCH 231/301 usb: gadget: uvc: use correct buffer size when parsing configfs lists
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Avdeev <[email protected]>
commit 650ae71c80749fc7cb8858c8049f532eaec64410 upstream.
This commit fixes uvc gadget support on 32-bit platforms.
Commit 0df28607c5cb ("usb: gadget: uvc: Generalise helper functions for reuse") introduced a helper function __uvcg_iter_item_entries() to aid with parsing lists of items on configfs attributes stores. This function is a generalization of another very similar function, which used a stack-allocated temporary buffer of fixed size for each item in the list and used the sizeof() operator to check for potential buffer overruns. The new function was changed to allocate the now variably sized temp buffer on heap, but wasn't properly updated to also check for max buffer size using the computed size instead of sizeof() operator.
As a result, the maximum item size was 7 (plus null terminator) on 64-bit platforms, and 3 on 32-bit ones. While 7 is accidentally just barely enough, 3 is definitely too small for some of UVC configfs attributes. For example, dwFrameInteval, specified in 100ns units, usually has 6-digit item values, e.g. 166666 for 60fps.
--- drivers/usb/gadget/function/uvc_configfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/uvc_configfs.c +2 -2
@@ -92,10 +92,10 @@ static int __uvcg_iter_item_entries(conswhile (pg - page < len) { i =0 ; -while (i <sizeof (buf) && (pg - page < len) && +while (i < bufsize && (pg - page < len) && *pg !='\0' && *pg !='\n' ) buf[i++] = *pg++; -if (i ==sizeof (buf)) { +if (i == bufsize) { ret = -EINVAL ; goto out_free_buf; }
Greg Kroah-Hartman
maintainerPATCH 232/301 usb: gadget: f_fs: Fix race between aio_cancel() and AIO request complete
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wesley Cheng <[email protected]>
commit 24729b307eefcd7c476065cd7351c1a018082c19 upstream.
FFS based applications can utilize the aio_cancel() callback to dequeue pending USB requests submitted to the UDC. There is a scenario where the FFS application issues an AIO cancel call, while the UDC is handling a soft disconnect. For a DWC3 based implementation, the callstack looks like the following:
DWC3 Gadget FFS Applicationdwc3_gadget_soft_disconnect() ...
--> dwc3_stop_active_transfers()
--> dwc3_gadget_giveback(-ESHUTDOWN)
--> ffs_epfile_async_io_complete() ffs_aio_cancel()
--> usb_ep_free_request() --> usb_ep_dequeue()There is currently no locking implemented between the AIO completion handler and AIO cancel, so the issue occurs if the completion routine is running in parallel to an AIO cancel call coming from the FFS application. As the completion call frees the USB request (io_data->req) the FFS application is also referencing it for the usb_ep_dequeue() call. This can lead to accessing a stale/hanging pointer.
commit b566d38857fc ("usb: gadget: f_fs: use io_data->status consistently") relocated the usb_ep_free_request() into ffs_epfile_async_io_complete(). However, in order to properly implement locking to mitigate this issue, the spinlock can't be added to ffs_epfile_async_io_complete(), as usb_ep_dequeue() (if successfully dequeuing a USB request) will call the function driver's completion handler in the same context. Hence, leading into a deadlock.
Fix this issue by moving the usb_ep_free_request() back to ffs_user_copy_worker(), and ensuring that it explicitly sets io_data->req to NULL after freeing it within the ffs->eps_lock. This resolves the race condition above, as the ffs_aio_cancel() routine will not continue attempting to dequeue a request that has already been freed, or the ffs_user_copy_work() not freeing the USB request until the AIO cancel is done referencing it.
This fix depends on
commit b566d38857fc ("usb: gadget: f_fs: use io_data->status consistently")
--- drivers/usb/gadget/function/f_fs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_fs.c +6 -1
@@ -821,6 +821,7 @@ static void ffs_user_copy_worker(struct work);int ret = io_data->status;bool kiocb_has_eventfd = io_data->kiocb->ki_flags &IOCB_EVENTFD ; +unsigned long flags;if (io_data->read && ret >0 ) {kthread_use_mm (io_data->mm);
@@ -833,6 +834,11 @@ static void ffs_user_copy_worker(structif (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd)eventfd_signal (io_data->ffs->ffs_eventfd,1 ); +spin_lock_irqsave (&io_data->ffs->eps_lock, flags); +usb_ep_free_request (io_data->ep, io_data->req); + io_data->req =NULL ; +spin_unlock_irqrestore (&io_data->ffs->eps_lock, flags); +if (io_data->read)kfree (io_data->to_free);ffs_free_buffer (io_data);
@@ -846,7 +852,6 @@ static void ffs_epfile_async_io_completestruct ffs_data *ffs = io_data->ffs; io_data->status = req->status ? req->status : req->actual; -usb_ep_free_request (_ep, req);INIT_WORK (&io_data->work, ffs_user_copy_worker);queue_work (ffs->io_completion_wq, &io_data->work);
Greg Kroah-Hartman
maintainerPATCH 233/301 usb: gadget: f_fs: Fix a race condition when processing setup packets.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wulff <[email protected]>
commit 0aea736ddb877b93f6d2dd8cf439840d6b4970a9 upstream.
If the USB driver passes a pointer into the TRB buffer for creq, this buffer can be overwritten with the status response as soon as the event is queued. This can make the final check return USB_GADGET_DELAYED_STATUS when it shouldn't. Instead use the stored wLength.
--- drivers/usb/gadget/function/f_fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/function/f_fs.c +1 -1
@@ -3336,7 +3336,7 @@ static int ffs_func_setup(struct usb_fun__ffs_event_add (ffs,FUNCTIONFS_SETUP );spin_unlock_irqrestore (&ffs->ev.waitq.lock, flags); -return creq->wLength ==0 ?USB_GADGET_DELAYED_STATUS :0 ; +return ffs->ev.setup.wLength ==0 ?USB_GADGET_DELAYED_STATUS :0 ; } static bool ffs_func_req_match(struct usb_function *f,
Greg Kroah-Hartman
maintainerPATCH 234/301 usb: xhci-plat: Dont include xhci.h
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 4a237d55446ff67655dc3eed2d4a41997536fc4c upstream.
The xhci_plat.h should not need to include the entire xhci.h header. This can cause redefinition in dwc3 if it selectively includes some xHCI definitions. This is a prerequisite change for a fix to disable suspend during initialization for dwc3.
--- drivers/usb/host/xhci-plat.h | 4 +++- drivers/usb/host/xhci-rzv2m.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-plat.h +3 -1
@@ -8,7 +8,9 @@ #ifndef _XHCI_PLAT_H #define _XHCI_PLAT_H -#include "xhci.h" /* for hcd_to_xhci() */ +struct device; +struct platform_device; +struct usb_hcd; struct xhci_plat_priv { const char *firmware_name;
drivers/usb/host/xhci-rzv2m.c +1 -0
@@ -6,6 +6,7 @@*/ #include <linux/usb/rzv2m_usb3drd.h> +#include "xhci.h" #include "xhci-plat.h" #include "xhci-rzv2m.h"
Greg Kroah-Hartman
maintainerPATCH 235/301 usb: dwc3: core: Prevent phy suspend during init
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 6d735722063a945de56472bdc6bfcb170fd43b86 upstream.
GUSB3PIPECTL.SUSPENDENABLE and GUSB2PHYCFG.SUSPHY should be cleared during initialization. Suspend during initialization can result in undefined behavior due to clock synchronization failure, which often seen as core soft reset timeout.
The programming guide recommended these bits to be cleared during initialization for DWC_usb3.0 version 1.94 and above (along with DWC_usb31 and DWC_usb32). The current check in the driver does not account if it's set by default setting from coreConsultant.
This is especially the case for DRD when switching mode to ensure the phy clocks are available to change mode. Depending on the platforms/design, some may be affected more than others. This is noted in the DWC_usb3x programming guide under the above registers.
Let's just disable them during driver load and mode switching. Restore them when the controller initialization completes.
Note that some platforms workaround this issue by disabling phy suspend through "snps,dis_u3_susphy_quirk" and "snps,dis_u2_susphy_quirk" when they should not need to.
--- drivers/usb/dwc3/core.c | 90 +++++++++++++++++++--------------------------- drivers/usb/dwc3/core.h | 1 drivers/usb/dwc3/gadget.c | 2 + drivers/usb/dwc3/host.c | 27 +++++++++++++ 4 files changed, 68 insertions(+), 52 deletions(-)
drivers/usb/dwc3/core.c +38 -52
@@ -104,6 +104,27 @@ static int dwc3_get_dr_mode(struct dwc3return 0 ; } +void dwc3_enable_susphy (struct dwc3 *dwc,bool enable) +{ +u32 reg; + + reg =dwc3_readl (dwc->regs,DWC3_GUSB3PIPECTL (0 )); +if (enable && !dwc->dis_u3_susphy_quirk) + reg |=DWC3_GUSB3PIPECTL_SUSPHY ; +else + reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ; + +dwc3_writel (dwc->regs,DWC3_GUSB3PIPECTL (0 ), reg); + + reg =dwc3_readl (dwc->regs,DWC3_GUSB2PHYCFG (0 )); +if (enable && !dwc->dis_u2_susphy_quirk) + reg |=DWC3_GUSB2PHYCFG_SUSPHY ; +else + reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ; + +dwc3_writel (dwc->regs,DWC3_GUSB2PHYCFG (0 ), reg); +} +void dwc3_set_prtcap (struct dwc3 *dwc,u32 mode) {u32 reg;
@@ -585,11 +606,8 @@ static int dwc3_core_ulpi_init(struct dw*/ static int dwc3_phy_setup (struct dwc3 *dwc) { -unsigned int hw_mode;u32 reg; - hw_mode =DWC3_GHWPARAMS0_MODE (dwc->hwparams.hwparams0); - reg =dwc3_readl (dwc->regs,DWC3_GUSB3PIPECTL (0 ));/*
@@ -599,21 +617,16 @@ static int dwc3_phy_setup(struct dwc3 *d reg &= ~DWC3_GUSB3PIPECTL_UX_EXIT_PX ;/* -* Above 1.94a, it is recommended to set DWC3_GUSB3PIPECTL_SUSPHY -* to '0' during coreConsultant configuration. So default value -* will be '0' when the core is reset. Application needs to set it -* to '1' after the core initialization is completed. -*/ - if (!DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) - reg |=DWC3_GUSB3PIPECTL_SUSPHY ; - -/* -* For DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be cleared after -* power-on reset, and it can be set after core initialization, which is -* after device soft-reset during initialization. +* Above DWC_usb3.0 1.94a, it is recommended to set +* DWC3_GUSB3PIPECTL_SUSPHY to '0' during coreConsultant configuration. +* So default value will be '0' when the core is reset. Application +* needs to set it to '1' after the core initialization is completed. +* +* Similarly for DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be +* cleared after power-on reset, and it can be set after core +* initialization. */ -if (hw_mode ==DWC3_GHWPARAMS0_MODE_DRD ) - reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ; + reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;if (dwc->u2ss_inp3_quirk) reg |=DWC3_GUSB3PIPECTL_U2SSINP3OK ;
@@ -639,9 +652,6 @@ static int dwc3_phy_setup(struct dwc3 *dif (dwc->tx_de_emphasis_quirk) reg |=DWC3_GUSB3PIPECTL_TX_DEEPH (dwc->tx_de_emphasis); -if (dwc->dis_u3_susphy_quirk) - reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ; -if (dwc->dis_del_phy_power_chg_quirk) reg &= ~DWC3_GUSB3PIPECTL_DEPOCHANGE ;
@@ -689,24 +699,15 @@ static int dwc3_phy_setup(struct dwc3 *d }/* -* Above 1.94a, it is recommended to set DWC3_GUSB2PHYCFG_SUSPHY to -* '0' during coreConsultant configuration. So default value will -* be '0' when the core is reset. Application needs to set it to -* '1' after the core initialization is completed. -*/ - if (!DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) - reg |=DWC3_GUSB2PHYCFG_SUSPHY ; - -/* -* For DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared after -* power-on reset, and it can be set after core initialization, which is -* after device soft-reset during initialization. +* Above DWC_usb3.0 1.94a, it is recommended to set +* DWC3_GUSB2PHYCFG_SUSPHY to '0' during coreConsultant configuration. +* So default value will be '0' when the core is reset. Application +* needs to set it to '1' after the core initialization is completed. +* +* Similarly for DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared +* after power-on reset, and it can be set after core initialization. */ -if (hw_mode ==DWC3_GHWPARAMS0_MODE_DRD ) - reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ; - -if (dwc->dis_u2_susphy_quirk) - reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ; + reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;if (dwc->dis_enblslpm_quirk) reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM ;
@@ -1213,21 +1214,6 @@ static int dwc3_core_init(struct dwc3 *dif (ret) goto err_exit_phy; -if (hw_mode ==DWC3_GHWPARAMS0_MODE_DRD && - !DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) { -if (!dwc->dis_u3_susphy_quirk) { - reg =dwc3_readl (dwc->regs,DWC3_GUSB3PIPECTL (0 )); - reg |=DWC3_GUSB3PIPECTL_SUSPHY ; -dwc3_writel (dwc->regs,DWC3_GUSB3PIPECTL (0 ), reg); - } - -if (!dwc->dis_u2_susphy_quirk) { - reg =dwc3_readl (dwc->regs,DWC3_GUSB2PHYCFG (0 )); - reg |=DWC3_GUSB2PHYCFG_SUSPHY ; -dwc3_writel (dwc->regs,DWC3_GUSB2PHYCFG (0 ), reg); - } - } -dwc3_core_setup_global_control (dwc);dwc3_core_num_eps (dwc);
drivers/usb/dwc3/core.h +1 -0
@@ -1567,6 +1567,7 @@ int dwc3_event_buffers_setup(struct dwc3void dwc3_event_buffers_cleanup (struct dwc3 *dwc);int dwc3_core_soft_reset (struct dwc3 *dwc); +void dwc3_enable_susphy (struct dwc3 *dwc,bool enable);#if IS_ENABLED (CONFIG_USB_DWC3_HOST ) ||IS_ENABLED (CONFIG_USB_DWC3_DUAL_ROLE )int dwc3_host_init (struct dwc3 *dwc);
drivers/usb/dwc3/gadget.c +2 -0
@@ -2937,6 +2937,7 @@ static int __dwc3_gadget_start(struct dwdwc3_ep0_out_start (dwc);dwc3_gadget_enable_irq (dwc); +dwc3_enable_susphy (dwc, true);return 0 ;
@@ -4703,6 +4704,7 @@ void dwc3_gadget_exit(struct dwc3 *dwc)if (!dwc->gadget)return ; +dwc3_enable_susphy (dwc, false);usb_del_gadget (dwc->gadget);dwc3_gadget_free_endpoints (dwc);usb_put_gadget (dwc->gadget);
drivers/usb/dwc3/host.c +27 -0
@@ -10,9 +10,30 @@#include <linux/irq.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/usb.h> +#include <linux/usb/hcd.h> +#include "../host/xhci-plat.h" #include "core.h" +static void dwc3_xhci_plat_start (struct usb_hcd *hcd) +{ +struct platform_device *pdev; +struct dwc3 *dwc; + +if (!usb_hcd_is_primary_hcd (hcd)) +return ; + + pdev =to_platform_device (hcd->self.controller); + dwc =dev_get_drvdata (pdev->dev.parent); + +dwc3_enable_susphy (dwc, true); +} + +static const struct xhci_plat_priv dwc3_xhci_plat_quirk = { + .plat_start = dwc3_xhci_plat_start, +}; +static void dwc3_host_fill_xhci_irq_res (struct dwc3 *dwc,int irq,char *name) {
@@ -117,6 +138,11 @@ int dwc3_host_init(struct dwc3 *dwc) } } + ret =platform_device_add_data (xhci, &dwc3_xhci_plat_quirk, +sizeof (struct xhci_plat_priv )); +if (ret) + goto err; + ret =platform_device_add (xhci);if (ret) {dev_err (dwc->dev,"failed to register xHCI device\n" );
@@ -142,6 +168,7 @@ void dwc3_host_exit(struct dwc3 *dwc)if (dwc->sys_wakeup)device_init_wakeup (&dwc->xhci->dev, false); +dwc3_enable_susphy (dwc, false);platform_device_unregister (dwc->xhci); dwc->xhci =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 236/301 usb: typec: tcpm: clear pd_event queue in PORT_RESET
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: RD Babiera <[email protected]>
commit bf20c69cf3cf9c6445c4925dd9a8a6ca1b78bfdf upstream.
When a Fast Role Swap control message attempt results in a transition to ERROR_RECOVERY, the TCPC can still queue a TCPM_SOURCING_VBUS event.
If the event is queued but processed after the tcpm_reset_port() call in the PORT_RESET state, then the following occurs:
1. tcpm_reset_port() calls tcpm_init_vbus() to reset the vbus sourcing and sinking state
2. tcpm_pd_event_handler() turns VBUS on before the port is in the default state.
3. The port resolves as a sink. In the SNK_DISCOVERY state, tcpm_set_charge() cannot set vbus to charge.
Clear pd events within PORT_RESET to get rid of non-applicable events.
--- drivers/usb/typec/tcpm/tcpm.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/typec/tcpm/tcpm.c +1 -0
@@ -4859,6 +4859,7 @@ static void run_state_machine(struct tcpbreak ;case PORT_RESET :tcpm_reset_port (port); + port->pd_events =0 ;if (port->self_powered)tcpm_set_cc (port,TYPEC_CC_OPEN );else
Greg Kroah-Hartman
maintainerPATCH 237/301 usb: typec: tcpm: unregister existing source caps before re-registration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amit Sunil Dhamne <[email protected]>
commit 230ecdf71a644c9c73e0e6735b33173074ae3f94 upstream.
Check and unregister existing source caps in tcpm_register_source_caps function before registering new ones. This change fixes following warning when port partner resends source caps after negotiating PD contract for the purpose of re-negotiation.
[ 343.135030][ T151] sysfs: cannot create duplicate filename '/devices/virtual/usb_power_delivery/pd1/source-capabilities' [ 343.135071][ T151] Call trace: [ 343.135076][ T151] dump_backtrace+0xe8/0x108 [ 343.135099][ T151] show_stack+0x18/0x24 [ 343.135106][ T151] dump_stack_lvl+0x50/0x6c [ 343.135119][ T151] dump_stack+0x18/0x24 [ 343.135126][ T151] sysfs_create_dir_ns+0xe0/0x140 [ 343.135137][ T151] kobject_add_internal+0x228/0x424 [ 343.135146][ T151] kobject_add+0x94/0x10c [ 343.135152][ T151] device_add+0x1b0/0x4c0 [ 343.135187][ T151] device_register+0x20/0x34 [ 343.135195][ T151] usb_power_delivery_register_capabilities+0x90/0x20c [ 343.135209][ T151] tcpm_pd_rx_handler+0x9f0/0x15b8 [ 343.135216][ T151] kthread_worker_fn+0x11c/0x260 [ 343.135227][ T151] kthread+0x114/0x1bc [ 343.135235][ T151] ret_from_fork+0x10/0x20 [ 343.135265][ T151] kobject: kobject_add_internal failed for source-capabilities with -EEXIST, don't try to register things with the same name in the same directory.
--- drivers/usb/typec/tcpm/tcpm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +4 -1
@@ -2422,7 +2422,7 @@ static int tcpm_register_sink_caps(struc {struct usb_power_delivery_desc desc = { port->negotiated_rev };struct usb_power_delivery_capabilities_desc caps = { }; -struct usb_power_delivery_capabilities *cap; +struct usb_power_delivery_capabilities *cap = port->partner_source_caps;if (!port->partner_pd) port->partner_pd =usb_power_delivery_register (NULL , &desc);
@@ -2432,6 +2432,9 @@ static int tcpm_register_sink_caps(strucmemcpy (caps.pdo, port->sink_caps,sizeof (u32) * port->nr_sink_caps); caps.role =TYPEC_SINK ; +if (cap) +usb_power_delivery_unregister_capabilities (cap); + cap =usb_power_delivery_register_capabilities (port->partner_pd, &caps);if (IS_ERR (cap))return PTR_ERR (cap);
Greg Kroah-Hartman
maintainerPATCH 238/301 usb: typec: tcpm: Check for port partner validity before consuming it
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Badhri Jagan Sridharan <[email protected]>
commit ae11f04b452b5205536e1c02d31f8045eba249dd upstream.
typec_register_partner() does not guarantee partner registration to always succeed. In the event of failure, port->partner is set to the error value or NULL. Given that port->partner validity is not checked, this results in the following crash:
Unable to handle kernel NULL pointer dereference at virtual address xx pc : run_state_machine+0x1bc8/0x1c08 lr : run_state_machine+0x1b90/0x1c08 .. Call trace: run_state_machine+0x1bc8/0x1c08 tcpm_state_machine_work+0x94/0xe4 kthread_worker_fn+0x118/0x328 kthread+0x1d0/0x23c ret_from_fork+0x10/0x20
To prevent the crash, check for port->partner validity before derefencing it in all the call sites.
--- drivers/usb/typec/tcpm/tcpm.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +23 -7
@@ -1488,7 +1488,8 @@ static void svdm_consume_identity(struct port->partner_ident.cert_stat = p[VDO_INDEX_CSTAT ]; port->partner_ident.product = product; -typec_partner_set_identity (port->partner); +if (port->partner) +typec_partner_set_identity (port->partner); tcpm_log(port, "Identity: %04x:%04x.%04x", PD_IDH_VID(vdo),
@@ -1576,6 +1577,9 @@ static void tcpm_register_partner_altmodstruct typec_altmode *altmode;int i; +if (!port->partner) +return ; +for (i =0 ; i < modep->altmodes; i++) { altmode =typec_partner_register_altmode (port->partner, &modep->altmode_desc[i]);
@@ -3574,7 +3578,10 @@ static int tcpm_init_vconn(struct tcpm_pstatic void tcpm_typec_connect (struct tcpm_port *port) { +struct typec_partner *partner; +if (!port->connected) { + port->connected = true;/* Make sure we don't report stale identity information */ memset (&port->partner_ident,0 ,sizeof (port->partner_ident)); port->partner_desc.usb_pd = port->pd_capable;
@@ -3584,9 +3591,13 @@ static void tcpm_typec_connect(struct tc port->partner_desc.accessory =TYPEC_ACCESSORY_AUDIO ; else port->partner_desc.accessory = TYPEC_ACCESSORY_NONE; - port->partner =typec_register_partner (port->typec_port, - &port->partner_desc); - port->connected = true; + partner =typec_register_partner (port->typec_port, &port->partner_desc); +if (IS_ERR (partner)) { +dev_err (port->dev,"Failed to register partner (%ld)\n" ,PTR_ERR (partner)); +return ; + } + + port->partner = partner;typec_partner_set_usb_power_delivery (port->partner, port->partner_pd); } }
@@ -3656,9 +3667,11 @@ out_disable_mux:static void tcpm_typec_disconnect (struct tcpm_port *port) {if (port->connected) { -typec_partner_set_usb_power_delivery (port->partner,NULL ); -typec_unregister_partner (port->partner); - port->partner =NULL ; +if (port->partner) { +typec_partner_set_usb_power_delivery (port->partner,NULL ); +typec_unregister_partner (port->partner); + port->partner =NULL ; + } port->connected = false; } }
@@ -3874,6 +3887,9 @@ static enum typec_cc_status tcpm_pwr_opmstatic void tcpm_set_initial_svdm_version (struct tcpm_port *port) { +if (!port->partner) +return ; +switch (port->negotiated_rev) {case PD_REV30 :break ;
Greg Kroah-Hartman
maintainerPATCH 239/301 ALSA: hda/realtek: Fix mute led of HP Laptop 15-da3001TU
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aman Dhoot <[email protected]>
commit 2d5af3ab9e6f1cf1468b2a5221b5c1f7f46c3333 upstream.
This patch simply add SND_PCI_QUIRK for HP Laptop 15-da3001TU to fixed mute led of laptop.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9826,6 +9826,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x103c ,0x860f ,"HP ZBook 15 G6" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x861f ,"HP Elite Dragonfly G1" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x869d ,"HP" ,ALC236_FIXUP_HP_MUTE_LED ), +SND_PCI_QUIRK (0x103c ,0x86c1 ,"HP Laptop 15-da3001TU" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x86c7 ,"HP Envy AiO 32" ,ALC274_FIXUP_HP_ENVY_GPIO ),SND_PCI_QUIRK (0x103c ,0x86e7 ,"HP Spectre x360 15-eb0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_EB1 ), SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
Greg Kroah-Hartman
maintainerPATCH 240/301 firewire: ohci: fulfill timestamp for some local asynchronous transaction
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit 09773bf55aeabe3fd61745d900798dc1272c778a upstream.
1394 OHCI driver generates packet data for the response subaction to the request subaction to some local registers. In the case, the driver should assign timestamp to them by itself.
This commit fulfills the timestamp for the subaction.
--- drivers/firewire/ohci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/firewire/ohci.c +6 -2
@@ -1556,6 +1556,8 @@ static int handle_at_packet(struct conte#define HEADER_GET_DATA_LENGTH (q) (((q) >> 16) & 0xffff)#define HEADER_GET_EXTENDED_TCODE (q) (((q) >> 0) & 0xffff) +static u32 get_cycle_time (struct fw_ohci *ohci); +static void handle_local_rom (struct fw_ohci *ohci,struct fw_packet *packet,u32 csr) {
@@ -1580,6 +1582,8 @@ static void handle_local_rom(struct fw_o (void *) ohci->config_rom + i, length); } +// Timestamping on behalf of the hardware. + response.timestamp =cycle_time_to_ohci_tstamp (get_cycle_time (ohci));fw_core_handle_response (&ohci->card, &response); }
@@ -1628,6 +1632,8 @@ static void handle_local_lock(struct fw_fw_fill_response (&response, packet->header,RCODE_BUSY ,NULL ,0 ); out: +// Timestamping on behalf of the hardware. + response.timestamp =cycle_time_to_ohci_tstamp (get_cycle_time (ohci));fw_core_handle_response (&ohci->card, &response); }
@@ -1670,8 +1676,6 @@ static void handle_local_request(struct } } -static u32 get_cycle_time (struct fw_ohci *ohci); -static void at_context_transmit (struct context *ctx,struct fw_packet *packet) {unsigned long flags;
Greg Kroah-Hartman
maintainerPATCH 241/301 btrfs: add missing mutex_unlock in btrfs_relocate_sys_chunks()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominique Martinet <[email protected]>
commit 9af503d91298c3f2945e73703f0e00995be08c30 upstream.
The previous patch that replaced BUG_ON by error handling forgot to unlock the mutex in the error path.
--- fs/btrfs/volumes.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/volumes.c +1 -0
@@ -3368,6 +3368,7 @@ again:* alignment and size). */ ret = -EUCLEAN ; +mutex_unlock (&fs_info->reclaim_bgs_lock); goto error; }
Greg Kroah-Hartman
maintainerPATCH 242/301 btrfs: set correct ram_bytes when splitting ordered extent
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 63a6ce5a1a6261e4c70bad2b55c4e0de8da4762e upstream.
[BUG]
When running generic/287, the following file extent items can be generated:
item 16 key (258 EXTENT_DATA 2682880) itemoff 15305 itemsize 53
generation 9 type 1 (regular)
extent data disk byte 1378414592 nr 462848
extent data offset 0 nr 462848 ram 2097152
extent compression 0 (none)Note that file extent item is not a compressed one, but its ram_bytes is way larger than its disk_num_bytes.
According to btrfs on-disk scheme, ram_bytes should match disk_num_bytes if it's not a compressed one.
[CAUSE]
Since commit b73a6fd1b1ef ("btrfs: split partial dio bios before submit"), for partial dio writes, we would split the ordered extent.
However the function btrfs_split_ordered_extent() doesn't update the ram_bytes even it has already shrunk the disk_num_bytes.
Originally the function btrfs_split_ordered_extent() is only introduced for zoned devices in commit d22002fd37bd ("btrfs: zoned: split ordered extent when bio is sent"), but later commit b73a6fd1b1ef ("btrfs: split partial dio bios before submit") makes non-zoned btrfs affected.
Thankfully for un-compressed file extent, we do not really utilize the ram_bytes member, thus it won't cause any real problem.
[FIX]
Also update btrfs_ordered_extent::ram_bytes inside btrfs_split_ordered_extent().
--- fs/btrfs/ordered-data.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/ordered-data.c +1 -0
@@ -1202,6 +1202,7 @@ struct btrfs_ordered_extent *btrfs_split ordered->disk_bytenr += len; ordered->num_bytes -= len; ordered->disk_num_bytes -= len; + ordered->ram_bytes -= len;if (test_bit (BTRFS_ORDERED_IO_DONE , &ordered->flags)) {ASSERT (ordered->bytes_left ==0 );
Greg Kroah-Hartman
maintainerPATCH 243/301 maple_tree: fix mas_empty_area_rev() null pointer dereference
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liam R. Howlett <[email protected]>
commit 955a923d2809803980ff574270f81510112be9cf upstream.
Currently the code calls mas_start() followed by mas_data_end() if the maple state is MA_START, but mas_start() may return with the maple state node == NULL. This will lead to a null pointer dereference when checking information in the NULL node, which is done in mas_data_end().
Avoid setting the offset if there is no node by waiting until after the maple state is checked for an empty or single entry state.
A user could trigger the events to cause a kernel oops by unmapping all vmas to produce an empty maple tree, then mapping a vma that would cause the scenario described above.
--- lib/maple_tree.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
lib/maple_tree.c +8 -8
@@ -5085,18 +5085,18 @@ int mas_empty_area_rev(struct ma_state *if (size ==0 || max - min < size -1 )return -EINVAL ; -if (mas_is_start (mas)) { +if (mas_is_start (mas))mas_start (mas); - mas->offset =mas_data_end (mas); - }else if (mas->offset >=2 ) { - mas->offset -=2 ; - }else if (!mas_rewind_node (mas)) { +else if ((mas->offset <2 ) && (!mas_rewind_node (mas)))return -EBUSY ; - } -/* Empty set. */ -if (mas_is_none (mas) ||mas_is_ptr (mas)) +if (unlikely (mas_is_none (mas) ||mas_is_ptr (mas)))return mas_sparse_area (mas, min, max, size, false); +else if (mas->offset >=2 ) + mas->offset -=2 ; +else + mas->offset =mas_data_end (mas); +/* The start of the window can only be within these values. */ mas->index = min;
Greg Kroah-Hartman
maintainerPATCH 244/301 mm/slab: make __free(kfree) accept error pointers
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 cd7eb8f83fcf258f71e293f7fc52a70be8ed0128 upstream.
Currently, if an automatically freed allocation is an error pointer that will lead to a crash. An example of this is in wm831x_gpio_dbg_show().
171 char *label __free(kfree) = gpiochip_dup_line_label(chip, i);
172 if (IS_ERR(label)) {
173 dev_err(wm831x->dev, "Failed to duplicate label\n");
174 continue;
175 }The auto clean up function should check for error pointers as well, otherwise we're going to keep hitting issues like this.
--- include/linux/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/slab.h +1 -1
@@ -228,7 +228,7 @@ void kfree(const void *objp);void kfree_sensitive (const void *objp);size_t __ksize (const void *objp); -DEFINE_FREE(kfree, void *, if (_T) kfree(_T)) +DEFINE_FREE(kfree, void *, if (!IS_ERR_OR_NULL(_T)) kfree(_T))/** * ksize - Report actual allocation size of associated object
Greg Kroah-Hartman
maintainerPATCH 245/301 mptcp: ensure snd_nxt is properly initialized on connect
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 fb7a0d334894206ae35f023a82cad5a290fd7386 upstream.
Christoph reported a splat hinting at a corrupted snd_una:
WARNING: CPU: 1 PID: 38 at net/mptcp/protocol.c:1005 __mptcp_clean_una+0x4b3/0x620 net/mptcp/protocol.c:1005 Modules linked in: CPU: 1 PID: 38 Comm: kworker/1:1 Not tainted 6.9.0-rc1-gbbeac67456c9 #59 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014 Workqueue: events mptcp_worker RIP: 0010:__mptcp_clean_una+0x4b3/0x620 net/mptcp/protocol.c:1005 Code: be 06 01 00 00 bf 06 01 00 00 e8 a8 12 e7 fe e9 00 fe ff ff e8 8e 1a e7 fe 0f b7 ab 3e 02 00 00 e9 d3 fd ff ff e8 7d 1a e7 fe <0f> 0b 4c 8b bb e0 05 00 00 e9 74 fc ff ff e8 6a 1a e7 fe 0f 0b e9 RSP: 0018:ffffc9000013fd48 EFLAGS: 00010293 RAX: 0000000000000000 RBX: ffff8881029bd280 RCX: ffffffff82382fe4 RDX: ffff8881003cbd00 RSI: ffffffff823833c3 RDI: 0000000000000001 RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: fefefefefefefeff R12: ffff888138ba8000 R13: 0000000000000106 R14: ffff8881029bd908 R15: ffff888126560000 FS: 0000000000000000(0000) GS:ffff88813bd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f604a5dae38 CR3: 0000000101dac002 CR4: 0000000000170ef0 Call Trace: <TASK> __mptcp_clean_una_wakeup net/mptcp/protocol.c:1055 [inline] mptcp_clean_una_wakeup net/mptcp/protocol.c:1062 [inline] __mptcp_retrans+0x7f/0x7e0 net/mptcp/protocol.c:2615 mptcp_worker+0x434/0x740 net/mptcp/protocol.c:2767 process_one_work+0x1e0/0x560 kernel/workqueue.c:3254 process_scheduled_works kernel/workqueue.c:3335 [inline] worker_thread+0x3c7/0x640 kernel/workqueue.c:3416 kthread+0x121/0x170 kernel/kthread.c:388 ret_from_fork+0x44/0x50 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243 </TASK>
When fallback to TCP happens early on a client socket, snd_nxt is not yet initialized and any incoming ack will copy such value into snd_una. If the mptcp worker (dumbly) tries mptcp-level re-injection after such ack, that would unconditionally trigger a send buffer cleanup using 'bad' snd_una values.
We could easily disable re-injection for fallback sockets, but such dumb behavior already helped catching a few subtle issues and a very low to zero impact in practice.
Instead address the issue always initializing snd_nxt (and write_seq, for consistency) at connect time.
--- net/mptcp/protocol.c | 3 +++ 1 file changed, 3 insertions(+)
net/mptcp/protocol.c +3 -0
@@ -3698,6 +3698,9 @@ static int mptcp_connect(struct sock *skMPTCP_INC_STATS (sock_net (ssk),MPTCP_MIB_TOKENFALLBACKINIT );mptcp_subflow_early_fallback (msk, subflow); } + +WRITE_ONCE (msk->write_seq, subflow->idsn); +WRITE_ONCE (msk->snd_nxt, subflow->idsn);if (likely (!__mptcp_check_fallback (msk)))MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_MPCAPABLEACTIVE );
Greg Kroah-Hartman
maintainerPATCH 246/301 mptcp: only allow set existing scheduler for net.mptcp.scheduler
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Detal <[email protected]>
commit 6963c508fd7ab66ae0b7ae3db9a62ca6267f1ae8 upstream.
The current behavior is to accept any strings as inputs, this results in an inconsistent result where an unexisting scheduler can be set:
# sysctl -w net.mptcp.scheduler=notdefault net.mptcp.scheduler = notdefault
This patch changes this behavior by checking for existing scheduler before accepting the input.
--- net/mptcp/ctrl.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-)
net/mptcp/ctrl.c +38 -1
@@ -87,6 +87,43 @@ static void mptcp_pernet_set_defaults(st } #ifdef CONFIG_SYSCTL +static int mptcp_set_scheduler(const struct net *net, const char *name) +{ + struct mptcp_pernet *pernet = mptcp_get_pernet(net); + struct mptcp_sched_ops *sched; + int ret = 0; + + rcu_read_lock(); + sched = mptcp_sched_find(name); + if (sched) + strscpy(pernet->scheduler, name, MPTCP_SCHED_NAME_MAX); + else + ret = -ENOENT; + rcu_read_unlock(); + + return ret; +} + +static int proc_scheduler(struct ctl_table *ctl, int write, + void *buffer, size_t *lenp, loff_t *ppos) +{ + const struct net *net = current->nsproxy->net_ns; + char val[MPTCP_SCHED_NAME_MAX]; + struct ctl_table tbl = { + .data = val, + .maxlen = MPTCP_SCHED_NAME_MAX, + }; + int ret; + + strscpy(val, mptcp_get_scheduler(net), MPTCP_SCHED_NAME_MAX); + + ret = proc_dostring(&tbl, write, buffer, lenp, ppos); + if (write && ret == 0) + ret = mptcp_set_scheduler(net, val); + + return ret; +} + static struct ctl_table mptcp_sysctl_table[] = { { .procname = "enabled",
@@ -139,7 +176,7 @@ static struct ctl_table mptcp_sysctl_tab .procname = "scheduler", .maxlen = MPTCP_SCHED_NAME_MAX, .mode = 0644, - .proc_handler = proc_dostring, + .proc_handler = proc_scheduler, }, {} };
Greg Kroah-Hartman
maintainerPATCH 247/301 workqueue: Fix selection of wake_cpu in kick_pool()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Schnelle <[email protected]>
commit 57a01eafdcf78f6da34fad9ff075ed5dfdd9f420 upstream.
With cpu_possible_mask=0-63 and cpu_online_mask=0-7 the following kernel oops was observed:
smp: Bringing up secondary CPUs ...
smp: Brought up 1 node, 8 CPUs
Unable to handle kernel pointer dereference in virtual kernel address space Failing address: 0000000000000000 TEID: 0000000000000803 [..] Call Trace: arch_vcpu_is_preempted+0x12/0x80 select_idle_sibling+0x42/0x560 select_task_rq_fair+0x29a/0x3b0 try_to_wake_up+0x38e/0x6e0 kick_pool+0xa4/0x198 __queue_work.part.0+0x2bc/0x3a8 call_timer_fn+0x36/0x160 __run_timers+0x1e2/0x328 __run_timer_base+0x5a/0x88 run_timer_softirq+0x40/0x78 __do_softirq+0x118/0x388 irq_exit_rcu+0xc0/0xd8 do_ext_irq+0xae/0x168 ext_int_handler+0xbe/0xf0 psw_idle_exit+0x0/0xc default_idle_call+0x3c/0x110 do_idle+0xd4/0x158 cpu_startup_entry+0x40/0x48 rest_init+0xc6/0xc8 start_kernel+0x3c4/0x5e0 startup_continue+0x3c/0x50
The crash is caused by calling arch_vcpu_is_preempted() for an offline CPU. To avoid this, select the cpu with cpumask_any_and_distribute() to mask __pod_cpumask with cpu_online_mask. In case no cpu is left in the pool, skip the assignment.
tj: This doesn't fully fix the bug as CPUs can still go down between picking the target CPU and the wake call. Fixing that likely requires adding cpu_online() test to either the sched or s390 arch code. However, regardless of how that is fixed, workqueue shouldn't be picking a CPU which isn't online as that would result in unpredictable and worse behavior.
--- kernel/workqueue.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/workqueue.c +6 -2
@@ -1135,8 +1135,12 @@ static bool kick_pool(struct worker_pool !cpumask_test_cpu(p->wake_cpu, pool->attrs->__pod_cpumask)) {struct work_struct *work =list_first_entry (&pool->worklist, struct work_struct, entry); - p->wake_cpu =cpumask_any_distribute (pool->attrs->__pod_cpumask); -get_work_pwq (work)->stats[PWQ_STAT_REPATRIATED ]++; +int wake_cpu =cpumask_any_and_distribute (pool->attrs->__pod_cpumask, + cpu_online_mask); +if (wake_cpu < nr_cpu_ids) { + p->wake_cpu = wake_cpu; +get_work_pwq (work)->stats[PWQ_STAT_REPATRIATED ]++; + } }#endif wake_up_process (p);
Greg Kroah-Hartman
maintainerPATCH 248/301 dt-bindings: iio: health: maxim,max30102: fix compatible check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 89384a2b656b9dace4c965432a209d5c9c3a2a6f upstream.
The "maxim,green-led-current-microamp" property is only available for the max30105 part (it provides an extra green LED), and must be set to false for the max30102 part.
Instead, the max30100 part has been used for that, which is not supported by this binding (it has its own binding).
This error was introduced during the txt to yaml conversion.
--- Documentation/devicetree/bindings/iio/health/maxim,max30102.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/iio/health/maxim,max30102.yaml +1 -1
@@ -42,7 +42,7 @@ allOf: properties: compatible: contains: - const: maxim,max30100 + const: maxim,max30102 then: properties: maxim,green-led-current-microamp: false
Greg Kroah-Hartman
maintainerPATCH 249/301 iio:imu: adis16475: Fix sync mode setting
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ramona Gradinariu <[email protected]>
commit 74a72baf204fd509bbe8b53eec35e39869d94341 upstream.
Fix sync mode setting by applying the necessary shift bits.
--- drivers/iio/imu/adis16475.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/imu/adis16475.c +3 -1
@@ -1127,6 +1127,7 @@ static int adis16475_config_sync_mode(ststruct device *dev = &st->adis.spi->dev;const struct adis16475_sync *sync;u32 sync_mode; +u16 val;/* default to internal clk */ st->clk_freq = st->info->int_clk *1000 ;
@@ -1188,8 +1189,9 @@ static int adis16475_config_sync_mode(st* I'm keeping this for simplicity and avoiding extra variables * in chip_info. */ + val =ADIS16475_SYNC_MODE (sync->sync_mode); ret =__adis_update_bits (&st->adis,ADIS16475_REG_MSG_CTRL , -ADIS16475_SYNC_MODE_MASK , sync->sync_mode); +ADIS16475_SYNC_MODE_MASK , val);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 250/301 iio: pressure: Fixes BME280 SPI driver data
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasileios Amoiridis <[email protected]>
commit 546a4f4b5f4d930ea57f5510e109acf08eca5e87 upstream.
Use bme280_chip_info structure instead of bmp280_chip_info in SPI support for the BME280 sensor.
--- drivers/iio/pressure/bmp280-spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/pressure/bmp280-spi.c +2 -2
@@ -83,7 +83,7 @@ static const struct of_device_id bmp280_ { .compatible = "bosch,bmp180", .data = &bmp180_chip_info }, { .compatible = "bosch,bmp181", .data = &bmp180_chip_info }, { .compatible = "bosch,bmp280", .data = &bmp280_chip_info }, - { .compatible = "bosch,bme280", .data = &bmp280_chip_info }, + { .compatible = "bosch,bme280", .data = &bme280_chip_info }, { .compatible = "bosch,bmp380", .data = &bmp380_chip_info }, { .compatible = "bosch,bmp580", .data = &bmp580_chip_info }, { },
@@ -95,7 +95,7 @@ static const struct spi_device_id bmp280 { "bmp180", (kernel_ulong_t)&bmp180_chip_info }, { "bmp181", (kernel_ulong_t)&bmp180_chip_info }, { "bmp280", (kernel_ulong_t)&bmp280_chip_info }, - { "bme280", (kernel_ulong_t)&bmp280_chip_info }, + { "bme280", (kernel_ulong_t)&bme280_chip_info }, { "bmp380", (kernel_ulong_t)&bmp380_chip_info }, { "bmp580", (kernel_ulong_t)&bmp580_chip_info }, { }
Greg Kroah-Hartman
maintainerPATCH 251/301 iio: accel: mxc4005: Interrupt handling fixes
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 57a1592784d622ecee0b71940c65429173996b33 upstream.
There are 2 issues with interrupt handling in the mxc4005 driver:
1. mxc4005_set_trigger_state() writes MXC4005_REG_INT_MASK1_BIT_DRDYE (0x01) to INT_MASK1 to enable the interrupt, but to disable the interrupt it writes ~MXC4005_REG_INT_MASK1_BIT_DRDYE which is 0xfe, so it enables all other interrupt sources in the INT_SRC1 register. On the MXC4005 this is not an issue because only bit 0 of the register is used. On the MXC6655 OTOH this is a problem since bit7 is used as TC (Temperature Compensation) disable bit and writing 1 to this disables Temperature Compensation which should only be done when running self-tests on the chip.
Write 0 instead of ~MXC4005_REG_INT_MASK1_BIT_DRDYE to disable the interrupts to fix this.
2. The datasheets for the MXC4005 / MXC6655 do not state what the reset value for the INT_MASK0 and INT_MASK1 registers is and since these are write only we also cannot learn this from the hw. Presumably the reset value for both is all 0, which means all interrupts disabled.
Explicitly set both registers to 0 from mxc4005_chip_init() to ensure both masks are actually set to 0.
--- drivers/iio/accel/mxc4005.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/iio/accel/mxc4005.c +17 -7
@@ -27,9 +27,13 @@#define MXC4005_REG_ZOUT_UPPER 0x07#define MXC4005_REG_ZOUT_LOWER 0x08 +#define MXC4005_REG_INT_MASK0 0x0A +#define MXC4005_REG_INT_MASK1 0x0B#define MXC4005_REG_INT_MASK1_BIT_DRDYE 0x01 +#define MXC4005_REG_INT_CLR0 0x00 +#define MXC4005_REG_INT_CLR1 0x01#define MXC4005_REG_INT_CLR1_BIT_DRDYC 0x01
@@ -113,7 +117,9 @@ static bool mxc4005_is_readable_reg(strustatic bool mxc4005_is_writeable_reg (struct device *dev,unsigned int reg) {switch (reg) { +case MXC4005_REG_INT_CLR0 :case MXC4005_REG_INT_CLR1 : +case MXC4005_REG_INT_MASK0 :case MXC4005_REG_INT_MASK1 :case MXC4005_REG_CONTROL :return true;
@@ -330,17 +336,13 @@ static int mxc4005_set_trigger_state(str {struct iio_dev *indio_dev =iio_trigger_get_drvdata (trig);struct mxc4005_data *data =iio_priv (indio_dev); +unsigned int val;int ret;mutex_lock (&data->mutex); -if (state) { - ret =regmap_write (data->regmap,MXC4005_REG_INT_MASK1 , -MXC4005_REG_INT_MASK1_BIT_DRDYE ); - }else { - ret =regmap_write (data->regmap,MXC4005_REG_INT_MASK1 , - ~MXC4005_REG_INT_MASK1_BIT_DRDYE ); - } + val = state ?MXC4005_REG_INT_MASK1_BIT_DRDYE :0 ; + ret =regmap_write (data->regmap,MXC4005_REG_INT_MASK1 , val);if (ret <0 ) {mutex_unlock (&data->mutex);dev_err (data->dev,"failed to update reg_int_mask1" );
@@ -382,6 +384,14 @@ static int mxc4005_chip_init(struct mxc4dev_dbg (data->dev,"MXC4005 chip id %02x\n" , reg); + ret =regmap_write (data->regmap,MXC4005_REG_INT_MASK0 ,0 ); +if (ret <0 ) +return dev_err_probe (data->dev, ret,"writing INT_MASK0\n" ); + + ret =regmap_write (data->regmap,MXC4005_REG_INT_MASK1 ,0 ); +if (ret <0 ) +return dev_err_probe (data->dev, ret,"writing INT_MASK1\n" ); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 252/301 kmsan: compiler_types: declare __no_sanitize_or_inline
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Potapenko <[email protected]>
commit 90d1f14cbb9ddbfc532e2da13bf6e0ed8320e792 upstream.
It turned out that KMSAN instruments READ_ONCE_NOCHECK(), resulting in false positive reports, because __no_sanitize_or_inline enforced inlining.
Properly declare __no_sanitize_or_inline under __SANITIZE_MEMORY__, so that it does not __always_inline the annotated function.
--- include/linux/compiler_types.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
include/linux/compiler_types.h +11 -0
@@ -280,6 +280,17 @@ struct ftrace_likely_data {# define __no_kcsan#endif +#ifdef __SANITIZE_MEMORY__ +/* +* Similarly to KASAN and KCSAN, KMSAN loses function attributes of inlined +* functions, therefore disabling KMSAN checks also requires disabling inlining. +* +* __no_sanitize_or_inline effectively prevents KMSAN from reporting errors +* within the function and marks all its outputs as initialized. +*/ +# define __no_sanitize_or_inline __no_kmsan_checks notrace __maybe_unused +#endif +#ifndef __no_sanitize_or_inline#define __no_sanitize_or_inline __always_inline#endif
Greg Kroah-Hartman
maintainerPATCH 253/301 e1000e: change usleep_range to udelay in PHY mdic access
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Lifshits <[email protected]>
commit 387f295cb2150ed164905b648d76dfcbd3621778 upstream.
This is a partial revert of commit 6dbdd4de0362 ("e1000e: Workaround for sporadic MDI error on Meteor Lake systems"). The referenced commit used usleep_range inside the PHY access routines, which are sometimes called from an atomic context. This can lead to a kernel panic in some scenarios, such as cable disconnection and reconnection on vPro systems.
Solve this by changing the usleep_range calls back to udelay.
--- drivers/net/ethernet/intel/e1000e/phy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/e1000e/phy.c +4 -4
@@ -157,7 +157,7 @@ s32 e1000e_read_phy_reg_mdic(struct e100* the lower time out */ for (i =0 ; i < (E1000_GEN_POLL_TIMEOUT *3 ); i++) { -usleep_range (50 ,60 ); +udelay (50 ); mdic =er32 (MDIC );if (mdic &E1000_MDIC_READY )break ;
@@ -181,7 +181,7 @@ s32 e1000e_read_phy_reg_mdic(struct e100* reading duplicate data in the next MDIC transaction. */ if (hw->mac.type == e1000_pch2lan) -usleep_range (100 ,150 ); +udelay (100 );if (success) { *data = (u16 )mdic;
@@ -237,7 +237,7 @@ s32 e1000e_write_phy_reg_mdic(struct e10* the lower time out */ for (i =0 ; i < (E1000_GEN_POLL_TIMEOUT *3 ); i++) { -usleep_range (50 ,60 ); +udelay (50 ); mdic =er32 (MDIC );if (mdic &E1000_MDIC_READY )break ;
@@ -261,7 +261,7 @@ s32 e1000e_write_phy_reg_mdic(struct e10* reading duplicate data in the next MDIC transaction. */ if (hw->mac.type == e1000_pch2lan) -usleep_range (100 ,150 ); +udelay (100 );if (success)return 0 ;
Greg Kroah-Hartman
maintainerPATCH 254/301 tipc: fix UAF in error path
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 080cbb890286cd794f1ee788bbc5463e2deb7c2b upstream.
Sam Page (sam4k) working with Trend Micro Zero Day Initiative reported a UAF in the tipc_buf_append() error path:
BUG: KASAN: slab-use-after-free in kfree_skb_list_reason+0x47e/0x4c0 linux/net/core/skbuff.c:1183 Read of size 8 at addr ffff88804d2a7c80 by task poc/8034 CPU: 1 PID: 8034 Comm: poc Not tainted 6.8.2 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-debian-1.16.0-5 04/01/2014 Call Trace: <IRQ> __dump_stack linux/lib/dump_stack.c:88 dump_stack_lvl+0xd9/0x1b0 linux/lib/dump_stack.c:106 print_address_description linux/mm/kasan/report.c:377 print_report+0xc4/0x620 linux/mm/kasan/report.c:488 kasan_report+0xda/0x110 linux/mm/kasan/report.c:601 kfree_skb_list_reason+0x47e/0x4c0 linux/net/core/skbuff.c:1183 skb_release_data+0x5af/0x880 linux/net/core/skbuff.c:1026 skb_release_all linux/net/core/skbuff.c:1094 __kfree_skb linux/net/core/skbuff.c:1108 kfree_skb_reason+0x12d/0x210 linux/net/core/skbuff.c:1144 kfree_skb linux/./include/linux/skbuff.h:1244 tipc_buf_append+0x425/0xb50 linux/net/tipc/msg.c:186 tipc_link_input+0x224/0x7c0 linux/net/tipc/link.c:1324 tipc_link_rcv+0x76e/0x2d70 linux/net/tipc/link.c:1824 tipc_rcv+0x45f/0x10f0 linux/net/tipc/node.c:2159 tipc_udp_recv+0x73b/0x8f0 linux/net/tipc/udp_media.c:390 udp_queue_rcv_one_skb+0xad2/0x1850 linux/net/ipv4/udp.c:2108 udp_queue_rcv_skb+0x131/0xb00 linux/net/ipv4/udp.c:2186 udp_unicast_rcv_skb+0x165/0x3b0 linux/net/ipv4/udp.c:2346 __udp4_lib_rcv+0x2594/0x3400 linux/net/ipv4/udp.c:2422 ip_protocol_deliver_rcu+0x30c/0x4e0 linux/net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x2e4/0x520 linux/net/ipv4/ip_input.c:233 NF_HOOK linux/./include/linux/netfilter.h:314 NF_HOOK linux/./include/linux/netfilter.h:308 ip_local_deliver+0x18e/0x1f0 linux/net/ipv4/ip_input.c:254 dst_input linux/./include/net/dst.h:461 ip_rcv_finish linux/net/ipv4/ip_input.c:449 NF_HOOK linux/./include/linux/netfilter.h:314 NF_HOOK linux/./include/linux/netfilter.h:308 ip_rcv+0x2c5/0x5d0 linux/net/ipv4/ip_input.c:569 __netif_receive_skb_one_core+0x199/0x1e0 linux/net/core/dev.c:5534 __netif_receive_skb+0x1f/0x1c0 linux/net/core/dev.c:5648 process_backlog+0x101/0x6b0 linux/net/core/dev.c:5976 __napi_poll.constprop.0+0xba/0x550 linux/net/core/dev.c:6576 napi_poll linux/net/core/dev.c:6645 net_rx_action+0x95a/0xe90 linux/net/core/dev.c:6781 __do_softirq+0x21f/0x8e7 linux/kernel/softirq.c:553 do_softirq linux/kernel/softirq.c:454 do_softirq+0xb2/0xf0 linux/kernel/softirq.c:441 </IRQ> <TASK> __local_bh_enable_ip+0x100/0x120 linux/kernel/softirq.c:381 local_bh_enable linux/./include/linux/bottom_half.h:33 rcu_read_unlock_bh linux/./include/linux/rcupdate.h:851 __dev_queue_xmit+0x871/0x3ee0 linux/net/core/dev.c:4378 dev_queue_xmit linux/./include/linux/netdevice.h:3169 neigh_hh_output linux/./include/net/neighbour.h:526 neigh_output linux/./include/net/neighbour.h:540 ip_finish_output2+0x169f/0x2550 linux/net/ipv4/ip_output.c:235 __ip_finish_output linux/net/ipv4/ip_output.c:313 __ip_finish_output+0x49e/0x950 linux/net/ipv4/ip_output.c:295 ip_finish_output+0x31/0x310 linux/net/ipv4/ip_output.c:323 NF_HOOK_COND linux/./include/linux/netfilter.h:303 ip_output+0x13b/0x2a0 linux/net/ipv4/ip_output.c:433 dst_output linux/./include/net/dst.h:451 ip_local_out linux/net/ipv4/ip_output.c:129 ip_send_skb+0x3e5/0x560 linux/net/ipv4/ip_output.c:1492 udp_send_skb+0x73f/0x1530 linux/net/ipv4/udp.c:963 udp_sendmsg+0x1a36/0x2b40 linux/net/ipv4/udp.c:1250 inet_sendmsg+0x105/0x140 linux/net/ipv4/af_inet.c:850 sock_sendmsg_nosec linux/net/socket.c:730 __sock_sendmsg linux/net/socket.c:745 __sys_sendto+0x42c/0x4e0 linux/net/socket.c:2191 __do_sys_sendto linux/net/socket.c:2203 __se_sys_sendto linux/net/socket.c:2199 __x64_sys_sendto+0xe0/0x1c0 linux/net/socket.c:2199 do_syscall_x64 linux/arch/x86/entry/common.c:52 do_syscall_64+0xd8/0x270 linux/arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 linux/arch/x86/entry/entry_64.S:120 RIP: 0033:0x7f3434974f29 Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48
89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 37 8f 0d 00 f7 d8 64 89 01 48
RSP: 002b:00007fff9154f2b8 EFLAGS: 00000212 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f3434974f29
RDX: 00000000000032c8 RSI: 00007fff9154f300 RDI: 0000000000000003
RBP: 00007fff915532e0 R08: 00007fff91553360 R09: 0000000000000010
R10: 0000000000000000 R11: 0000000000000212 R12: 000055ed86d261d0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>
In the critical scenario, either the relevant skb is freed or its ownership is transferred into a frag_lists. In both cases, the cleanup code must not free it again: we need to clear the skb reference earlier.
--- net/tipc/msg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/tipc/msg.c +5 -1
@@ -156,6 +156,11 @@ int tipc_buf_append(struct sk_buff **heaif (!head) goto err; +/* Either the input skb ownership is transferred to headskb +* or the input skb is freed, clear the reference to avoid +* bad access on error path. +*/ + *buf =NULL ;if (skb_try_coalesce (head, frag, &headstolen, &delta)) {kfree_skb_partial (frag, headstolen); }else {
@@ -179,7 +184,6 @@ int tipc_buf_append(struct sk_buff **hea *headbuf =NULL ;return 1 ; } - *buf =NULL ;return 0 ; err:kfree_skb (*buf);
Greg Kroah-Hartman
maintainerPATCH 255/301 xtensa: fix MAKE_PC_FROM_RA second argument
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit 0e60f0b75884677fb9f4f2ad40d52b43451564d5 upstream.
Xtensa has two-argument MAKE_PC_FROM_RA macro to convert a0 to an actual return address because when windowed ABI is used call{,x}{4,8,12} opcodes stuff encoded window size into the top 2 bits of the register that becomes a return address in the called function. Second argument of that macro is supposed to be an address having these 2 topmost bits set correctly, but the comment suggested that that could be the stack address. However the stack doesn't have to be in the same 1GByte region as the code, especially in noMMU XIP configurations.
Fix the comment and use either _text or regs->pc as the second argument for the MAKE_PC_FROM_RA macro.
--- arch/xtensa/include/asm/processor.h | 8 ++++---- arch/xtensa/include/asm/ptrace.h | 2 +- arch/xtensa/kernel/process.c | 5 +++-- arch/xtensa/kernel/stacktrace.c | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-)
arch/xtensa/include/asm/processor.h +4 -4
@@ -115,9 +115,9 @@#define MAKE_RA_FOR_CALL (ra,ws) (((ra) & 0x3fffffff) | (ws) << 30)/* Convert return address to a valid pc -* Note: We assume that the stack pointer is in the same 1GB ranges as the ra +* Note: 'text' is the address within the same 1GB range as the ra */ -#define MAKE_PC_FROM_RA (ra,sp) (((ra) & 0x3fffffff) | ((sp) & 0xc0000000)) +#define MAKE_PC_FROM_RA (ra, text) (((ra) & 0x3fffffff) | ((unsigned long)(text) & 0xc0000000))#elif defined(__XTENSA_CALL0_ABI__)
@@ -127,9 +127,9 @@#define MAKE_RA_FOR_CALL (ra, ws) (ra)/* Convert return address to a valid pc -* Note: We assume that the stack pointer is in the same 1GB ranges as the ra +* Note: 'text' is not used as 'ra' is always the full address */ -#define MAKE_PC_FROM_RA (ra, sp) (ra) +#define MAKE_PC_FROM_RA (ra, text) (ra)#else #error Unsupported Xtensa ABI
arch/xtensa/include/asm/ptrace.h +1 -1
@@ -87,7 +87,7 @@ struct pt_regs {# define user_mode (regs) (((regs)->ps & 0x00000020)!=0)# define instruction_pointer (regs) ((regs)->pc)# define return_pointer (regs) (MAKE_PC_FROM_RA((regs)->areg[0], \ - (regs)->areg[1])) + (regs)->pc))# ifndef CONFIG_SMP # define profile_pc (regs) instruction_pointer(regs)
arch/xtensa/kernel/process.c +3 -2
@@ -47,6 +47,7 @@#include <asm/asm-offsets.h> #include <asm/regs.h> #include <asm/hw_breakpoint.h> +#include <asm/sections.h> #include <asm/traps.h> extern void ret_from_fork (void );
@@ -380,7 +381,7 @@ unsigned long __get_wchan(struct task_stint count =0 ; sp = p->thread.sp; - pc =MAKE_PC_FROM_RA (p->thread.ra, p->thread.sp); + pc =MAKE_PC_FROM_RA (p->thread.ra, _text); do { if (sp < stack_page + sizeof(struct task_struct) ||
@@ -392,7 +393,7 @@ unsigned long __get_wchan(struct task_st/* Stack layout: sp-4: ra, sp-3: sp' */ - pc =MAKE_PC_FROM_RA (SPILL_SLOT (sp,0 ), sp); + pc =MAKE_PC_FROM_RA (SPILL_SLOT (sp,0 ), _text); sp =SPILL_SLOT (sp,1 ); }while (count++ <16 );return 0 ;
arch/xtensa/kernel/stacktrace.c +2 -1
@@ -13,6 +13,7 @@#include <linux/stacktrace.h> #include <asm/ftrace.h> +#include <asm/sections.h> #include <asm/stacktrace.h> #include <asm/traps.h> #include <linux/uaccess.h>
@@ -189,7 +190,7 @@ void walk_stackframe(unsigned long *sp,if (a1 <= (unsigned long )sp)break ; - frame.pc =MAKE_PC_FROM_RA (a0, a1); + frame.pc =MAKE_PC_FROM_RA (a0, _text); frame.sp = a1;if (fn (&frame, data))
Greg Kroah-Hartman
maintainerPATCH 256/301 net: bcmgenet: synchronize EXT_RGMII_OOB_CTRL access
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Doug Berger <[email protected]>
commit d85cf67a339685beae1d0aee27b7f61da95455be upstream.
The EXT_RGMII_OOB_CTRL register can be written from different contexts. It is predominantly written from the adjust_link handler which is synchronized by the phydev->lock, but can also be written from a different context when configuring the mii in bcmgenet_mii_config().
The chances of contention are quite low, but it is conceivable that adjust_link could occur during resume when WoL is enabled so use the phydev->lock synchronizer in bcmgenet_mii_config() to be sure.
--- drivers/net/ethernet/broadcom/genet/bcmmii.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/genet/bcmmii.c +3 -1
@@ -2,7 +2,7 @@/* * Broadcom GENET MDIO routines * -* Copyright (c) 2014-2017 Broadcom +* Copyright (c) 2014-2024 Broadcom */ #include <linux/acpi.h>
@@ -274,6 +274,7 @@ int bcmgenet_mii_config(struct net_devic* block for the interface to work, unconditionally clear the * Out-of-band disable since we do not need it. */ +mutex_lock (&phydev->lock); reg =bcmgenet_ext_readl (priv,EXT_RGMII_OOB_CTRL ); reg &= ~OOB_DISABLE ;if (priv->ext_phy) {
@@ -285,6 +286,7 @@ int bcmgenet_mii_config(struct net_devic reg |=RGMII_MODE_EN ; }bcmgenet_ext_writel (priv, reg,EXT_RGMII_OOB_CTRL ); +mutex_unlock (&phydev->lock);if (init)dev_info (kdev,"configuring instance for %s\n" , phy_name);
Greg Kroah-Hartman
maintainerPATCH 257/301 net: bcmgenet: synchronize use of bcmgenet_set_rx_mode()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Doug Berger <[email protected]>
commit 2dbe5f19368caae63b1f59f5bc2af78c7d522b3a upstream.
The ndo_set_rx_mode function is synchronized with the netif_addr_lock spinlock and BHs disabled. Since this function is also invoked directly from the driver the same synchronization should be applied.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +3 -1
@@ -2,7 +2,7 @@/* * Broadcom GENET (Gigabit Ethernet) controller driver * -* Copyright (c) 2014-2020 Broadcom +* Copyright (c) 2014-2024 Broadcom */ #define pr_fmt (fmt) "bcmgenet: " fmt
@@ -3353,7 +3353,9 @@ static void bcmgenet_netif_start(structstruct bcmgenet_priv *priv =netdev_priv (dev);/* Start the network engine */ +netif_addr_lock_bh (dev);bcmgenet_set_rx_mode (dev); +netif_addr_unlock_bh (dev);bcmgenet_enable_rx_napi (priv);umac_enable_set (priv,CMD_TX_EN |CMD_RX_EN , true);
Greg Kroah-Hartman
maintainerPATCH 258/301 net: bcmgenet: synchronize UMAC_CMD access
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Doug Berger <[email protected]>
commit 0d5e2a82232605b337972fb2c7d0cbc46898aca1 upstream.
The UMAC_CMD register is written from different execution contexts and has insufficient synchronization protections to prevent possible corruption. Of particular concern are the acceses from the phy_device delayed work context used by the adjust_link call and the BH context that may be used by the ndo_set_rx_mode call.
A spinlock is added to the driver to protect contended register accesses (i.e. reg_lock) and it is used to synchronize accesses to UMAC_CMD.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 12 +++++++++++- drivers/net/ethernet/broadcom/genet/bcmgenet.h | 4 +++- drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c | 8 +++++++- drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 ++ 4 files changed, 23 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +11 -1
@@ -2469,14 +2469,18 @@ static void umac_enable_set(struct bcmge {u32 reg; +spin_lock_bh (&priv->reg_lock); reg =bcmgenet_umac_readl (priv,UMAC_CMD ); -if (reg &CMD_SW_RESET ) +if (reg &CMD_SW_RESET ) { +spin_unlock_bh (&priv->reg_lock);return ; + }if (enable) reg |= mask;else reg &= ~mask;bcmgenet_umac_writel (priv, reg,UMAC_CMD ); +spin_unlock_bh (&priv->reg_lock);/* UniMAC stops on a packet boundary, wait for a full-size packet * to be processed
@@ -2492,8 +2496,10 @@ static void reset_umac(struct bcmgenet_pudelay (10 );/* issue soft reset and disable MAC while updating its registers */ +spin_lock_bh (&priv->reg_lock);bcmgenet_umac_writel (priv,CMD_SW_RESET ,UMAC_CMD );udelay (2 ); +spin_unlock_bh (&priv->reg_lock); }static void bcmgenet_intr_disable (struct bcmgenet_priv *priv)
@@ -3616,16 +3622,19 @@ static void bcmgenet_set_rx_mode(struct* 3. The number of filters needed exceeds the number filters * supported by the hardware. */ +spin_lock (&priv->reg_lock); reg =bcmgenet_umac_readl (priv,UMAC_CMD );if ((dev->flags & (IFF_PROMISC |IFF_ALLMULTI )) || (nfilter >MAX_MDF_FILTER )) { reg |=CMD_PROMISC ;bcmgenet_umac_writel (priv, reg,UMAC_CMD ); +spin_unlock (&priv->reg_lock);bcmgenet_umac_writel (priv,0 ,UMAC_MDF_CTRL );return ; }else { reg &= ~CMD_PROMISC ;bcmgenet_umac_writel (priv, reg,UMAC_CMD ); +spin_unlock (&priv->reg_lock); }/* update MDF filter */
@@ -4027,6 +4036,7 @@ static int bcmgenet_probe(struct platfor goto err; } +spin_lock_init (&priv->reg_lock);spin_lock_init (&priv->lock);/* Set default pause parameters */
drivers/net/ethernet/broadcom/genet/bcmgenet.h +3 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-only */ /* -* Copyright (c) 2014-2020 Broadcom +* Copyright (c) 2014-2024 Broadcom */ #ifndef __BCMGENET_H__
@@ -573,6 +573,8 @@ struct bcmgenet_rxnfc_rule {/* device context */ struct bcmgenet_priv {void __iomem *base; +/* reg_lock: lock to serialize access to shared registers */ +spinlock_t reg_lock;enum bcmgenet_version version;struct net_device *dev;
drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c +7 -1
@@ -2,7 +2,7 @@/* * Broadcom GENET (Gigabit Ethernet) Wake-on-LAN support * -* Copyright (c) 2014-2020 Broadcom +* Copyright (c) 2014-2024 Broadcom */ #define pr_fmt (fmt) "bcmgenet_wol: " fmt
@@ -151,6 +151,7 @@ int bcmgenet_wol_power_down_cfg(struct b }/* Can't suspend with WoL if MAC is still in reset */ +spin_lock_bh (&priv->reg_lock); reg =bcmgenet_umac_readl (priv,UMAC_CMD );if (reg &CMD_SW_RESET ) reg &= ~CMD_SW_RESET ;
@@ -158,6 +159,7 @@ int bcmgenet_wol_power_down_cfg(struct b/* disable RX */ reg &= ~CMD_RX_EN ;bcmgenet_umac_writel (priv, reg,UMAC_CMD ); +spin_unlock_bh (&priv->reg_lock);mdelay (10 );if (priv->wolopts & (WAKE_MAGIC |WAKE_MAGICSECURE )) {
@@ -203,6 +205,7 @@ int bcmgenet_wol_power_down_cfg(struct b }/* Enable CRC forward */ +spin_lock_bh (&priv->reg_lock); reg =bcmgenet_umac_readl (priv,UMAC_CMD ); priv->crc_fwd_en =1 ; reg |=CMD_CRC_FWD ;
@@ -210,6 +213,7 @@ int bcmgenet_wol_power_down_cfg(struct b/* Receiver must be enabled for WOL MP detection */ reg |=CMD_RX_EN ;bcmgenet_umac_writel (priv, reg,UMAC_CMD ); +spin_unlock_bh (&priv->reg_lock); reg =UMAC_IRQ_MPD_R ;if (hfb_enable)
@@ -256,7 +260,9 @@ void bcmgenet_wol_power_up_cfg(struct bc }/* Disable CRC Forward */ +spin_lock_bh (&priv->reg_lock); reg =bcmgenet_umac_readl (priv,UMAC_CMD ); reg &= ~CMD_CRC_FWD ;bcmgenet_umac_writel (priv, reg,UMAC_CMD ); +spin_unlock_bh (&priv->reg_lock); }
drivers/net/ethernet/broadcom/genet/bcmmii.c +2 -0
@@ -75,6 +75,7 @@ static void bcmgenet_mac_config(struct n reg |=RGMII_LINK ;bcmgenet_ext_writel (priv, reg,EXT_RGMII_OOB_CTRL ); +spin_lock_bh (&priv->reg_lock); reg =bcmgenet_umac_readl (priv,UMAC_CMD ); reg &= ~((CMD_SPEED_MASK << CMD_SPEED_SHIFT) | CMD_HD_EN |
@@ -87,6 +88,7 @@ static void bcmgenet_mac_config(struct n reg |=CMD_TX_EN |CMD_RX_EN ; }bcmgenet_umac_writel (priv, reg,UMAC_CMD ); +spin_unlock_bh (&priv->reg_lock); priv->eee.eee_active =phy_init_eee (phydev,0 ) >=0 ; bcmgenet_eee_enable_set(dev,
Greg Kroah-Hartman
maintainerPATCH 259/301 ASoC: tegra: Fix DSPK 16-bit playback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sameer Pujar <[email protected]>
commit 2e93a29b48a017c777d4fcbfcc51aba4e6a90d38 upstream.
DSPK configuration is wrong for 16-bit playback and this happens because the client config is always fixed at 24-bit in hw_params(). Fix this by updating the client config to 16-bit for the respective playback.
--- sound/soc/tegra/tegra186_dspk.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/tegra/tegra186_dspk.c +3 -4
@@ -1,8 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2020-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // tegra186_dspk.c - Tegra186 DSPK driver -// -// Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved. #include <linux/clk.h> #include <linux/device.h>
@@ -241,14 +240,14 @@ static int tegra186_dspk_hw_params(strucreturn -EINVAL ; } - cif_conf.client_bits =TEGRA_ACIF_BITS_24 ; -switch (params_format (params)) {case SNDRV_PCM_FORMAT_S16_LE : cif_conf.audio_bits =TEGRA_ACIF_BITS_16 ; + cif_conf.client_bits =TEGRA_ACIF_BITS_16 ;break ;case SNDRV_PCM_FORMAT_S32_LE : cif_conf.audio_bits =TEGRA_ACIF_BITS_32 ; + cif_conf.client_bits =TEGRA_ACIF_BITS_24 ;break ;default :dev_err (dev,"unsupported format!\n" );
Greg Kroah-Hartman
maintainerPATCH 260/301 ASoC: ti: davinci-mcasp: Fix race condition during probe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joao Paulo Goncalves <[email protected]>
commit d18ca8635db2f88c17acbdf6412f26d4f6aff414 upstream.
When using davinci-mcasp as CPU DAI with simple-card, there are some conditions that cause simple-card to finish registering a sound card before davinci-mcasp finishes registering all sound components. This creates a non-working sound card from userspace with no problem indication apart from not being able to play/record audio on a PCM stream. The issue arises during simultaneous probe execution of both drivers. Specifically, the simple-card driver, awaiting a CPU DAI, proceeds as soon as davinci-mcasp registers its DAI. However, this process can lead to the client mutex lock (client_mutex in soc-core.c) being held or davinci-mcasp being preempted before PCM DMA registration on davinci-mcasp finishes. This situation occurs when the probes of both drivers run concurrently. Below is the code path for this condition. To solve the issue, defer davinci-mcasp CPU DAI registration to the last step in the audio part of it. This way, simple-card CPU DAI parsing will be deferred until all audio components are registered.
Fail Code Path:
simple-card.c: probe startssimple-card.c: simple_dai_link_of: simple_parse_node(..,cpu,..) returns EPROBE_DEFER, no CPU DAI yet davinci-mcasp.c: probe startsdavinci-mcasp.c: devm_snd_soc_register_component() register CPU DAIsimple-card.c: probes again, finish CPU DAI parsing and call devm_snd_soc_register_card() simple-card.c: finish probedavinci-mcasp.c: *dma_pcm_platform_register() register PCM DMAdavinci-mcasp.c: probe finish
--- sound/soc/ti/davinci-mcasp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/ti/davinci-mcasp.c +6 -6
@@ -2418,12 +2418,6 @@ static int davinci_mcasp_probe(struct plmcasp_reparent_fck (pdev); - ret =devm_snd_soc_register_component (&pdev->dev, &davinci_mcasp_component, - &davinci_mcasp_dai[mcasp->op_mode],1 ); - -if (ret !=0 ) - goto err; - ret =davinci_mcasp_get_dma_type (mcasp);switch (ret) {case PCM_EDMA :
@@ -2450,6 +2444,12 @@ static int davinci_mcasp_probe(struct pl goto err; } + ret =devm_snd_soc_register_component (&pdev->dev, &davinci_mcasp_component, + &davinci_mcasp_dai[mcasp->op_mode],1 ); + +if (ret !=0 ) + goto err; + no_audio: ret =davinci_mcasp_init_gpiochip (mcasp);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 261/301 dyndbg: fix old BUG_ON in >control parser
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jim Cromie <[email protected]>
commit 00e7d3bea2ce7dac7bee1cf501fb071fd0ea8f6c upstream.
Fix a BUG_ON from 2009. Even if it looks "unreachable" (I didn't really look), lets make sure by removing it, doing pr_err and return -EINVAL instead.
--- lib/dynamic_debug.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
lib/dynamic_debug.c +5 -1
@@ -302,7 +302,11 @@ static int ddebug_tokenize(char *buf, ch }else {for (end = buf; *end && !isspace (*end); end++) ; -BUG_ON (end == buf); +if (end == buf) { +pr_err ("parse err after word:%d=%s\n" , nwords, + nwords ? words[nwords -1 ] :"<none>" ); +return -EINVAL ; + } }/* `buf' is start of word, `end' is one past its end */
Greg Kroah-Hartman
maintainerPATCH 262/301 slimbus: qcom-ngd-ctrl: Add timeout for wait operation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viken Dadhaniya <[email protected]>
commit 98241a774db49988f25b7b3657026ce51ccec293 upstream.
In current driver qcom_slim_ngd_up_worker() indefinitely waiting for ctrl->qmi_up completion object. This is resulting in workqueue lockup on Kthread.
Added wait_for_completion_interruptible_timeout to allow the thread to wait for specific timeout period and bail out instead waiting infinitely.
--- drivers/slimbus/qcom-ngd-ctrl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/slimbus/qcom-ngd-ctrl.c +5 -1
@@ -1451,7 +1451,11 @@ static void qcom_slim_ngd_up_worker(stru ctrl = container_of(work, struct qcom_slim_ngd_ctrl, ngd_up_work);/* Make sure qmi service is up before continuing */ -wait_for_completion_interruptible (&ctrl->qmi_up); +if (!wait_for_completion_interruptible_timeout (&ctrl->qmi_up, +msecs_to_jiffies (MSEC_PER_SEC ))) { +dev_err (ctrl->dev,"QMI wait timeout\n" ); +return ; + }mutex_lock (&ctrl->ssr_lock);qcom_slim_ngd_enable (ctrl, true);
Greg Kroah-Hartman
maintainerPATCH 263/301 clk: sunxi-ng: common: Support minimum and maximum rate
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Oltmanns <[email protected]>
commit b914ec33b391ec766545a41f0cfc0de3e0b388d7 upstream.
The Allwinner SoC's typically have an upper and lower limit for their clocks' rates. Up until now, support for that has been implemented separately for each clock type.
Implement that functionality in the sunxi-ng's common part making use of the CCF rate liming capabilities, so that it is available for all clock types.
--- drivers/clk/sunxi-ng/ccu_common.c | 19 +++++++++++++++++++ drivers/clk/sunxi-ng/ccu_common.h | 3 +++ 2 files changed, 22 insertions(+)
drivers/clk/sunxi-ng/ccu_common.c +19 -0
@@ -44,6 +44,16 @@ bool ccu_is_better_rate(struct ccu_commounsigned long current_rate, unsigned long best_rate) { + unsigned long min_rate, max_rate; + +clk_hw_get_rate_range (&common->hw, &min_rate, &max_rate); + +if (current_rate > max_rate) +return false; + +if (current_rate < min_rate) +return false; +if (common->features &CCU_FEATURE_CLOSEST_RATE )return abs (current_rate - target_rate) <abs (best_rate - target_rate);
@@ -122,6 +132,7 @@ static int sunxi_ccu_probe(struct sunxi_for (i =0 ; i < desc->hw_clks->num ; i++) {struct clk_hw *hw = desc->hw_clks->hws[i]; +struct ccu_common *common =hw_to_ccu_common (hw);const char *name;if (!hw)
@@ -136,6 +147,14 @@ static int sunxi_ccu_probe(struct sunxi_pr_err ("Couldn't register clock %d - %s\n" , i, name); goto err_clk_unreg; } + +if (common->max_rate) +clk_hw_set_rate_range (hw, common->min_rate, + common->max_rate); +else +WARN (common->min_rate, +"No max_rate, ignoring min_rate of clock %d - %s\n" , + i, name); } ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
drivers/clk/sunxi-ng/ccu_common.h +3 -0
@@ -31,6 +31,9 @@ struct ccu_common {u16 lock_reg;u32 prediv; +unsigned long min_rate; +unsigned long max_rate; +unsigned long features;spinlock_t *lock;struct clk_hw hw;
Greg Kroah-Hartman
maintainerPATCH 264/301 clk: sunxi-ng: a64: Set minimum and maximum rate for PLL-MIPI
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Oltmanns <[email protected]>
commit 69f16d9b789821183d342719d2ebd4a5ac7178bc upstream.
When the Allwinner A64's TCON0 searches the ideal rate for the connected panel, it may happen that it requests a rate from its parent PLL-MIPI which PLL-MIPI does not support.
This happens for example on the Olimex TERES-I laptop where TCON0 requests PLL-MIPI to change to a rate of several GHz which causes the panel to stay blank. It also happens on the pinephone where a rate of less than 500 MHz is requested which causes instabilities on some phones.
Set the minimum and maximum rate of Allwinner A64's PLL-MIPI according to the Allwinner User Manual.
--- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/sunxi-ng/ccu-sun50i-a64.c +2 -0
@@ -182,6 +182,8 @@ static struct ccu_nkm pll_mipi_clk = { &ccu_nkm_ops, CLK_SET_RATE_UNGATE | CLK_SET_RATE_PARENT), .features = CCU_FEATURE_CLOSEST_RATE, + .min_rate = 500000000, + .max_rate = 1400000000, }, };
Signature · 1 line
2.45.0
Greg Kroah-Hartman
maintainerPATCH 265/301 mei: me: add lunar lake point M DID
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Usyskin <[email protected]>
commit 4108a30f1097eead0f6bd5d885e6bf093b4d460f upstream.
Add Lunar (Point) Lake M device id.
--- drivers/misc/mei/hw-me-regs.h | 2 ++ drivers/misc/mei/pci-me.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/misc/mei/hw-me-regs.h +2 -0
@@ -115,6 +115,8 @@#define MEI_DEV_ID_ARL_S 0x7F68/* Arrow Lake Point S */ #define MEI_DEV_ID_ARL_H 0x7770/* Arrow Lake Point H */ +#define MEI_DEV_ID_LNL_M 0xA870/* Lunar Lake Point M */ +/* * MEI HW Section */
drivers/misc/mei/pci-me.c +2 -0
@@ -122,6 +122,8 @@ static const struct pci_device_id mei_me {MEI_PCI_DEVICE(MEI_DEV_ID_ARL_S, MEI_ME_PCH15_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_ARL_H, MEI_ME_PCH15_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_LNL_M, MEI_ME_PCH15_CFG)}, +/* required last entry */ {0, } };
Greg Kroah-Hartman
maintainerPATCH 266/301 drm/nouveau/firmware: Fix SG_DEBUG error with nvkm_firmware_ctor()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lyude Paul <[email protected]>
commit 52a6947bf576b97ff8e14bb0a31c5eaf2d0d96e2 upstream.
Currently, enabling SG_DEBUG in the kernel will cause nouveau to hit a BUG() on startup:
kernel BUG at include/linux/scatterlist.h:187!
invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
CPU: 7 PID: 930 Comm: (udev-worker) Not tainted 6.9.0-rc3Lyude-Test+ #30 Hardware name: MSI MS-7A39/A320M GAMING PRO (MS-7A39), BIOS 1.I0 01/22/2019 RIP: 0010:sg_init_one+0x85/0xa0 Code: 69 88 32 01 83 e1 03 f6 c3 03 75 20 a8 01 75 1e 48 09 cb 41 89 54 24 08 49 89 1c 24 41 89 6c 24 0c 5b 5d 41 5c e9 7b b9 88 00 <0f> 0b 0f 0b 0f 0b 48 8b 05 5e 46 9a 01 eb b2 66 66 2e 0f 1f 84 00 RSP: 0018:ffffa776017bf6a0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffffa77600d87000 RCX: 000000000000002b RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffffa77680d87000 RBP: 000000000000e000 R08: 0000000000000000 R09: 0000000000000000 R10: ffff98f4c46aa508 R11: 0000000000000000 R12: ffff98f4c46aa508 R13: ffff98f4c46aa008 R14: ffffa77600d4a000 R15: ffffa77600d4a018 FS: 00007feeb5aae980(0000) GS:ffff98f5c4dc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f22cb9a4520 CR3: 00000001043ba000 CR4: 00000000003506f0 Call Trace: <TASK> ? die+0x36/0x90 ? do_trap+0xdd/0x100 ? sg_init_one+0x85/0xa0 ? do_error_trap+0x65/0x80 ? sg_init_one+0x85/0xa0 ? exc_invalid_op+0x50/0x70 ? sg_init_one+0x85/0xa0 ? asm_exc_invalid_op+0x1a/0x20 ? sg_init_one+0x85/0xa0 nvkm_firmware_ctor+0x14a/0x250 [nouveau] nvkm_falcon_fw_ctor+0x42/0x70 [nouveau] ga102_gsp_booter_ctor+0xb4/0x1a0 [nouveau] r535_gsp_oneinit+0xb3/0x15f0 [nouveau] ? srso_return_thunk+0x5/0x5f ? srso_return_thunk+0x5/0x5f ? nvkm_udevice_new+0x95/0x140 [nouveau] ? srso_return_thunk+0x5/0x5f ? srso_return_thunk+0x5/0x5f ? ktime_get+0x47/0xb0 ? srso_return_thunk+0x5/0x5f nvkm_subdev_oneinit_+0x4f/0x120 [nouveau] nvkm_subdev_init_+0x39/0x140 [nouveau] ? srso_return_thunk+0x5/0x5f nvkm_subdev_init+0x44/0x90 [nouveau] nvkm_device_init+0x166/0x2e0 [nouveau] nvkm_udevice_init+0x47/0x70 [nouveau] nvkm_object_init+0x41/0x1c0 [nouveau] nvkm_ioctl_new+0x16a/0x290 [nouveau] ? __pfx_nvkm_client_child_new+0x10/0x10 [nouveau] ? __pfx_nvkm_udevice_new+0x10/0x10 [nouveau] nvkm_ioctl+0x126/0x290 [nouveau] nvif_object_ctor+0x112/0x190 [nouveau] nvif_device_ctor+0x23/0x60 [nouveau] nouveau_cli_init+0x164/0x640 [nouveau] nouveau_drm_device_init+0x97/0x9e0 [nouveau] ? srso_return_thunk+0x5/0x5f ? pci_update_current_state+0x72/0xb0 ? srso_return_thunk+0x5/0x5f nouveau_drm_probe+0x12c/0x280 [nouveau] ? srso_return_thunk+0x5/0x5f local_pci_probe+0x45/0xa0 pci_device_probe+0xc7/0x270 really_probe+0xe6/0x3a0 __driver_probe_device+0x87/0x160 driver_probe_device+0x1f/0xc0 __driver_attach+0xec/0x1f0 ? __pfx___driver_attach+0x10/0x10 bus_for_each_dev+0x88/0xd0 bus_add_driver+0x116/0x220 driver_register+0x59/0x100 ? __pfx_nouveau_drm_init+0x10/0x10 [nouveau] do_one_initcall+0x5b/0x320 do_init_module+0x60/0x250 init_module_from_file+0x86/0xc0 idempotent_init_module+0x120/0x2b0 __x64_sys_finit_module+0x5e/0xb0 do_syscall_64+0x83/0x160 ? srso_return_thunk+0x5/0x5f entry_SYSCALL_64_after_hwframe+0x71/0x79 RIP: 0033:0x7feeb5cc20cd 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 1b cd 0c 00 f7 d8 64 89 01 48 RSP: 002b:00007ffcf220b2c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 000055fdd2916aa0 RCX: 00007feeb5cc20cd RDX: 0000000000000000 RSI: 000055fdd29161e0 RDI: 0000000000000035 RBP: 00007ffcf220b380 R08: 00007feeb5d8fb20 R09: 00007ffcf220b310 R10: 000055fdd2909dc0 R11: 0000000000000246 R12: 000055fdd29161e0 R13: 0000000000020000 R14: 000055fdd29203e0 R15: 000055fdd2909d80 </TASK>
We hit this when trying to initialize firmware of type NVKM_FIRMWARE_IMG_DMA because we allocate our memory with dma_alloc_coherent, and DMA allocations can't be turned back into memory pages - which a scatterlist needs in order to map them.
So, fix this by allocating the memory with vmalloc instead().
V2:
* Fixup explanation as the prior one was bogus
--- drivers/gpu/drm/nouveau/nvkm/core/firmware.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/gpu/drm/nouveau/nvkm/core/firmware.c +12 -7
@@ -187,7 +187,9 @@ nvkm_firmware_dtor(struct nvkm_firmwarebreak ;case NVKM_FIRMWARE_IMG_DMA :nvkm_memory_unref (&memory); -dma_free_coherent (fw->device->dev,sg_dma_len (&fw->mem.sgl), fw->img, fw->phys); +dma_unmap_single (fw->device->dev, fw->phys,sg_dma_len (&fw->mem.sgl), +DMA_TO_DEVICE ); +kfree (fw->img);break ;default :WARN_ON (1 );
@@ -211,14 +213,17 @@ nvkm_firmware_ctor(const struct nvkm_fir fw->img =kmemdup (src, fw->len,GFP_KERNEL );break ;case NVKM_FIRMWARE_IMG_DMA : { -dma_addr_t addr; - len =ALIGN (fw->len,PAGE_SIZE ); - fw->img =dma_alloc_coherent (fw->device->dev, len, &addr,GFP_KERNEL ); -if (fw->img) { -memcpy (fw->img, src, fw->len); - fw->phys = addr; + fw->img =kmalloc (len,GFP_KERNEL ); +if (!fw->img) +return -ENOMEM ; + +memcpy (fw->img, src, fw->len); + fw->phys =dma_map_single (fw->device->dev, fw->img, len,DMA_TO_DEVICE ); +if (dma_mapping_error (fw->device->dev, fw->phys)) { +kfree (fw->img); +return -EFAULT ; }sg_init_one (&fw->mem.sgl, fw->img, len);
Greg Kroah-Hartman
maintainerPATCH 267/301 Revert "drm/nouveau/firmware: Fix SG_DEBUG error with nvkm_firmware_ctor()"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit a222a6470d7eea91193946e8162066fa88da64c2 upstream.
This reverts commit 52a6947bf576b97ff8e14bb0a31c5eaf2d0d96e2.
This causes loading failures in
[ 0.367379] nouveau 0000:01:00.0: NVIDIA GP104 (134000a1) [ 0.474499] nouveau 0000:01:00.0: bios: version 86.04.50.80.13 [ 0.474620] nouveau 0000:01:00.0: pmu: firmware unavailable [ 0.474977] nouveau 0000:01:00.0: fb: 8192 MiB GDDR5 [ 0.484371] nouveau 0000:01:00.0: sec2(acr): mbox 00000001 00000000 [ 0.484377] nouveau 0000:01:00.0: sec2(acr):load: boot failed: -5 [ 0.484379] nouveau 0000:01:00.0: acr: init failed, -5 [ 0.484466] nouveau 0000:01:00.0: init failed with -5 [ 0.484468] nouveau: DRM-master:00000000:00000080: init failed with -5 [ 0.484470] nouveau 0000:01:00.0: DRM-master: Device allocation failed: -5 [ 0.485078] nouveau 0000:01:00.0: probe with driver nouveau failed with error -50
I tried tracking it down but ran out of time this week, will revisit next week.
--- drivers/gpu/drm/nouveau/nvkm/core/firmware.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/gpu/drm/nouveau/nvkm/core/firmware.c +7 -12
@@ -187,9 +187,7 @@ nvkm_firmware_dtor(struct nvkm_firmwarebreak ;case NVKM_FIRMWARE_IMG_DMA :nvkm_memory_unref (&memory); -dma_unmap_single (fw->device->dev, fw->phys,sg_dma_len (&fw->mem.sgl), -DMA_TO_DEVICE ); -kfree (fw->img); +dma_free_coherent (fw->device->dev,sg_dma_len (&fw->mem.sgl), fw->img, fw->phys);break ;default :WARN_ON (1 );
@@ -213,17 +211,14 @@ nvkm_firmware_ctor(const struct nvkm_fir fw->img =kmemdup (src, fw->len,GFP_KERNEL );break ;case NVKM_FIRMWARE_IMG_DMA : { +dma_addr_t addr; + len =ALIGN (fw->len,PAGE_SIZE ); - fw->img =kmalloc (len,GFP_KERNEL ); -if (!fw->img) -return -ENOMEM ; - -memcpy (fw->img, src, fw->len); - fw->phys =dma_map_single (fw->device->dev, fw->img, len,DMA_TO_DEVICE ); -if (dma_mapping_error (fw->device->dev, fw->phys)) { -kfree (fw->img); -return -EFAULT ; + fw->img =dma_alloc_coherent (fw->device->dev, len, &addr,GFP_KERNEL ); +if (fw->img) { +memcpy (fw->img, src, fw->len); + fw->phys = addr; }sg_init_one (&fw->mem.sgl, fw->img, len);
Re: [PATCH 6.6 267/301] Revert "drm/nouveau/firmware: Fix SG_DEBUG error with nvkm_firmware_ctor()"
Quoted 1 line · Greg Kroah-Hartman
6.6-stable review patch. If anyone has any objections, please let me know.
A little bit strange situation to add and revert commit in the same stable release.
Is it intentional? Or some scripts should be updated to avoid that?
--
Alexey Khoroshilov
Linux Verification Center, ISPRAS
Greg Kroah-Hartman
maintainerRe: [PATCH 6.6 267/301] Revert "drm/nouveau/firmware: Fix SG_DEBUG error with nvkm_firmware_ctor()"
Quoted 7 lines · Alexey Khoroshilov
Quoted 1 line · Greg Kroah-Hartman
6.6-stable review patch. If anyone has any objections, please let me know.
A little bit strange situation to add and revert commit in the same stable release.
Is it intentional? Or some scripts should be updated to avoid that?
Totally intentional, otherwise we would notice that the original commit was not applied later on and try to apply it there again.
thanks,
greg k-h
Re: [PATCH 6.6 267/301] Revert "drm/nouveau/firmware: Fix SG_DEBUG error with nvkm_firmware_ctor()"
Quoted 11 lines · Greg Kroah-Hartman
Quoted 7 lines · Alexey Khoroshilov
Quoted 1 line · Greg Kroah-Hartman
6.6-stable review patch. If anyone has any objections, please let me know.
A little bit strange situation to add and revert commit in the same stable release.
Is it intentional? Or some scripts should be updated to avoid that?
Totally intentional, otherwise we would notice that the original commit was not applied later on and try to apply it there again.
Thank you for the clarification!
--
Alexey
Greg Kroah-Hartman
maintainerPATCH 268/301 drm/amdkfd: dont allow mapping the MMIO HDP page with large pages
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit be4a2a81b6b90d1a47eaeaace4cc8e2cb57b96c7 upstream.
We don't get the right offset in that case. The GPU has an unused 4K area of the register BAR space into which you can remap registers. We remap the HDP flush registers into this space to allow userspace (CPU or GPU) to flush the HDP when it updates VRAM. However, on systems with >4K pages, we end up exposing PAGE_SIZE of MMIO space.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +5 -2
@@ -1138,7 +1138,7 @@ static int kfd_ioctl_alloc_memory_of_gpu goto err_unlock; } offset = dev->adev->rmmio_remap.bus_addr; -if (!offset) { +if (!offset || (PAGE_SIZE >4096 )) { err = -ENOMEM ; goto err_unlock; }
@@ -2307,7 +2307,7 @@ static int criu_restore_memory_of_gpu(streturn -EINVAL ; } offset = pdd->dev->adev->rmmio_remap.bus_addr; -if (!offset) { +if (!offset || (PAGE_SIZE >4096 )) {pr_err ("amdgpu_amdkfd_get_mmio_remap_phys_addr failed\n" );return -ENOMEM ; }
@@ -3348,6 +3348,9 @@ static int kfd_mmio_mmap(struct kfd_nodeif (vma->vm_end - vma->vm_start !=PAGE_SIZE )return -EINVAL ; +if (PAGE_SIZE >4096 ) +return -EINVAL ; + address = dev->adev->rmmio_remap.bus_addr; vm_flags_set(vma, VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_NORESERVE |
Greg Kroah-Hartman
maintainerPATCH 269/301 drm/ttm: Print the memory decryption status just once
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <[email protected]>
commit 27906e5d78248b19bcdfdae72049338c828897bb upstream.
Stop printing the TT memory decryption status info each time tt is created and instead print it just once.
Reduces the spam in the system logs when running guests with SEV enabled.
--- drivers/gpu/drm/ttm/ttm_tt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_tt.c +1 -1
@@ -92,7 +92,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)*/ if (bdev->pool.use_dma_alloc &&cc_platform_has (CC_ATTR_GUEST_MEM_ENCRYPT )) { page_flags |=TTM_TT_FLAG_DECRYPTED ; -drm_info (ddev,"TT memory decryption enabled." ); +drm_info_once (ddev,"TT memory decryption enabled." ); } bo->ttm = bdev->funcs->ttm_tt_create (bo, page_flags);
Signature · 1 line
2.45.0
Greg Kroah-Hartman
maintainerPATCH 270/301 drm/vmwgfx: Fix Legacy Display Unit
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Forbes <[email protected]>
commit 782e5e7925880f737963444f141a0320a12104a5 upstream.
Legacy DU was broken by the referenced fixes commit because the placement and the busy_placement no longer pointed to the same object. This was later fixed indirectly by commit a78a8da51b36c7a0c0c16233f91d60aac03a5a49 ("drm/ttm: replace busy placement with flags v6") in v6.9.
--- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +1 -0
@@ -204,6 +204,7 @@ int vmw_bo_pin_in_start_of_vram(struct vmw_private *dev_priv,VMW_BO_DOMAIN_VRAM , VMW_BO_DOMAIN_VRAM); buf->places[0 ].lpfn =PFN_UP (bo->resource->size); + buf->busy_places[0 ].lpfn =PFN_UP (bo->resource->size); ret =ttm_bo_validate (bo, &buf->placement, &ctx);/* For some reason we didn't end up at the start of vram */
Signature · 1 line
2.45.0
Greg Kroah-Hartman
maintainerPATCH 271/301 drm/vmwgfx: Fix invalid reads in fence signaled events
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <[email protected]>
commit a37ef7613c00f2d72c8fc08bd83fb6cc76926c8c upstream.
Correctly set the length of the drm_event to the size of the structure that's actually used.
The length of the drm_event was set to the parent structure instead of to the drm_vmw_event_fence which is supposed to be read. drm_read uses the length parameter to copy the event to the user space thus resuling in oob reads.
--- drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +1 -1
@@ -991,7 +991,7 @@ static int vmw_event_fence_action_create } event->event.base.type =DRM_VMW_EVENT_FENCE_SIGNALED ; - event->event.base.length =sizeof (*event); + event->event.base.length =sizeof (event->event); event->event.user_data = user_data; ret =drm_event_reserve_init (dev, file_priv, &event->base, &event->event.base);
Greg Kroah-Hartman
maintainerPATCH 272/301 drm/i915/audio: Fix audio time stamp programming for DP
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chaitanya Kumar Borah <[email protected]>
commit c66b8356273c8d22498f88e4223af47a7bf8a23c upstream.
Intel hardware is capable of programming the Maud/Naud SDPs on its own based on real-time clocks. While doing so, it takes care of any deviations from the theoretical values. Programming the registers explicitly with static values can interfere with this logic. Therefore, let the HW decide the Maud and Naud SDPs on it's own.
--- drivers/gpu/drm/i915/display/intel_audio.c | 113 ++--------------------------- 1 file changed, 8 insertions(+), 105 deletions(-)
drivers/gpu/drm/i915/display/intel_audio.c +8 -105
@@ -75,19 +75,6 @@ struct intel_audio_funcs { struct intel_crtc_state *crtc_state); }; -/* DP N/M table */ -#define LC_810M 810000 -#define LC_540M 540000 -#define LC_270M 270000 -#define LC_162M 162000 - -struct dp_aud_n_m { -int sample_rate; -int clock; -u16 m; -u16 n; -}; -struct hdmi_aud_ncts {int sample_rate;int clock;
@@ -95,60 +82,6 @@ struct hdmi_aud_ncts {int cts; }; -/* Values according to DP 1.4 Table 2-104 */ -static const struct dp_aud_n_m dp_aud_n_m[] = { - {32000 ,LC_162M ,1024 ,10125 }, - {44100 ,LC_162M ,784 ,5625 }, - {48000 ,LC_162M ,512 ,3375 }, - {64000 ,LC_162M ,2048 ,10125 }, - {88200 ,LC_162M ,1568 ,5625 }, - {96000 ,LC_162M ,1024 ,3375 }, - {128000 ,LC_162M ,4096 ,10125 }, - {176400 ,LC_162M ,3136 ,5625 }, - {192000 ,LC_162M ,2048 ,3375 }, - {32000 ,LC_270M ,1024 ,16875 }, - {44100 ,LC_270M ,784 ,9375 }, - {48000 ,LC_270M ,512 ,5625 }, - {64000 ,LC_270M ,2048 ,16875 }, - {88200 ,LC_270M ,1568 ,9375 }, - {96000 ,LC_270M ,1024 ,5625 }, - {128000 ,LC_270M ,4096 ,16875 }, - {176400 ,LC_270M ,3136 ,9375 }, - {192000 ,LC_270M ,2048 ,5625 }, - {32000 ,LC_540M ,1024 ,33750 }, - {44100 ,LC_540M ,784 ,18750 }, - {48000 ,LC_540M ,512 ,11250 }, - {64000 ,LC_540M ,2048 ,33750 }, - {88200 ,LC_540M ,1568 ,18750 }, - {96000 ,LC_540M ,1024 ,11250 }, - {128000 ,LC_540M ,4096 ,33750 }, - {176400 ,LC_540M ,3136 ,18750 }, - {192000 ,LC_540M ,2048 ,11250 }, - {32000 ,LC_810M ,1024 ,50625 }, - {44100 ,LC_810M ,784 ,28125 }, - {48000 ,LC_810M ,512 ,16875 }, - {64000 ,LC_810M ,2048 ,50625 }, - {88200 ,LC_810M ,1568 ,28125 }, - {96000 ,LC_810M ,1024 ,16875 }, - {128000 ,LC_810M ,4096 ,50625 }, - {176400 ,LC_810M ,3136 ,28125 }, - {192000 ,LC_810M ,2048 ,16875 }, -}; - -static const struct dp_aud_n_m * -audio_config_dp_get_n_m (const struct intel_crtc_state *crtc_state,int rate) -{ -int i; - -for (i =0 ; i <ARRAY_SIZE (dp_aud_n_m); i++) { -if (rate == dp_aud_n_m[i].sample_rate && - crtc_state->port_clock == dp_aud_n_m[i].clock) -return &dp_aud_n_m[i]; - } - -return NULL ; -} - static const struct { int clock; u32 config;
@@ -386,47 +319,17 @@ hsw_dp_audio_config_update(struct intel_ const struct intel_crtc_state *crtc_state) {struct drm_i915_private *i915 =to_i915 (encoder->base.dev); -struct i915_audio_component *acomp = i915->display.audio.component;enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; -enum port port = encoder->port; -const struct dp_aud_n_m *nm; -int rate; -u32 tmp; - rate = acomp ? acomp->aud_sample_rate[port] :0 ; - nm =audio_config_dp_get_n_m (crtc_state, rate); -if (nm) -drm_dbg_kms (&i915->drm,"using Maud %u, Naud %u\n" , nm->m, - nm->n); -else -drm_dbg_kms (&i915->drm,"using automatic Maud, Naud\n" ); - - tmp =intel_de_read (i915,HSW_AUD_CFG (cpu_transcoder)); - tmp &= ~AUD_CONFIG_N_VALUE_INDEX ; - tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK ; - tmp &= ~AUD_CONFIG_N_PROG_ENABLE ; - tmp |=AUD_CONFIG_N_VALUE_INDEX ; - -if (nm) { - tmp &= ~AUD_CONFIG_N_MASK ; - tmp |=AUD_CONFIG_N (nm->n); - tmp |=AUD_CONFIG_N_PROG_ENABLE ; - } - -intel_de_write (i915,HSW_AUD_CFG (cpu_transcoder), tmp); - - tmp =intel_de_read (i915,HSW_AUD_M_CTS_ENABLE (cpu_transcoder)); - tmp &= ~AUD_CONFIG_M_MASK ; - tmp &= ~AUD_M_CTS_M_VALUE_INDEX ; - tmp &= ~AUD_M_CTS_M_PROG_ENABLE ; - -if (nm) { - tmp |= nm->m; - tmp |=AUD_M_CTS_M_VALUE_INDEX ; - tmp |=AUD_M_CTS_M_PROG_ENABLE ; - } +/* Enable time stamps. Let HW calculate Maud/Naud values */ +intel_de_rmw (i915,HSW_AUD_CFG (cpu_transcoder), +AUD_CONFIG_N_VALUE_INDEX | +AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK | +AUD_CONFIG_UPPER_N_MASK | +AUD_CONFIG_LOWER_N_MASK | +AUD_CONFIG_N_PROG_ENABLE , +AUD_CONFIG_N_VALUE_INDEX ); -intel_de_write (i915,HSW_AUD_M_CTS_ENABLE (cpu_transcoder), tmp); } static void
Greg Kroah-Hartman
maintainerPATCH 273/301 drm/i915/gt: Automate CCS Mode setting during engine resets
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andi Shyti <[email protected]>
commit 51c1b42a232f17743cd825be6790cb64735ff98f upstream.
We missed setting the CCS mode during resume and engine resets. Create a workaround to be added in the engine's workaround list. This workaround sets the XEHP_CCS_MODE value at every reset.
The issue can be reproduced by running:
$ clpeak --kernel-latency
Without resetting the CCS mode, we encounter a fence timeout:
Fence expiration time out i915-0000:03:00.0:clpeak[2387]:2!
--- drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c | 6 +++--- drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.h | 2 +- drivers/gpu/drm/i915/gt/intel_workarounds.c | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c +3 -3
@@ -8,14 +8,14 @@#include "intel_gt_ccs_mode.h" #include "intel_gt_regs.h" -void intel_gt_apply_ccs_mode (struct intel_gt *gt) +unsigned int intel_gt_apply_ccs_mode (struct intel_gt *gt) {int cslice;u32 mode =0 ;int first_ccs =__ffs (CCS_MASK (gt));if (!IS_DG2 (gt->i915)) -return ; +return 0 ;/* Build the value for the fixed CCS load balancing */ for (cslice =0 ; cslice <I915_MAX_CCS ; cslice++) {
@@ -35,5 +35,5 @@ void intel_gt_apply_ccs_mode(struct inte XEHP_CCS_MODE_CSLICE_MASK); } -intel_uncore_write (gt->uncore,XEHP_CCS_MODE , mode); +return mode; }
drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.h +1 -1
@@ -8,6 +8,6 @@struct intel_gt ; -void intel_gt_apply_ccs_mode (struct intel_gt *gt); +unsigned int intel_gt_apply_ccs_mode (struct intel_gt *gt);#endif /* __INTEL_GT_CCS_MODE_H__ */
drivers/gpu/drm/i915/gt/intel_workarounds.c +3 -1
@@ -2828,6 +2828,7 @@ add_render_compute_tuning_settings(strucstatic void ccs_engine_wa_mode (struct intel_engine_cs *engine,struct i915_wa_list *wal) {struct intel_gt *gt = engine->gt; +u32 mode;if (!IS_DG2 (gt->i915))return ;
@@ -2844,7 +2845,8 @@ static void ccs_engine_wa_mode(struct in* After having disabled automatic load balancing we need to * assign all slices to a single CCS. We will call it CCS mode 1 */ -intel_gt_apply_ccs_mode (gt); + mode =intel_gt_apply_ccs_mode (gt); +wa_masked_en (wal,XEHP_CCS_MODE , mode); }/*
Greg Kroah-Hartman
maintainerPATCH 274/301 drm/i915/bios: Fix parsing backlight BDB data
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karthikeyan Ramasubramanian <[email protected]>
commit 43b26bdd2ee5cfca80939be910d5b23a50cd7f9d upstream.
Starting BDB version 239, hdr_dpcd_refresh_timeout is introduced to backlight BDB data. Commit 700034566d68 ("drm/i915/bios: Define more BDB contents") updated the backlight BDB data accordingly. This broke the parsing of backlight BDB data in VBT for versions 236 - 238 (both inclusive) and hence the backlight controls are not responding on units with the concerned BDB version.
backlight_control information has been present in backlight BDB data from at least BDB version 191 onwards, if not before. Hence this patch extracts the backlight_control information for BDB version 191 or newer. Tested on Chromebooks using Jasperlake SoC (reports bdb->version = 236). Tested on Chromebooks using Raptorlake SoC (reports bdb->version = 251).
v2: removed checking the block size of the backlight BDB data
[vsyrjala: this is completely safe thanks to commit e163cfb4c96d
("drm/i915/bios: Make copies of VBT data blocks")]
--- drivers/gpu/drm/i915/display/intel_bios.c | 19 ++++--------------- drivers/gpu/drm/i915/display/intel_vbt_defs.h | 5 ----- 2 files changed, 4 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +4 -15
@@ -1035,22 +1035,11 @@ parse_lfp_backlight(struct drm_i915_priv panel->vbt.backlight.type =INTEL_BACKLIGHT_DISPLAY_DDI ; panel->vbt.backlight.controller =0 ;if (i915->display.vbt.version >=191 ) { -size_t exp_size; +const struct lfp_backlight_control_method *method; -if (i915->display.vbt.version >=236 ) - exp_size =sizeof (struct bdb_lfp_backlight_data ); -else if (i915->display.vbt.version >=234 ) - exp_size =EXP_BDB_LFP_BL_DATA_SIZE_REV_234 ; -else - exp_size =EXP_BDB_LFP_BL_DATA_SIZE_REV_191 ; - -if (get_blocksize (backlight_data) >= exp_size) { -const struct lfp_backlight_control_method *method; - - method = &backlight_data->backlight_control[panel_type]; - panel->vbt.backlight.type = method->type; - panel->vbt.backlight.controller = method->controller; - } + method = &backlight_data->backlight_control[panel_type]; + panel->vbt.backlight.type = method->type; + panel->vbt.backlight.controller = method->controller; } panel->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz;
drivers/gpu/drm/i915/display/intel_vbt_defs.h +0 -5
@@ -897,11 +897,6 @@ struct lfp_brightness_level {u16 reserved; } __packed; -#define EXP_BDB_LFP_BL_DATA_SIZE_REV_191 \ - offsetof(struct bdb_lfp_backlight_data, brightness_level) -#define EXP_BDB_LFP_BL_DATA_SIZE_REV_234 \ - offsetof(struct bdb_lfp_backlight_data, brightness_precision_bits) -struct bdb_lfp_backlight_data {u8 entry_size;struct lfp_backlight_data_entry data[16 ];
Greg Kroah-Hartman
maintainerPATCH 275/301 drm/amd/display: Handle Y carry-over in VCP X.Y calculation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: George Shen <[email protected]>
commit 719564737a9ac3d0b49c314450b56cf6f7d71358 upstream.
Theoretically rare corner case where ceil(Y) results in rounding up to an integer. If this happens, the 1 should be carried over to the X value.
--- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_link_encoder.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_link_encoder.c +6 -0
@@ -395,6 +395,12 @@ void dcn31_hpo_dp_link_enc_set_throttled x), 25)); +// If y rounds up to integer, carry it over to x. +if (y >>25 ) { + x +=1 ; + y =0 ; + } +switch (stream_encoder_inst) {case 0 : REG_SET_2(DP_DPHY_SYM32_VC_RATE_CNTL0, 0,
Greg Kroah-Hartman
maintainerPATCH 276/301 drm/amd/display: Fix incorrect DSC instance for MST
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hersen Wu <[email protected]>
commit 892b41b16f6163e6556545835abba668fcab4eea upstream.
[Why] DSC debugfs, such as dp_dsc_clock_en_read, use aconnector->dc_link to find pipe_ctx for display. Displays connected to MST hub share the same dc_link. DSC instance is from pipe_ctx. This causes incorrect DSC instance for display connected to MST hub.
[How] Add aconnector->sink check to find pipe_ctx.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 48 ++++++++++---- 1 file changed, 36 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +36 -12
@@ -1465,7 +1465,9 @@ static ssize_t dp_dsc_clock_en_read(strufor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -1566,7 +1568,9 @@ static ssize_t dp_dsc_clock_en_write(strfor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -1651,7 +1655,9 @@ static ssize_t dp_dsc_slice_width_read(sfor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -1750,7 +1756,9 @@ static ssize_t dp_dsc_slice_width_write(for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -1835,7 +1843,9 @@ static ssize_t dp_dsc_slice_height_read(for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -1934,7 +1944,9 @@ static ssize_t dp_dsc_slice_height_writefor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -2015,7 +2027,9 @@ static ssize_t dp_dsc_bits_per_pixel_reafor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -2111,7 +2125,9 @@ static ssize_t dp_dsc_bits_per_pixel_wrifor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -2190,7 +2206,9 @@ static ssize_t dp_dsc_pic_width_read(strfor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -2246,7 +2264,9 @@ static ssize_t dp_dsc_pic_height_read(stfor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -2317,7 +2337,9 @@ static ssize_t dp_dsc_chunk_size_read(stfor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
@@ -2388,7 +2410,9 @@ static ssize_t dp_dsc_slice_bpg_offset_rfor (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && - pipe_ctx->stream->link == aconnector->dc_link) + pipe_ctx->stream->link == aconnector->dc_link && + pipe_ctx->stream->sink && + pipe_ctx->stream->sink == aconnector->dc_sink)break ; }
Greg Kroah-Hartman
maintainerPATCH 277/301 arm64: dts: qcom: sa8155p-adp: fix SDHC2 CD pin configuration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Volodymyr Babchuk <[email protected]>
commit 819fe8c96a5172dfd960e5945e8f00f8fed32953 upstream.
There are two issues with SDHC2 configuration for SA8155P-ADP, which prevent use of SDHC2 and causes issues with ethernet:
- Card Detect pin for SHDC2 on SA8155P-ADP is connected to gpio4 of PMM8155AU_1, not to SoC itself. SoC's gpio4 is used for DWMAC TX. If sdhc driver probes after dwmac driver, it reconfigures gpio4 and this breaks Ethernet MAC.
- pinctrl configuration mentions gpio96 as CD pin. It seems it was copied from some SM8150 example, because as mentioned above, correct CD pin is gpio4 on PMM8155AU_1.
This patch fixes both mentioned issues by providing correct pin handle and pinctrl configuration.
--- arch/arm64/boot/dts/qcom/sa8155p-adp.dts | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
arch/arm64/boot/dts/qcom/sa8155p-adp.dts +13 -17
@@ -367,6 +367,16 @@ }; }; +&pmm8155au_1_gpios { + pmm8155au_1_sdc2_cd: sdc2-cd-default-state { + pins = "gpio4"; + function = "normal"; + input-enable; + bias-pull-up; + power-source = <0>; + }; +}; + &qupv3_id_1 { status = "okay"; };
@@ -384,10 +394,10 @@ &sdhc_2 { status = "okay"; - cd-gpios = <&tlmm 4 GPIO_ACTIVE_LOW>; + cd-gpios = <&pmm8155au_1_gpios 4 GPIO_ACTIVE_LOW>; pinctrl-names = "default", "sleep"; - pinctrl-0 = <&sdc2_on>; - pinctrl-1 = <&sdc2_off>; + pinctrl-0 = <&sdc2_on &pmm8155au_1_sdc2_cd>; + pinctrl-1 = <&sdc2_off &pmm8155au_1_sdc2_cd>; vqmmc-supply = <&vreg_l13c_2p96>; /* IO line power */ vmmc-supply = <&vreg_l17a_2p96>; /* Card power line */ bus-width = <4>;
@@ -505,13 +515,6 @@ bias-pull-up; /* pull up */ drive-strength = <16>; /* 16 MA */ }; - - sd-cd-pins { - pins = "gpio96"; - function = "gpio"; - bias-pull-up; /* pull up */ - drive-strength = <2>; /* 2 MA */ - }; }; sdc2_off: sdc2-off-state {
@@ -532,13 +535,6 @@ bias-pull-up; /* pull up */ drive-strength = <2>; /* 2 MA */ }; - - sd-cd-pins { - pins = "gpio96"; - function = "gpio"; - bias-pull-up; /* pull up */ - drive-strength = <2>; /* 2 MA */ - }; }; usb2phy_ac_en1_default: usb2phy-ac-en1-default-state {