6.17.13-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 127/507 soc: qcom: smem: fix hwspinlock resource leak in probe error paths
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit dc5db35073a19f6d3c30bea367b551c1a784ef8f ]
The hwspinlock acquired via hwspin_lock_request_specific() is not released on several error paths. This results in resource leakage when probe fails.
Switch to devm_hwspin_lock_request_specific() to automatically handle cleanup on probe failure. Remove the manual hwspin_lock_free() in qcom_smem_remove() as devm handles it automatically.
--- drivers/soc/qcom/smem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/soc/qcom/smem.c +1 -2
@@ -1190,7 +1190,7 @@ static int qcom_smem_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev, hwlock_id,"failed to retrieve hwlock\n" ); - smem->hwlock =hwspin_lock_request_specific (hwlock_id); + smem->hwlock =devm_hwspin_lock_request_specific (&pdev->dev, hwlock_id);if (!smem->hwlock)return -ENXIO ;
@@ -1243,7 +1243,6 @@ static void qcom_smem_remove(struct platform_device *pdev) {platform_device_unregister (__smem->socinfo); -hwspin_lock_free (__smem->hwlock); __smem =NULL ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 128/507 pinctrl: stm32: fix hwspinlock resource leak in probe function
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 002679f79ed605e543fbace465557317cd307c9a ]
In stm32_pctl_probe(), hwspin_lock_request_specific() is called to request a hwspinlock, but the acquired lock is not freed on multiple error paths after this call. This causes resource leakage when the function fails to initialize properly.
Use devm_hwspin_lock_request_specific() instead of hwspin_lock_request_specific() to automatically manage the hwspinlock resource lifecycle.
--- drivers/pinctrl/stm32/pinctrl-stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/stm32/pinctrl-stm32.c +1 -1
@@ -1671,7 +1671,7 @@ int stm32_pctl_probe(struct platform_device *pdev)if (hwlock_id == -EPROBE_DEFER )return hwlock_id; }else { - pctl->hwlock =hwspin_lock_request_specific (hwlock_id); + pctl->hwlock =devm_hwspin_lock_request_specific (dev, hwlock_id); }spin_lock_init (&pctl->irqmux_lock);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 129/507 drm: nova: select NOVA_CORE
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danilo Krummrich <[email protected]>
[ Upstream commit 97ad568cd6a58804129ba071f3258b5c4782fb0d ]
The nova-drm driver does not provide any value without nova-core being selected as well, hence select NOVA_CORE.
--- drivers/gpu/drm/nova/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/nova/Kconfig +1 -0
@@ -4,6 +4,7 @@ config DRM_NOVA depends on PCI depends on RUST select AUXILIARY_BUS + select NOVA_CORE default n help Choose this if you want to build the Nova DRM driver for Nvidia
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 130/507 accel/ivpu: Fix race condition when unbinding BOs
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Rusinowicz <[email protected]>
[ Upstream commit 00812636df370bedf4e44a0c81b86ea96bca8628 ]
Fix 'Memory manager not clean during takedown' warning that occurs when ivpu_gem_bo_free() removes the BO from the BOs list before it gets unmapped. Then file_priv_unbind() triggers a warning in drm_mm_takedown() during context teardown.
Protect the unmapping sequence with bo_list_lock to ensure the BO is always fully unmapped when removed from the list. This ensures the BO is either fully unmapped at context teardown time or present on the list and unmapped by file_priv_unbind().
--- drivers/accel/ivpu/ivpu_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_gem.c +2 -1
@@ -314,7 +314,6 @@ static void ivpu_gem_bo_free(struct drm_gem_object *obj)mutex_lock (&vdev->bo_list_lock);list_del (&bo->bo_list_node); -mutex_unlock (&vdev->bo_list_lock);drm_WARN_ON (&vdev->drm, !drm_gem_is_imported (&bo->base.base) && !dma_resv_test_signaled (obj->resv,DMA_RESV_USAGE_READ ));
@@ -325,6 +324,8 @@ static void ivpu_gem_bo_free(struct drm_gem_object *obj)ivpu_bo_unbind_locked (bo);ivpu_bo_unlock (bo); +mutex_unlock (&vdev->bo_list_lock); +drm_WARN_ON (&vdev->drm, bo->mmu_mapped);drm_WARN_ON (&vdev->drm, bo->ctx);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 131/507 pidfs: add missing PIDFD_INFO_SIZE_VER1
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit 4061c43a99772c66c378cfacaa71550ab3b35909 ]
We grew struct pidfd_info not too long ago.
--- include/uapi/linux/pidfd.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/pidfd.h +1 -0
@@ -28,6 +28,7 @@#define PIDFD_INFO_COREDUMP (1UL << 4)/* Only returned if requested. */ #define PIDFD_INFO_SIZE_VER0 64/* sizeof first published struct */ +#define PIDFD_INFO_SIZE_VER1 72/* sizeof second published struct */ /* * Values for @coredump_mask in pidfd_info.
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 132/507 pidfs: add missing BUILD_BUG_ON() assert on struct pidfd_info
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit d8fc51d8fa3b9894713e7eebcf574bee488fa3e1 ]
Validate that the size of struct pidfd_info is correctly updated.
--- fs/pidfs.c | 2 ++ 1 file changed, 2 insertions(+)
fs/pidfs.c +2 -0
@@ -306,6 +306,8 @@ static long pidfd_info(struct file *file, unsigned int cmd, unsigned long arg)const struct cred *c;__u64 mask; +BUILD_BUG_ON (sizeof (struct pidfd_info ) !=PIDFD_INFO_SIZE_VER1 ); +if (!uinfo)return -EINVAL ;if (usize <PIDFD_INFO_SIZE_VER0 )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 133/507 i3c: fix refcount inconsistency in i3c_master_register
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit 9d4f219807d5ac11fb1d596e4ddb09336b040067 ]
In i3c_master_register, a possible refcount inconsistency has been identified, causing possible resource leak.
Function of_node_get increases the refcount of parent->of_node. If function i3c_bus_init fails, the function returns immediately without a corresponding decrease, resulting in an inconsistent refcounter.
Move call i3c_bus_init() after device_initialize() to let callback i3c_masterdev_release() release of_node.
--- drivers/i3c/master.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/i3c/master.c +4 -4
@@ -2811,10 +2811,6 @@ int i3c_master_register(struct i3c_master_controller *master,INIT_LIST_HEAD (&master->boardinfo.i2c);INIT_LIST_HEAD (&master->boardinfo.i3c); - ret =i3c_bus_init (i3cbus, master->dev.of_node); -if (ret) -return ret; -device_initialize (&master->dev);dev_set_name (&master->dev,"i3c-%d" , i3cbus->id);
@@ -2822,6 +2818,10 @@ int i3c_master_register(struct i3c_master_controller *master, master->dev.coherent_dma_mask = parent->coherent_dma_mask; master->dev.dma_parms = parent->dma_parms; + ret =i3c_bus_init (i3cbus, master->dev.of_node); +if (ret) + goto err_put_dev; + ret =of_populate_i3c_bus (master);if (ret) goto err_put_dev;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 134/507 i3c: master: svc: Prevent incomplete IBI transaction
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanley Chu <[email protected]>
[ Upstream commit 3a36273e5a07dda0ccec193800f3b78c3c0380af ]
If no free IBI slot is available, svc_i3c_master_handle_ibi returns immediately. This causes the STOP condition to be missed because the EmitStop request is sent when the transfer is not complete. To resolve this, svc_i3c_master_handle_ibi must wait for the transfer to complete before returning.
--- drivers/i3c/master/svc-i3c-master.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/i3c/master/svc-i3c-master.c +14 -8
@@ -406,21 +406,27 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master,int ret, val;u8 *buf; - slot =i3c_generic_ibi_get_free_slot (data->ibi_pool); -if (!slot) -return -ENOSPC ; - - slot->len =0 ; - buf = slot->data; - +/* +* Wait for transfer to complete before returning. Otherwise, the EmitStop +* request might be sent when the transfer is not complete. +*/ ret =readl_relaxed_poll_timeout (master->regs +SVC_I3C_MSTATUS , val,SVC_I3C_MSTATUS_COMPLETE (val),0 ,1000 );if (ret) {dev_err (master->dev,"Timeout when polling for COMPLETE\n" ); -i3c_generic_ibi_recycle_slot (data->ibi_pool, slot);return ret; } + slot =i3c_generic_ibi_get_free_slot (data->ibi_pool); +if (!slot) { +dev_dbg (master->dev,"No free ibi slot, drop the data\n" ); +writel (SVC_I3C_MDATACTRL_FLUSHRB , master->regs +SVC_I3C_MDATACTRL ); +return -ENOSPC ; + } + + slot->len =0 ; + buf = slot->data; +while (SVC_I3C_MSTATUS_RXPEND (readl (master->regs +SVC_I3C_MSTATUS )) && slot->len <SVC_I3C_FIFO_SIZE ) { mdatactrl =readl (master->regs +SVC_I3C_MDATACTRL );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 135/507 random: use offstack cpumask when necessary
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 5d49f1a5bd358d24e5f88b23b46da833de1dbec8 ]
The entropy generation function keeps a local cpu mask on the stack, which can trigger warnings in configurations with a large number of CPUs:
drivers/char/random.c:1292:20: error: stack frame size (1288) exceeds limit (1280) in 'try_to_generate_entropy' [-Werror,-Wframe-larger-than]
Use the cpumask interface to dynamically allocate it in those configurations.
--- drivers/char/random.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/char/random.c +12 -7
@@ -1296,6 +1296,7 @@ static void __cold try_to_generate_entropy(void)struct entropy_timer_state *stack =PTR_ALIGN ((void *)stack_bytes,SMP_CACHE_BYTES );unsigned int i, num_different =0 ;unsigned long last =random_get_entropy (); +cpumask_var_t timer_cpus;int cpu =-1 ;for (i =0 ; i <NUM_TRIAL_SAMPLES -1 ; ++i) {
@@ -1310,13 +1311,15 @@ static void __cold try_to_generate_entropy(void)atomic_set (&stack->samples,0 );timer_setup_on_stack (&stack->timer, entropy_timer,0 ); +if (!alloc_cpumask_var (&timer_cpus,GFP_KERNEL )) + goto out; +while (!crng_ready () && !signal_pending (current)) {/* * Check !timer_pending() and then ensure that any previous callback has finished * executing by checking timer_delete_sync_try(), before queueing the next one. */ if (!timer_pending (&stack->timer) &&timer_delete_sync_try (&stack->timer) >=0 ) { -struct cpumask timer_cpus;unsigned int num_cpus;/*
@@ -1326,19 +1329,19 @@ static void __cold try_to_generate_entropy(void)preempt_disable ();/* Only schedule callbacks on timer CPUs that are online. */ -cpumask_and (&timer_cpus,housekeeping_cpumask (HK_TYPE_TIMER ), cpu_online_mask); - num_cpus =cpumask_weight (&timer_cpus); +cpumask_and (timer_cpus,housekeeping_cpumask (HK_TYPE_TIMER ), cpu_online_mask); + num_cpus =cpumask_weight (timer_cpus);/* In very bizarre case of misconfiguration, fallback to all online. */ if (unlikely (num_cpus ==0 )) { - timer_cpus = *cpu_online_mask; - num_cpus =cpumask_weight (&timer_cpus); + *timer_cpus = *cpu_online_mask; + num_cpus =cpumask_weight (timer_cpus); }/* Basic CPU round-robin, which avoids the current CPU. */ do { - cpu =cpumask_next (cpu, &timer_cpus); + cpu =cpumask_next (cpu, timer_cpus);if (cpu >= nr_cpu_ids) - cpu =cpumask_first (&timer_cpus); + cpu =cpumask_first (timer_cpus); }while (cpu ==smp_processor_id () && num_cpus >1 );/* Expiring the timer at `jiffies` means it's the next tick. */
@@ -1354,6 +1357,8 @@ static void __cold try_to_generate_entropy(void) }mix_pool_bytes (&stack->entropy,sizeof (stack->entropy)); +free_cpumask_var (timer_cpus); +out:timer_delete_sync (&stack->timer);timer_destroy_on_stack (&stack->timer); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 136/507 docs: kdoc: fix duplicate section warning message
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
[ Upstream commit e5e7ca66a7fc6b8073c30a048e1157b88d427980 ]
The python version of the kernel-doc parser emits some strange warnings with just a line number in certain cases:
$ ./scripts/kernel-doc -Wall -none 'include/linux/virtio_config.h' Warning: 174 Warning: 184 Warning: 190 Warning: include/linux/virtio_config.h:226 No description found for return value of '__virtio_test_bit' Warning: include/linux/virtio_config.h:259 No description found for return value of 'virtio_has_feature' Warning: include/linux/virtio_config.h:283 No description found for return value of 'virtio_has_dma_quirk' Warning: include/linux/virtio_config.h:392 No description found for return value of 'virtqueue_set_affinity'
I eventually tracked this down to the lone call of emit_msg() in the KernelEntry class, which looks like:
self.emit_msg(self.new_start_line, f"duplicate section name '{name}'\n")
This looks like all the other emit_msg calls. Unfortunately, the definition within the KernelEntry class takes only a message parameter and not a line number. The intended message is passed as the warning!
Pass the filename to the KernelEntry class, and use this to build the log message in the same way as the KernelDoc class does.
To avoid future errors, mark the warning parameter for both emit_msg definitions as a keyword-only argument. This will prevent accidentally passing a string as the warning parameter in the future.
Also fix the call in dump_section to avoid an unnecessary additional newline.
Message-ID: <20251030-jk-fix-kernel-doc-duplicate-return-warning-v2-1-ec4b5c662881@intel.com>
--- scripts/lib/kdoc/kdoc_parser.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
scripts/lib/kdoc/kdoc_parser.py +10 -6
@@ -134,6 +134,8 @@ class KernelEntry: self.leading_space = None + self.fname = fname + # State flags self.brcount = 0 self.declaration_start_line = ln + 1
@@ -148,9 +150,11 @@ class KernelEntry: return '\n'.join(self._contents) + '\n' # TODO: rename to emit_message after removal of kernel-doc.pl - def emit_msg(self, log_msg, warning=True): + def emit_msg(self, ln, msg, *, warning=True): """Emit a message""" + log_msg = f"{self.fname}:{ln} {msg}" + if not warning: self.config.log.info(log_msg) return
@@ -196,7 +200,7 @@ class KernelEntry: # Only warn on user-specified duplicate section names if name != SECTION_DEFAULT: self.emit_msg(self.new_start_line, - f"duplicate section name '{name}'\n") + f"duplicate section name '{name}'") # Treat as a new paragraph - add a blank line self.sections[name] += '\n' + contents else:
@@ -247,15 +251,15 @@ class KernelDoc: self.emit_msg(0, 'Python 3.7 or later is required for correct results') - def emit_msg(self, ln, msg, warning=True): + def emit_msg(self, ln, msg, *, warning=True): """Emit a message""" - log_msg = f"{self.fname}:{ln} {msg}" - if self.entry: - self.entry.emit_msg(log_msg, warning) + self.entry.emit_msg(ln, msg, warning=warning) return + log_msg = f"{self.fname}:{ln} {msg}" + if warning: self.config.log.warning(log_msg) else:
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 137/507 wifi: ath12k: fix potential memory leak in ath12k_wow_arp_ns_offload()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdun Nihaal <[email protected]>
[ Upstream commit be5febd51c478bc8e24ad3480435f2754a403b14 ]
When the call to ath12k_wmi_arp_ns_offload() fails, the temporary memory allocation for offload is not freed before returning. Fix that by freeing offload in the error path.
--- drivers/net/wireless/ath/ath12k/wow.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath12k/wow.c +1 -0
@@ -758,6 +758,7 @@ static int ath12k_wow_arp_ns_offload(struct ath12k *ar, bool enable)if (ret) {ath12k_warn (ar->ab,"failed to set arp ns offload vdev %i: enable %d, ret %d\n" , arvif->vdev_id, enable, ret); +kfree (offload);return ret; } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 138/507 wifi: ath12k: fix reusing m3 memory
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <[email protected]>
[ Upstream commit 00575bb44b2c2aa53d0a768de2b80c9c1af0174d ]
During firmware recovery or suspend/resume, m3 memory could be reused if the size of the new m3 binary is equal to or less than that of the existing memory. There will be issues for the latter case, since m3_mem->size will be updated with a smaller value and this value is eventually used in the free path, where the original total size should be used instead.
To fix it, add a new member in m3_mem_region structure to track the original memory size and use it in free path.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00302-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.115823.3
--- drivers/net/wireless/ath/ath12k/qmi.c | 11 +++++++---- drivers/net/wireless/ath/ath12k/qmi.h | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath12k/qmi.c +7 -4
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */ #include <linux/elf.h>
@@ -3114,9 +3114,10 @@ static void ath12k_qmi_m3_free(struct ath12k_base *ab)if (!m3_mem->vaddr)return ; -dma_free_coherent (ab->dev, m3_mem->size, +dma_free_coherent (ab->dev, m3_mem->total_size, m3_mem->vaddr, m3_mem->paddr); m3_mem->vaddr =NULL ; + m3_mem->total_size =0 ; m3_mem->size =0 ; }
@@ -3152,7 +3153,7 @@ static int ath12k_qmi_m3_load(struct ath12k_base *ab)/* In recovery/resume cases, M3 buffer is not freed, try to reuse that */ if (m3_mem->vaddr) { -if (m3_mem->size >= m3_len) +if (m3_mem->total_size >= m3_len) goto skip_m3_alloc;/* Old buffer is too small, free and reallocate */
@@ -3164,11 +3165,13 @@ static int ath12k_qmi_m3_load(struct ath12k_base *ab) GFP_KERNEL);if (!m3_mem->vaddr) {ath12k_err (ab,"failed to allocate memory for M3 with size %zu\n" , - fw->size); + m3_len); ret = -ENOMEM ; goto out; } + m3_mem->total_size = m3_len; + skip_m3_alloc:memcpy (m3_mem->vaddr, m3_data, m3_len); m3_mem->size = m3_len;
drivers/net/wireless/ath/ath12k/qmi.h +4 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */ #ifndef ATH12K_QMI_H
@@ -120,6 +120,9 @@ struct target_info { };struct m3_mem_region { +/* total memory allocated */ +u32 total_size; +/* actual memory being used */ u32 size;dma_addr_t paddr;void *vaddr;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 139/507 wifi: ath12k: fix error handling in creating hardware group
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <[email protected]>
[ Upstream commit 088a099690e4c0d291db505013317ab5dd58b4d5 ]
In ath12k_core_init() when ath12k_core_hw_group_create() fails, ath12k_core_hw_group_destroy() is called where for each device below path would get executed
ath12k_core_soc_destroy() ath12k_qmi_deinit_service() qmi_handle_release()
This results in kernel crash in case one of the device fails at qmi_handle_init() when creating hardware group:
ath12k_pci 0000:10:00.0: failed to initialize qmi handle ath12k_pci 0000:10:00.0: failed to initialize qmi :-517 ath12k_pci 0000:10:00.0: failed to create soc core: -517 ath12k_pci 0000:10:00.0: unable to create hw group
BUG: unable to handle page fault for address: ffffffffffffffb7 RIP: 0010:qmi_handle_release Call Trace: <TASK> ath12k_qmi_deinit_service ath12k_core_hw_group_destroy ath12k_core_init ath12k_pci_probe
The detailed reason is, when qmi_handle_init() fails for a device ab->qmi.handle is not correctly initialized. Then ath12k_core_hw_group_create() returns failure, since error handing is done for all device, eventually qmi_handle_release() is called for the issue device and finally kernel crashes due to the uninitialized ab->qmi.handle.
Fix this by moving error handling to ath12k_core_hw_group_create(), this way the issue device can be skipped.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284.1-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/core.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath12k/core.c +17 -5
@@ -2106,14 +2106,27 @@ static int ath12k_core_hw_group_create(struct ath12k_hw_group *ag) ret =ath12k_core_soc_create (ab);if (ret) {mutex_unlock (&ab->core_lock); -ath12k_err (ab,"failed to create soc core: %d\n" , ret); -return ret; +ath12k_err (ab,"failed to create soc %d core: %d\n" , i, ret); + goto destroy; }mutex_unlock (&ab->core_lock); }return 0 ; + +destroy: +for (i--; i >=0 ; i--) { + ab = ag->ab[i]; +if (!ab) +continue ; + +mutex_lock (&ab->core_lock); +ath12k_core_soc_destroy (ab); +mutex_unlock (&ab->core_lock); + } + +return ret; }void ath12k_core_hw_group_set_mlo_capable (struct ath12k_hw_group *ag)
@@ -2188,7 +2201,7 @@ int ath12k_core_init(struct ath12k_base *ab)if (ret) {mutex_unlock (&ag->mutex);ath12k_warn (ab,"unable to create hw group\n" ); - goto err_destroy_hw_group; + goto err_unassign_hw_group; } }
@@ -2196,8 +2209,7 @@ int ath12k_core_init(struct ath12k_base *ab)return 0 ; -err_destroy_hw_group: -ath12k_core_hw_group_destroy (ab->ag); +err_unassign_hw_group:ath12k_core_hw_group_unassign (ab); err_unregister_notifier:ath12k_core_panic_notifier_unregister (ab);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 140/507 wifi: ath12k: unassign arvif on scan vdev create failure
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rameshkumar Sundaram <[email protected]>
[ Upstream commit e70515039d44be61b6a73aafb401d141b0034d12 ]
During scan and remain-on-channel requests, a scan link vif (arvif) is assigned and a temporary vdev is created. If vdev creation fails, the assigned arvif is left attached until the virtual interface is removed, leaving a stale link in ahvif.
Fix this by freeing the stale arvif and resetting the corresponding link in ahvif by calling ath12k_mac_unassign_link_vif() when vdev creation fails.
While at it, propagate the actual error code from ath12k_mac_vdev_create() instead of returning -EINVAL in ath12k_mac_initiate_hw_scan().
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/mac.c +3 -1
@@ -5073,7 +5073,8 @@ static int ath12k_mac_initiate_hw_scan(struct ieee80211_hw *hw, ret =ath12k_mac_vdev_create (ar, arvif);if (ret) {ath12k_warn (ar->ab,"unable to create scan vdev %d\n" , ret); -return -EINVAL ; +ath12k_mac_unassign_link_vif (arvif); +return ret; } }
@@ -12846,6 +12847,7 @@ static int ath12k_mac_op_remain_on_channel(struct ieee80211_hw *hw,if (ret) {ath12k_warn (ar->ab,"unable to create scan vdev for roc: %d\n" , ret); +ath12k_mac_unassign_link_vif (arvif);return ret; } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 141/507 interconnect: qcom: msm8996: add missing link to SLAVE_USB_HS
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 8cf9b43f6b4d90e19a9341edefdd46842d4adb55 ]
Quoted 1 line
From the initial submission the interconnect driver missed the link from
SNOC_PNOC to the USB 2 configuration space. Add missing link in order to let the platform configure and utilize this path.
--- drivers/interconnect/qcom/msm8996.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/msm8996.c +1 -0
@@ -552,6 +552,7 @@ static struct qcom_icc_node mas_venus_vmem = {static const u16 mas_snoc_pnoc_links[] = {MSM8996_SLAVE_BLSP_1 ,MSM8996_SLAVE_BLSP_2 , +MSM8996_SLAVE_USB_HS ,MSM8996_SLAVE_SDCC_1 ,MSM8996_SLAVE_SDCC_2 ,MSM8996_SLAVE_SDCC_4 ,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 142/507 arm64: dts: qcom: msm8996: add interconnect paths to USB2 controller
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 242f7558e7bf54cb63c06506f7b0630dd67d45a4 ]
Add the missing interconnects to the USB2 host. The Fixes tag points to the commit which broke probing of the USB host on that platform.
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +3 -0
@@ -3496,6 +3496,9 @@ usb2: usb@76f8800 { <&gcc GCC_USB20_MASTER_CLK>; assigned-clock-rates = <19200000>, <60000000>; + interconnects = <&pnoc MASTER_USB_HS &bimc SLAVE_EBI_CH0>, + <&bimc MASTER_AMPSS_M0 &pnoc SLAVE_USB_HS>; + interconnect-names = "usb-ddr", "apps-usb"; power-domains = <&gcc USB30_GDSC>; qcom,select-utmi-as-pipe-clk; status = "disabled";
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 143/507 accel/amdxdna: Fix incorrect command state for timed out job
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <[email protected]>
[ Upstream commit 6fb7f298883246e21f60f971065adcb789ae6eba ]
When a command times out, mark it as ERT_CMD_STATE_TIMEOUT. Any other commands that are canceled due to this timeout should be marked as ERT_CMD_STATE_ABORT.
--- drivers/accel/amdxdna/aie2_ctx.c | 15 +++++++++++++-- drivers/accel/amdxdna/amdxdna_ctx.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/accel/amdxdna/aie2_ctx.c +13 -2
@@ -198,10 +198,13 @@ aie2_sched_resp_handler(void *handle, void __iomem *data, size_t size) cmd_abo = job->cmd_bo; -if (unlikely (!data)) +if (unlikely (job->job_timeout)) { +amdxdna_cmd_set_state (cmd_abo,ERT_CMD_STATE_TIMEOUT ); + ret = -EINVAL ; goto out; + } -if (unlikely (size !=sizeof (u32))) { +if (unlikely (!data) ||unlikely (size !=sizeof (u32))) {amdxdna_cmd_set_state (cmd_abo,ERT_CMD_STATE_ABORT ); ret = -EINVAL ; goto out;
@@ -254,6 +257,13 @@ aie2_sched_cmdlist_resp_handler(void *handle, void __iomem *data, size_t size)int ret =0 ; cmd_abo = job->cmd_bo; + +if (unlikely (job->job_timeout)) { +amdxdna_cmd_set_state (cmd_abo,ERT_CMD_STATE_TIMEOUT ); + ret = -EINVAL ; + goto out; + } +if (unlikely (!data) ||unlikely (size !=sizeof (u32) *3 )) {amdxdna_cmd_set_state (cmd_abo,ERT_CMD_STATE_ABORT ); ret = -EINVAL ;
@@ -356,6 +366,7 @@ aie2_sched_job_timedout(struct drm_sched_job *sched_job) xdna = hwctx->client->xdna;trace_xdna_job (sched_job, hwctx->name,"job timedout" , job->seq); + job->job_timeout = true;mutex_lock (&xdna->dev_lock);aie2_hwctx_stop (xdna, hwctx, sched_job);
drivers/accel/amdxdna/amdxdna_ctx.h +1 -0
@@ -105,6 +105,7 @@ struct amdxdna_sched_job {/* user can wait on this fence */ struct dma_fence *out_fence;bool job_done; +bool job_timeout;u64 seq;struct amdxdna_gem_obj *cmd_bo;size_t bo_cnt;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 144/507 interconnect: debugfs: Fix incorrect error handling for NULL path
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
[ Upstream commit 6bfe104fd0f94d0248af22c256ce725ee087157b ]
The icc_commit_set() function, used by the debugfs interface, checks the validity of the global cur_path pointer using IS_ERR_OR_NULL(). However, in the specific case where cur_path is NULL, while IS_ERR_OR_NULL(NULL) correctly evaluates to true, the subsequent call to PTR_ERR(NULL) returns 0.
This causes the function to return a success code (0) instead of an error, misleading the user into believing their bandwidth request was successfully committed when, in fact, no operation was performed.
Fix this by adding an explicit check to return -EINVAL if cur_path is NULL. This prevents silent failures and ensures that an invalid operational sequence is immediately and clearly reported as an error.
--- drivers/interconnect/debugfs-client.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/interconnect/debugfs-client.c +6 -1
@@ -117,7 +117,12 @@ static int icc_commit_set(void *data, u64 val)mutex_lock (&debugfs_lock); -if (IS_ERR_OR_NULL (cur_path)) { +if (!cur_path) { + ret = -EINVAL ; + goto out; + } + +if (IS_ERR (cur_path)) { ret =PTR_ERR (cur_path); goto out; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 145/507 arm64: dts: renesas: sparrow-hawk: Fix full-size DP connector node name and labels
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 9d22a34a016313137b9e534a918f1f9aa790aa69 ]
The DisplayPort connector on Retronix R-Car V4H Sparrow Hawk board is a full-size DisplayPort connector. Fix the copy-paste error and update the DT node name and labels accordingly. No functional change.
--- arch/arm64/boot/dts/renesas/r8a779g3-sparrow-hawk.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a779g3-sparrow-hawk.dts +3 -3
@@ -118,13 +118,13 @@ memory@600000000 { }; /* Page 27 / DSI to Display */ - mini-dp-con { + dp-con { compatible = "dp-connector"; label = "CN6"; type = "full-size"; port { - mini_dp_con_in: endpoint { + dp_con_in: endpoint { remote-endpoint = <&sn65dsi86_out>; }; };
@@ -371,7 +371,7 @@ sn65dsi86_in: endpoint { port@1 { reg = <1>; sn65dsi86_out: endpoint { - remote-endpoint = <&mini_dp_con_in>; + remote-endpoint = <&dp_con_in>; }; }; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 146/507 drm/imagination: Fix reference to devm_platform_get_and_ioremap_resource()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit f1aa93005d0d6fb3293ca9c3eb08d1d1557117bf ]
The call to devm_platform_ioremap_resource() was replaced by a call to devm_platform_get_and_ioremap_resource(), but the comment referring to the function's possible returned error codes was not updated.
--- drivers/gpu/drm/imagination/pvr_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/imagination/pvr_device.c +1 -1
@@ -47,7 +47,7 @@* * Return: * * 0 on success, or -* * Any error returned by devm_platform_ioremap_resource(). +* * Any error returned by devm_platform_get_and_ioremap_resource(). */ static int pvr_device_reg_init (struct pvr_device *pvr_dev)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 147/507 perf lock contention: Load kernel map before lookup
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 553d18c98a896094b99a01765b9698b204183d49 ]
On some machines, it caused troubles when it tried to find kernel symbols. I think it's because kernel modules and kallsyms are messed up during load and split.
Basically we want to make sure the kernel map is loaded and the code has it in the lock_contention_read(). But recently we added more lookups in the lock_contention_prepare() which is called before _read().
Also the kernel map (kallsyms) may not be the first one in the group like on ARM. Let's use machine__kernel_map() rather than just loading the first map.
--- tools/perf/util/bpf_lock_contention.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/bpf_lock_contention.c +3 -3
@@ -184,6 +184,9 @@ int lock_contention_prepare(struct lock_contention *con)struct evlist *evlist = con->evlist;struct target *target = con->target; +/* make sure it loads the kernel map before lookup */ +map__load (machine__kernel_map (con->machine)); + skel =lock_contention_bpf__open ();if (!skel) {pr_err ("Failed to open lock-contention BPF skeleton\n" );
@@ -749,9 +752,6 @@ int lock_contention_read(struct lock_contention *con)bpf_prog_test_run_opts (prog_fd, &opts); } -/* make sure it loads the kernel map */ -maps__load_first (machine->kmaps); - prev_key =NULL ;while (!bpf_map_get_next_key (fd, prev_key, &key)) {s64 ls_key;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 148/507 perf record: skip synthesize event when open evsel failed
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
[ Upstream commit 163e5f2b96632b7fb2eaa965562aca0dbdf9f996 ]
When using perf record with the --overwrite option, a segmentation fault occurs if an event fails to open. For example:
perf record -e cycles-ct -F 1000 -a --overwrite
Error:
cycles-ct:H: PMU Hardware doesn't support sampling/overflow-interrupts. Try 'perf stat'
perf: Segmentation fault
#0 0x6466b6 in dump_stack debug.c:366
#1 0x646729 in sighandler_dump_stack debug.c:378
#2 0x453fd1 in sigsegv_handler builtin-record.c:722
#3 0x7f8454e65090 in __restore_rt libc-2.32.so[54090]
#4 0x6c5671 in __perf_event__synthesize_id_index synthetic-events.c:1862
#5 0x6c5ac0 in perf_event__synthesize_id_index synthetic-events.c:1943
#6 0x458090 in record__synthesize builtin-record.c:2075
#7 0x45a85a in __cmd_record builtin-record.c:2888
#8 0x45deb6 in cmd_record builtin-record.c:4374
#9 0x4e5e33 in run_builtin perf.c:349
#10 0x4e60bf in handle_internal_command perf.c:401
#11 0x4e6215 in run_argv perf.c:448
#12 0x4e653a in main perf.c:555
#13 0x7f8454e4fa72 in __libc_start_main libc-2.32.so[3ea72]
#14 0x43a3ee in _start ??:0The --overwrite option implies --tail-synthesize, which collects non-sample events reflecting the system status when recording finishes. However, when evsel opening fails (e.g., unsupported event 'cycles-ct'), session->evlist is not initialized and remains NULL. The code unconditionally calls record__synthesize() in the error path, which iterates through the NULL evlist pointer and causes a segfault.
To fix it, move the record__synthesize() call inside the error check block, so it's only called when there was no error during recording, ensuring that evlist is properly initialized.
--- tools/perf/builtin-record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-record.c +1 -1
@@ -2885,11 +2885,11 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) rec->bytes_written +=off_cpu_write (rec->session);record__read_lost_samples (rec); -record__synthesize (rec, true);/* this will be recalculated during process_buildids() */ rec->samples =0 ;if (!err) { +record__synthesize (rec, true);if (!rec->timestamp_filename) {record__finish_output (rec); }else {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 149/507 timers/migration: Convert "while" loops to use "for"
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
[ Upstream commit 6c181b5667eea3e6564d334443536a5974190e15 ]
Both the "do while" and "while" loops in tmigr_setup_groups() eventually mimic the behaviour of "for" loops.
Simplify accordingly.
Stable-dep-of: 5eb579dfd46b ("timers/migration: Fix imbalanced NUMA trees")
--- kernel/time/timer_migration.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
kernel/time/timer_migration.c +13 -10
@@ -1642,22 +1642,23 @@ static void tmigr_connect_child_parent(struct tmigr_group *child,static int tmigr_setup_groups (unsigned int cpu,unsigned int node) {struct tmigr_group *group, *child, **stack; -int top =0 , err =0 , i =0 ; +int i, top =0 , err =0 ;struct list_head *lvllist; stack =kcalloc (tmigr_hierarchy_levels,sizeof (*stack),GFP_KERNEL );if (!stack)return -ENOMEM ; - do { +for (i =0 ; i < tmigr_hierarchy_levels; i++) { group =tmigr_get_group (cpu, node, i);if (IS_ERR (group)) { err =PTR_ERR (group); + i--;break ; } top = i; - stack[i++] = group; + stack[i] = group;/* * When booting only less CPUs of a system than CPUs are
@@ -1667,16 +1668,18 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)* be different from tmigr_hierarchy_levels, contains only a * single group. */ -if (group->parent ||list_is_singular (&tmigr_level_list[i -1 ])) +if (group->parent ||list_is_singular (&tmigr_level_list[i]))break ; + } - }while (i < tmigr_hierarchy_levels); - -/* Assert single root */ -WARN_ON_ONCE (!err && !group->parent && !list_is_singular (&tmigr_level_list[top])); +/* Assert single root without parent */ +if (WARN_ON_ONCE (i >= tmigr_hierarchy_levels)) +return -EINVAL ; +if (WARN_ON_ONCE (!err && !group->parent && !list_is_singular (&tmigr_level_list[top]))) +return -EINVAL ; -while (i >0 ) { - group = stack[--i]; +for (; i >=0 ; i--) { + group = stack[i];if (err <0 ) {list_del (&group->list);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 150/507 timers/migration: Remove locking on group connection
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
[ Upstream commit fa9620355d4192200f15cb3d97c6eb9c02442249 ]
Initializing the tmc's group, the group's number of children and the group's parent can all be done without locking because:
1) Reading the group's parent and its group mask is done locklessly.
2) The connections prepared for a given CPU hierarchy are visible to the target CPU once online, thanks to the CPU hotplug enforced memory ordering.
3) In case of a newly created upper level, the new root and its connections and initialization are made visible by the CPU which made the connections. When that CPUs goes idle in the future, the new link is published by tmigr_inactive_up() through the atomic RmW on ->migr_state.
4) If CPUs were still walking up the active hierarchy, they could observe the new root earlier. In this case the ordering is enforced by an early initialization of the group mask and by barriers that maintain address dependency as explained in:
b729cc1ec21a ("timers/migration: Fix another race between hotplug and idle entry/exit") de3ced72a792 ("timers/migration: Enforce group initialization visibility to tree walkers")
5) Timers are propagated by a chain of group locking from the bottom to the top. And while doing so, the tree also propagates groups links and initialization. Therefore remote expiration, which also relies on group locking, will observe those links and initialization while holding the root lock before walking the tree remotely and update remote timers. This is especially important for migrators in the active hierarchy that may observe the new root early.
Therefore the locking is unnecessary at initialization. If anything, it just brings confusion. Remove it.
Stable-dep-of: 5eb579dfd46b ("timers/migration: Fix imbalanced NUMA trees")
--- kernel/time/timer_migration.c | 10 ---------- 1 file changed, 10 deletions(-)
kernel/time/timer_migration.c +0 -10
@@ -1573,9 +1573,6 @@ static void tmigr_connect_child_parent(struct tmigr_group *child, {struct tmigr_walk data; -raw_spin_lock_irq (&child->lock); -raw_spin_lock_nested (&parent->lock,SINGLE_DEPTH_NESTING ); -if (activate) {/* * @child is the old top and @parent the new one. In this
@@ -1596,9 +1593,6 @@ static void tmigr_connect_child_parent(struct tmigr_group *child,*/ smp_store_release (&child->parent, parent); -raw_spin_unlock (&parent->lock); -raw_spin_unlock_irq (&child->lock); -trace_tmigr_connect_child_parent (child);if (!activate)
@@ -1695,13 +1689,9 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)if (i ==0 ) {struct tmigr_cpu *tmc =per_cpu_ptr (&tmigr_cpu, cpu); -raw_spin_lock_irq (&group->lock); - tmc->tmgroup = group; tmc->groupmask =BIT (group->num_children++); -raw_spin_unlock_irq (&group->lock); -trace_tmigr_connect_cpu_parent (tmc);/* There are no children that need to be connected */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 151/507 timers/migration: Fix imbalanced NUMA trees
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
[ Upstream commit 5eb579dfd46b4949117ecb0f1ba2f12d3dc9a6f2 ]
When a CPU from a new node boots, the old root may happen to be connected to the new root even if their node mismatch, as depicted in the following scenario:
1) CPU 0 boots and creates the first group for node 0.
[GRP0:0]
node 0
|
CPU 02) CPU 1 from node 1 boots and creates a new top that corresponds to node 1, but it also connects the old root from node 0 to the new root from node 1 by mistake.
[GRP1:0]
node 1
/ \
/ \ [GRP0:0] [GRP0:1]
node 0 node 1
| |
CPU 0 CPU 1
3) This eventually leads to an imbalanced tree where some node 0 CPUs migrate node 1 timers (and vice versa) way before reaching the crossnode groups, resulting in more frequent remote memory accesses than expected.
[GRP2:0]
NUMA_NO_NODE
/ \
[GRP1:0] [GRP1:1]
node 1 node 0
/ \ |
/ \ [...]
[GRP0:0] [GRP0:1]
node 0 node 1
| |
CPU 0... CPU 1...
A balanced tree should only contain groups having children that belong to the same node:
[GRP2:0]
NUMA_NO_NODE
/ \
[GRP1:0] [GRP1:0]
node 0 node 1
/ \ / \
/ \ / \ [GRP0:0] [...] [...] [GRP0:1]
node 0 node 1
| |
CPU 0... CPU 1...
In order to fix this, the hierarchy must be unfolded up to the crossnode level as soon as a node mismatch is detected. For example the stage 2 above should lead to this layout:
[GRP2:0]
NUMA_NO_NODE
/ \
[GRP1:0] [GRP1:1]
node 0 node 1
/ \
/ \
[GRP0:0] [GRP0:1]
node 0 node 1
| |
CPU 0 CPU 1This means that not only GRP1:0 must be created but also GRP1:1 and GRP2:0 in order to prepare a balanced tree for next CPUs to boot.
--- kernel/time/timer_migration.c | 231 +++++++++++++++++++--------------- 1 file changed, 127 insertions(+), 104 deletions(-)
kernel/time/timer_migration.c +127 -104
@@ -420,6 +420,8 @@ static struct list_head *tmigr_level_list __read_mostly;static unsigned int tmigr_hierarchy_levels__read_mostly ;static unsigned int tmigr_crossnode_level__read_mostly ; +static struct tmigr_group *tmigr_root; + static DEFINE_PER_CPU(struct tmigr_cpu, tmigr_cpu);#define TMIGR_NONE 0xFF
@@ -522,11 +524,9 @@ struct tmigr_walk {typedef bool (*up_f )(struct tmigr_group *,struct tmigr_group *,struct tmigr_walk *); -static void __walk_groups (up_f up,struct tmigr_walk *data, -struct tmigr_cpu *tmc) +static void __walk_groups_from (up_f up,struct tmigr_walk *data, +struct tmigr_group *child,struct tmigr_group *group) { -struct tmigr_group *child =NULL , *group = tmc->tmgroup; - do { WARN_ON_ONCE(group->level >= tmigr_hierarchy_levels);
@@ -544,6 +544,12 @@ static void __walk_groups(up_f up, struct tmigr_walk *data, }while (group); } +static void __walk_groups (up_f up,struct tmigr_walk *data, +struct tmigr_cpu *tmc) +{ +__walk_groups_from (up, data,NULL , tmc->tmgroup); +} +static void walk_groups (up_f up,struct tmigr_walk *data,struct tmigr_cpu *tmc) {lockdep_assert_held (&tmc->lock);
@@ -1498,21 +1504,6 @@ static void tmigr_init_group(struct tmigr_group *group, unsigned int lvl, s.seq =0 ;atomic_set (&group->migr_state, s.state); -/* -* If this is a new top-level, prepare its groupmask in advance. -* This avoids accidents where yet another new top-level is -* created in the future and made visible before the current groupmask. -*/ -if (list_empty (&tmigr_level_list[lvl])) { - group->groupmask =BIT (0 ); -/* -* The previous top level has prepared its groupmask already, -* simply account it as the first child. -*/ -if (lvl >0 ) - group->num_children =1 ; - } -timerqueue_init_head (&group->events);timerqueue_init (&group->groupevt.nextevt); group->groupevt.nextevt.expires =KTIME_MAX ;
@@ -1567,22 +1558,51 @@ static struct tmigr_group *tmigr_get_group(unsigned int cpu, int node,return group; } +static bool tmigr_init_root (struct tmigr_group *group,bool activate) +{ +if (!group->parent && group != tmigr_root) { +/* +* This is the new top-level, prepare its groupmask in advance +* to avoid accidents where yet another new top-level is +* created in the future and made visible before this groupmask. +*/ + group->groupmask =BIT (0 ); +WARN_ON_ONCE (activate); + +return true; + } + +return false; + +} +static void tmigr_connect_child_parent (struct tmigr_group *child,struct tmigr_group *parent,bool activate) { -struct tmigr_walk data; +if (tmigr_init_root (parent, activate)) { +/* +* The previous top level had prepared its groupmask already, +* simply account it in advance as the first child. If some groups +* have been created between the old and new root due to node +* mismatch, the new root's child will be intialized accordingly. +*/ + parent->num_children =1 ; + } -if (activate) { +/* Connecting old root to new root ? */ +if (!parent->parent && activate) {/* -* @child is the old top and @parent the new one. In this -* case groupmask is pre-initialized and @child already -* accounted, along with its new sibling corresponding to the -* CPU going up. +* @child is the old top, or in case of node mismatch, some +* intermediate group between the old top and the new one in +* @parent. In this case the @child must be pre-accounted above +* as the first child. Its new inactive sibling corresponding +* to the CPU going up has been accounted as the second child. */ -WARN_ON_ONCE (child->groupmask !=BIT (0 ) || parent->num_children !=2 ); +WARN_ON_ONCE (parent->num_children !=2 ); + child->groupmask =BIT (0 ); }else { -/* Adding @child for the CPU going up to @parent. */ +/* Common case adding @child for the CPU going up to @parent. */ child->groupmask =BIT (parent->num_children++); }
@@ -1594,56 +1614,28 @@ static void tmigr_connect_child_parent(struct tmigr_group *child,smp_store_release (&child->parent, parent);trace_tmigr_connect_child_parent (child); - -if (!activate) -return ; - -/* -* To prevent inconsistent states, active children need to be active in -* the new parent as well. Inactive children are already marked inactive -* in the parent group: -* -* * When new groups were created by tmigr_setup_groups() starting from -* the lowest level (and not higher then one level below the current -* top level), then they are not active. They will be set active when -* the new online CPU comes active. -* -* * But if a new group above the current top level is required, it is -* mandatory to propagate the active state of the already existing -* child to the new parent. So tmigr_connect_child_parent() is -* executed with the formerly top level group (child) and the newly -* created group (parent). -* -* * It is ensured that the child is active, as this setup path is -* executed in hotplug prepare callback. This is exectued by an -* already connected and !idle CPU. Even if all other CPUs go idle, -* the CPU executing the setup will be responsible up to current top -* level group. And the next time it goes inactive, it will release -* the new childmask and parent to subsequent walkers through this -* @child. Therefore propagate active state unconditionally. -*/ - data.childmask = child->groupmask; - -/* -* There is only one new level per time (which is protected by -* tmigr_mutex). When connecting the child and the parent and set the -* child active when the parent is inactive, the parent needs to be the -* uppermost level. Otherwise there went something wrong! -*/ -WARN_ON (!tmigr_active_up (parent, child, &data) && parent->parent); } -static int tmigr_setup_groups (unsigned int cpu,unsigned int node) +static int tmigr_setup_groups (unsigned int cpu,unsigned int node, +struct tmigr_group *start,bool activate) {struct tmigr_group *group, *child, **stack; -int i, top =0 , err =0 ; -struct list_head *lvllist; +int i, top =0 , err =0 , start_lvl =0 ; +bool root_mismatch = false; stack =kcalloc (tmigr_hierarchy_levels,sizeof (*stack),GFP_KERNEL );if (!stack)return -ENOMEM ; -for (i =0 ; i < tmigr_hierarchy_levels; i++) { +if (start) { + stack[start->level] = start; + start_lvl = start->level +1 ; + } + +if (tmigr_root) + root_mismatch = tmigr_root->numa_node != node; + +for (i = start_lvl; i < tmigr_hierarchy_levels; i++) { group =tmigr_get_group (cpu, node, i);if (IS_ERR (group)) { err =PTR_ERR (group);
@@ -1656,23 +1648,25 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)/* * When booting only less CPUs of a system than CPUs are -* available, not all calculated hierarchy levels are required. +* available, not all calculated hierarchy levels are required, +* unless a node mismatch is detected. * * The loop is aborted as soon as the highest level, which might * be different from tmigr_hierarchy_levels, contains only a -* single group. +* single group, unless the nodes mismatch below tmigr_crossnode_level */ -if (group->parent ||list_is_singular (&tmigr_level_list[i])) +if (group->parent) +break ; +if ((!root_mismatch || i >= tmigr_crossnode_level) && +list_is_singular (&tmigr_level_list[i]))break ; }/* Assert single root without parent */ if (WARN_ON_ONCE (i >= tmigr_hierarchy_levels))return -EINVAL ; -if (WARN_ON_ONCE (!err && !group->parent && !list_is_singular (&tmigr_level_list[top]))) -return -EINVAL ; -for (; i >=0 ; i--) { +for (; i >= start_lvl; i--) { group = stack[i];if (err <0 ) {
@@ -1692,48 +1686,63 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node) tmc->tmgroup = group; tmc->groupmask =BIT (group->num_children++); +tmigr_init_root (group, activate); +trace_tmigr_connect_cpu_parent (tmc);/* There are no children that need to be connected */ continue ; }else { child = stack[i -1 ]; -/* Will be activated at online time */ -tmigr_connect_child_parent (child, group, false); +tmigr_connect_child_parent (child, group, activate); } + } -/* check if uppermost level was newly created */ -if (top != i) -continue ; - -WARN_ON_ONCE (top ==0 ); +if (err <0 ) + goto out; - lvllist = &tmigr_level_list[top]; +if (activate) { +struct tmigr_walk data;/* -* Newly created root level should have accounted the upcoming -* CPU's child group and pre-accounted the old root. +* To prevent inconsistent states, active children need to be active in +* the new parent as well. Inactive children are already marked inactive +* in the parent group: +* +* * When new groups were created by tmigr_setup_groups() starting from +* the lowest level, then they are not active. They will be set active +* when the new online CPU comes active. +* +* * But if new groups above the current top level are required, it is +* mandatory to propagate the active state of the already existing +* child to the new parents. So tmigr_active_up() activates the +* new parents while walking up from the old root to the new. +* +* * It is ensured that @start is active, as this setup path is +* executed in hotplug prepare callback. This is executed by an +* already connected and !idle CPU. Even if all other CPUs go idle, +* the CPU executing the setup will be responsible up to current top +* level group. And the next time it goes inactive, it will release +* the new childmask and parent to subsequent walkers through this +* @child. Therefore propagate active state unconditionally. */ -if (group->num_children ==2 &&list_is_singular (lvllist)) { -/* -* The target CPU must never do the prepare work, except -* on early boot when the boot CPU is the target. Otherwise -* it may spuriously activate the old top level group inside -* the new one (nevertheless whether old top level group is -* active or not) and/or release an uninitialized childmask. -*/ -WARN_ON_ONCE (cpu ==raw_smp_processor_id ()); - - lvllist = &tmigr_level_list[top -1 ]; -list_for_each_entry (child, lvllist, list) { -if (child->parent) -continue ; +WARN_ON_ONCE (!start->parent); + data.childmask = start->groupmask; +__walk_groups_from (tmigr_active_up, &data, start, start->parent); + } -tmigr_connect_child_parent (child, group, true); - } +/* Root update */ +if (list_is_singular (&tmigr_level_list[top])) { + group =list_first_entry (&tmigr_level_list[top], +typeof (*group), list); +WARN_ON_ONCE (group->parent); +if (tmigr_root) { +/* Old root should be the same or below */ +WARN_ON_ONCE (tmigr_root->level > top); } + tmigr_root = group; } - +out:kfree (stack);return err;
@@ -1741,12 +1750,26 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)static int tmigr_add_cpu (unsigned int cpu) { +struct tmigr_group *old_root = tmigr_root;int node =cpu_to_node (cpu);int ret; -mutex_lock (&tmigr_mutex); - ret =tmigr_setup_groups (cpu, node); -mutex_unlock (&tmigr_mutex); +guard (mutex)(&tmigr_mutex); + + ret =tmigr_setup_groups (cpu, node,NULL , false); + +/* Root has changed? Connect the old one to the new */ +if (ret >=0 && old_root && old_root != tmigr_root) { +/* +* The target CPU must never do the prepare work, except +* on early boot when the boot CPU is the target. Otherwise +* it may spuriously activate the old top level group inside +* the new one (nevertheless whether old top level group is +* active or not) and/or release an uninitialized childmask. +*/ +WARN_ON_ONCE (cpu ==raw_smp_processor_id ()); + ret =tmigr_setup_groups (-1 , old_root->numa_node, old_root, true); + }return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 152/507 power: supply: rt5033_charger: Fix device node reference leaks
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 6cdc4d488c2f3a61174bfba4e8cc4ac92c219258 ]
The device node pointers np_conn and np_edev, obtained from of_parse_phandle() and of_get_parent() respectively, are not released. This results in a reference count leak.
Add of_node_put() calls after the last use of these device nodes to properly release their references and fix the leaks.
--- drivers/power/supply/rt5033_charger.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/power/supply/rt5033_charger.c +2 -0
@@ -701,6 +701,8 @@ static int rt5033_charger_probe(struct platform_device *pdev) np_conn =of_parse_phandle (pdev->dev.of_node,"richtek,usb-connector" ,0 ); np_edev =of_get_parent (np_conn); charger->edev =extcon_find_edev_by_node (np_edev); +of_node_put (np_edev); +of_node_put (np_conn);if (IS_ERR (charger->edev)) {dev_warn (charger->dev,"no extcon device found in device-tree\n" ); goto out;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 153/507 power: supply: cw2015: Check devm_delayed_work_autocancel() return code
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Abramov <[email protected]>
[ Upstream commit 92ec7e7b86ec0aff9cd7db64d9dce50a0ea7c542 ]
Since devm_delayed_work_autocancel() may fail, add return code check and exit cw_bat_probe() on error.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/power/supply/cw2015_battery.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/power/supply/cw2015_battery.c +7 -1
@@ -702,7 +702,13 @@ static int cw_bat_probe(struct i2c_client *client)if (!cw_bat->battery_workqueue)return -ENOMEM ; -devm_delayed_work_autocancel (&client->dev, &cw_bat->battery_delay_work, cw_bat_work); + ret =devm_delayed_work_autocancel (&client->dev, &cw_bat->battery_delay_work, cw_bat_work); +if (ret) { +dev_err_probe (&client->dev, ret, +"Failed to register delayed work\n" ); +return ret; + } +queue_delayed_work (cw_bat->battery_workqueue, &cw_bat->battery_delay_work,msecs_to_jiffies (10 ));return 0 ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 154/507 power: supply: max17040: Check iio_read_channel_processed() return code
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Abramov <[email protected]>
[ Upstream commit 2c68ac48c52ad146523f32b01d70009622bf81aa ]
Since iio_read_channel_processed() may fail, return its exit code on error.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/power/supply/max17040_battery.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/power/supply/max17040_battery.c +5 -1
@@ -388,6 +388,7 @@ static int max17040_get_property(struct power_supply *psy, union power_supply_propval *val) {struct max17040_chip *chip =power_supply_get_drvdata (psy); +int ret;switch (psp) {case POWER_SUPPLY_PROP_ONLINE :
@@ -410,7 +411,10 @@ static int max17040_get_property(struct power_supply *psy,if (!chip->channel_temp)return -ENODATA ; -iio_read_channel_processed (chip->channel_temp, &val->intval); + ret =iio_read_channel_processed (chip->channel_temp, &val->intval); +if (ret) +return ret; + val->intval /=100 ;/* Convert from milli- to deci-degree */ break ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 155/507 power: supply: rt9467: Return error on failure in rt9467_set_value_from_ranges()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Abramov <[email protected]>
[ Upstream commit 8b27fe2d8d2380118c343629175385ff587e2fe4 ]
The return value of rt9467_set_value_from_ranges() when setting AICL VTH is not checked, even though it may fail.
Log error and return from rt9467_run_aicl() on fail.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/power/supply/rt9467-charger.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/power/supply/rt9467-charger.c +4 -0
@@ -588,6 +588,10 @@ static int rt9467_run_aicl(struct rt9467_chg_data *data) aicl_vth = mivr_vth + RT9467_AICLVTH_GAP_uV; ret =rt9467_set_value_from_ranges (data,F_AICL_VTH ,RT9467_RANGE_AICL_VTH , aicl_vth); +if (ret) { +dev_err (data->dev,"Failed to set AICL VTH\n" ); +return ret; + }/* Trigger AICL function */ ret =regmap_field_write (data->rm_field[F_AICL_MEAS ],1 );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 156/507 power: supply: rt9467: Prevent using uninitialized local variable in rt9467_set_value_from_ranges()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Murad Masimov <[email protected]>
[ Upstream commit 15aca30cc6c69806054b896a2ccf7577239cb878 ]
There is a typo in rt9467_set_value_from_ranges() that can cause leaving local variable sel with an undefined value which is then used in regmap_field_write().
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/power/supply/rt9467-charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/rt9467-charger.c +1 -1
@@ -376,7 +376,7 @@ static int rt9467_set_value_from_ranges(struct rt9467_chg_data *data,if (rsel ==RT9467_RANGE_VMIVR ) { ret =linear_range_get_selector_high (range, value, &sel, &found);if (ret) - value = range->max_sel; + sel = range->max_sel; }else {linear_range_get_selector_within (range, value, &sel); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 157/507 power: supply: wm831x: Check wm831x_set_bits() return value
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Abramov <[email protected]>
[ Upstream commit ea14bae6df18942bccb467fcf5ff33ca677b8253 ]
Since wm831x_set_bits() may return error, log failure and exit from wm831x_usb_limit_change() in such case.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/power/supply/wm831x_power.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/power/supply/wm831x_power.c +8 -2
@@ -144,6 +144,7 @@ static int wm831x_usb_limit_change(struct notifier_block *nb, struct wm831x_power, usb_notify);unsigned int i, best; +int ret;/* Find the highest supported limit */ best =0 ;
@@ -156,8 +157,13 @@ static int wm831x_usb_limit_change(struct notifier_block *nb,dev_dbg (wm831x_power->wm831x->dev,"Limiting USB current to %umA" , wm831x_usb_limits[best]); -wm831x_set_bits (wm831x_power->wm831x,WM831X_POWER_STATE , -WM831X_USB_ILIM_MASK , best); + ret =wm831x_set_bits (wm831x_power->wm831x,WM831X_POWER_STATE , +WM831X_USB_ILIM_MASK , best); +if (ret <0 ) { +dev_err (wm831x_power->wm831x->dev, +"Failed to set USB current limit: %d\n" , ret); +return ret; + }return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 158/507 power: supply: apm_power: only unset own apm_get_power_status
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahelenia Ziemiańska <[email protected]>
[ Upstream commit bd44ea12919ac4e83c9f3997240fe58266aa8799 ]
Mirroring drivers/macintosh/apm_emu.c, this means that
modprobe apm_power && modprobe $anotherdriver && modprobe -r apm_power
leaves $anotherdriver's apm_get_power_status instead of deleting it.
--- drivers/power/supply/apm_power.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/supply/apm_power.c +2 -1
@@ -364,7 +364,8 @@ static int __init apm_battery_init(void) static void __exit apm_battery_exit(void) { - apm_get_power_status =NULL ; +if (apm_get_power_status == apm_battery_apm_get_power_status) + apm_get_power_status =NULL ; }module_init (apm_battery_init);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 159/507 scsi: target: Do not write NUL characters into ASCII configfs output
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
[ Upstream commit c03b55f235e283cae49c88b9602fd11096b92eba ]
NUL characters are not allowed in ASCII configfs output. Hence this patch.
--- drivers/target/target_core_configfs.c | 1 - 1 file changed, 1 deletion(-)
drivers/target/target_core_configfs.c +0 -1
@@ -2772,7 +2772,6 @@ static ssize_t target_lu_gp_members_show(struct config_item *item, char *page) cur_len =snprintf (buf,LU_GROUP_NAME_BUF ,"%s/%s\n" ,config_item_name (&hba->hba_group.cg_item),config_item_name (&dev->dev_group.cg_item)); - cur_len++;/* Extra byte for NULL terminator */ if ((cur_len + len) >PAGE_SIZE || cur_len >LU_GROUP_NAME_BUF ) { pr_warn("Ran out of lu_gp_show_attr"
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 160/507 scsi: target: Fix LUN/device R/W and total command stats
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Christie <[email protected]>
[ Upstream commit 95aa2041c654161d1b5c1eca5379d67d91ef1cf2 ]
In commit 9cf2317b795d ("scsi: target: Move I/O path stats to per CPU") I saw we sometimes use %u and also misread the spec. As a result I thought all the stats were supposed to be 32-bit only. However, for the majority of cases we support currently, the spec specifies u64 bit stats. This patch converts the stats changed in the commit above to u64.
--- drivers/target/target_core_stat.c | 24 ++++++++++++------------ include/target/target_core_base.h | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/target/target_core_stat.c +12 -12
@@ -282,7 +282,7 @@ static ssize_t target_stat_lu_num_cmds_show(struct config_item *item,struct se_device *dev =to_stat_lu_dev (item);struct se_dev_io_stats *stats;unsigned int cpu; -u32 cmds =0 ; +u64 cmds =0 ;for_each_possible_cpu (cpu) { stats =per_cpu_ptr (dev->stats, cpu);
@@ -290,7 +290,7 @@ static ssize_t target_stat_lu_num_cmds_show(struct config_item *item, }/* scsiLuNumCommands */ -return snprintf (page,PAGE_SIZE ,"%u\n" , cmds); +return snprintf (page,PAGE_SIZE ,"%llu\n" , cmds); } static ssize_t target_stat_lu_read_mbytes_show(struct config_item *item,
@@ -299,7 +299,7 @@ static ssize_t target_stat_lu_read_mbytes_show(struct config_item *item,struct se_device *dev =to_stat_lu_dev (item);struct se_dev_io_stats *stats;unsigned int cpu; -u32 bytes =0 ; +u64 bytes =0 ;for_each_possible_cpu (cpu) { stats =per_cpu_ptr (dev->stats, cpu);
@@ -307,7 +307,7 @@ static ssize_t target_stat_lu_read_mbytes_show(struct config_item *item, }/* scsiLuReadMegaBytes */ -return snprintf (page,PAGE_SIZE ,"%u\n" , bytes >>20 ); +return snprintf (page,PAGE_SIZE ,"%llu\n" , bytes >>20 ); } static ssize_t target_stat_lu_write_mbytes_show(struct config_item *item,
@@ -316,7 +316,7 @@ static ssize_t target_stat_lu_write_mbytes_show(struct config_item *item,struct se_device *dev =to_stat_lu_dev (item);struct se_dev_io_stats *stats;unsigned int cpu; -u32 bytes =0 ; +u64 bytes =0 ;for_each_possible_cpu (cpu) { stats =per_cpu_ptr (dev->stats, cpu);
@@ -324,7 +324,7 @@ static ssize_t target_stat_lu_write_mbytes_show(struct config_item *item, }/* scsiLuWrittenMegaBytes */ -return snprintf (page,PAGE_SIZE ,"%u\n" , bytes >>20 ); +return snprintf (page,PAGE_SIZE ,"%llu\n" , bytes >>20 ); }static ssize_t target_stat_lu_resets_show (struct config_item *item,char *page)
@@ -1044,7 +1044,7 @@ static ssize_t target_stat_auth_num_cmds_show(struct config_item *item,struct se_dev_entry *deve;unsigned int cpu;ssize_t ret; -u32 cmds =0 ; +u64 cmds =0 ;rcu_read_lock (); deve =target_nacl_find_deve (nacl, lacl->mapped_lun);
@@ -1059,7 +1059,7 @@ static ssize_t target_stat_auth_num_cmds_show(struct config_item *item, }/* scsiAuthIntrOutCommands */ - ret =snprintf (page,PAGE_SIZE ,"%u\n" , cmds); + ret =snprintf (page,PAGE_SIZE ,"%llu\n" , cmds);rcu_read_unlock ();return ret; }
@@ -1073,7 +1073,7 @@ static ssize_t target_stat_auth_read_mbytes_show(struct config_item *item,struct se_dev_entry *deve;unsigned int cpu;ssize_t ret; -u32 bytes =0 ; +u64 bytes =0 ;rcu_read_lock (); deve =target_nacl_find_deve (nacl, lacl->mapped_lun);
@@ -1088,7 +1088,7 @@ static ssize_t target_stat_auth_read_mbytes_show(struct config_item *item, }/* scsiAuthIntrReadMegaBytes */ - ret =snprintf (page,PAGE_SIZE ,"%u\n" , bytes >>20 ); + ret =snprintf (page,PAGE_SIZE ,"%llu\n" , bytes >>20 );rcu_read_unlock ();return ret; }
@@ -1102,7 +1102,7 @@ static ssize_t target_stat_auth_write_mbytes_show(struct config_item *item,struct se_dev_entry *deve;unsigned int cpu;ssize_t ret; -u32 bytes =0 ; +u64 bytes =0 ;rcu_read_lock (); deve =target_nacl_find_deve (nacl, lacl->mapped_lun);
@@ -1117,7 +1117,7 @@ static ssize_t target_stat_auth_write_mbytes_show(struct config_item *item, }/* scsiAuthIntrWrittenMegaBytes */ - ret =snprintf (page,PAGE_SIZE ,"%u\n" , bytes >>20 ); + ret =snprintf (page,PAGE_SIZE ,"%llu\n" , bytes >>20 );rcu_read_unlock ();return ret; }
include/target/target_core_base.h +6 -6
@@ -671,9 +671,9 @@ struct se_lun_acl { };struct se_dev_entry_io_stats { -u32 total_cmds; -u32 read_bytes; -u32 write_bytes; +u64 total_cmds; +u64 read_bytes; +u64 write_bytes; };struct se_dev_entry {
@@ -806,9 +806,9 @@ struct se_device_queue { };struct se_dev_io_stats { -u32 total_cmds; -u32 read_bytes; -u32 write_bytes; +u64 total_cmds; +u64 read_bytes; +u64 write_bytes; };struct se_device {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 161/507 fs/9p: Dont open remote file with APPEND mode when writeback cache is used
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tingmao Wang <[email protected]>
[ Upstream commit a63dd8fd137933551bfd9aeeeaa942f04c7aad65 ]
When page cache is used, writebacks are done on a page granularity, and it is expected that the underlying filesystem (such as v9fs) should respect the write position. However, currently v9fs will passthrough O_APPEND to the server even on cached mode. This causes data corruption if a sync or fstat gets between two writes to the same file.
This patch removes the APPEND flag from the open request we send to the server when writeback caching is involved. I believe keeping server-side APPEND is probably fine for uncached mode (even if two fds are opened, one without O_APPEND and one with it, this should still be fine since they would use separate fid for the writes).
Message-ID: <[email protected]>
--- fs/9p/vfs_file.c | 11 ++++++++--- fs/9p/vfs_inode.c | 3 +-- fs/9p/vfs_inode_dotl.c | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-)
fs/9p/vfs_file.c +8 -3
@@ -43,14 +43,18 @@ int v9fs_file_open(struct inode *inode, struct file *file)struct v9fs_session_info *v9ses;struct p9_fid *fid;int omode; +int o_append;p9_debug (P9_DEBUG_VFS ,"inode: %p file: %p\n" , inode, file); v9ses =v9fs_inode2v9ses (inode); -if (v9fs_proto_dotl (v9ses)) +if (v9fs_proto_dotl (v9ses)) { omode =v9fs_open_to_dotl_flags (file->f_flags); -else + o_append =P9_DOTL_APPEND ; + }else { omode =v9fs_uflags2omode (file->f_flags,v9fs_proto_dotu (v9ses)); + o_append =P9_OAPPEND ; + } fid = file->private_data;if (!fid) { fid =v9fs_fid_clone (file_dentry (file));
@@ -58,9 +62,10 @@ int v9fs_file_open(struct inode *inode, struct file *file)return PTR_ERR (fid);if ((v9ses->cache &CACHE_WRITEBACK ) && (omode &P9_OWRITE )) { -int writeback_omode = (omode & ~P9_OWRITE ) |P9_ORDWR ; +int writeback_omode = (omode & ~(P9_OWRITE | o_append)) |P9_ORDWR ;p9_debug (P9_DEBUG_CACHE ,"write-only file with writeback enabled, try opening O_RDWR\n" ); + err =p9_client_open (fid, writeback_omode);if (err <0 ) {p9_debug (P9_DEBUG_CACHE ,"could not open O_RDWR, disabling caches\n" );
fs/9p/vfs_inode.c +1 -2
@@ -790,7 +790,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry, p9_omode =v9fs_uflags2omode (flags,v9fs_proto_dotu (v9ses));if ((v9ses->cache &CACHE_WRITEBACK ) && (p9_omode &P9_OWRITE )) { - p9_omode = (p9_omode & ~P9_OWRITE ) |P9_ORDWR ; + p9_omode = (p9_omode & ~(P9_OWRITE |P9_OAPPEND )) |P9_ORDWR ;p9_debug (P9_DEBUG_CACHE ,"write-only file with writeback enabled, creating w/ O_RDWR\n" ); }
@@ -1403,4 +1403,3 @@ static const struct inode_operations v9fs_symlink_inode_operations = { .getattr = v9fs_vfs_getattr, .setattr = v9fs_vfs_setattr, }; -
fs/9p/vfs_inode_dotl.c +1 -1
@@ -286,7 +286,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, }if ((v9ses->cache &CACHE_WRITEBACK ) && (p9_omode &P9_OWRITE )) { - p9_omode = (p9_omode & ~P9_OWRITE ) |P9_ORDWR ; + p9_omode = (p9_omode & ~(P9_OWRITE |P9_DOTL_APPEND )) |P9_ORDWR ;p9_debug (P9_DEBUG_CACHE ,"write-only file with writeback enabled, creating w/ O_RDWR\n" ); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 162/507 drm/panthor: Handle errors returned by drm_sched_entity_init()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
[ Upstream commit bb7939e332c64c4ef33974a0eae4f3841acfa8eb ]
In practice it's not going to fail because we're passing the current sanity checks done by drm_sched_entity_init(), and that's the only reason it would return an error, but better safe than sorry.
--- drivers/gpu/drm/panthor/panthor_sched.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/panthor/panthor_sched.c +2 -0
@@ -3380,6 +3380,8 @@ group_create_queue(struct panthor_group *group, drm_sched = &queue->scheduler; ret =drm_sched_entity_init (&queue->entity,0 , &drm_sched,1 ,NULL ); +if (ret) + goto err_free_queue;return queue;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 163/507 drm/panthor: Fix group_free_queue() for partially initialized queues
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
[ Upstream commit 94a6d20feadbbe24e8a7b1c56394789ea5358fcc ]
group_free_queue() can be called on a partially initialized queue object if something fails in group_create_queue(). Make sure we don't call drm_sched_entity_destroy() on an entity that hasn't been initialized.
--- drivers/gpu/drm/panthor/panthor_sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/panthor/panthor_sched.c +2 -1
@@ -886,7 +886,8 @@ static void group_free_queue(struct panthor_group *group, struct panthor_queue *if (IS_ERR_OR_NULL (queue))return ; -drm_sched_entity_destroy (&queue->entity); +if (queue->entity.fence_context) +drm_sched_entity_destroy (&queue->entity);if (queue->scheduler.ops)drm_sched_fini (&queue->scheduler);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 164/507 drm/panthor: Fix UAF race between device unplug and FW event processing
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ketil Johnsen <[email protected]>
[ Upstream commit 7051f6ba968fa69918d72cc26de4d6cf7ea05b90 ]
The function panthor_fw_unplug() will free the FW memory sections. The problem is that there could still be pending FW events which are yet not handled at this point. process_fw_events_work() can in this case try to access said freed memory.
Simply call disable_work_sync() to both drain and prevent future invocation of process_fw_events_work().
--- drivers/gpu/drm/panthor/panthor_sched.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panthor/panthor_sched.c +1 -0
@@ -3826,6 +3826,7 @@ void panthor_sched_unplug(struct panthor_device *ptdev)struct panthor_scheduler *sched = ptdev->scheduler;cancel_delayed_work_sync (&sched->tick_work); +disable_work_sync (&sched->fw_events_work);mutex_lock (&sched->lock);if (sched->pm.has_ref) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 165/507 drm/panthor: Fix race with suspend during unplug
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ketil Johnsen <[email protected]>
[ Upstream commit 08be57e6e8aa20ea5a6dd2552e38ac168d6a9b11 ]
There is a race between panthor_device_unplug() and panthor_device_suspend() which can lead to IRQ handlers running on a powered down GPU. This is how it can happen:
- unplug routine calls drm_dev_unplug()
- panthor_device_suspend() can now execute, and will skip a lot of important work because the device is currently marked as unplugged.
- IRQs will remain active in this case and IRQ handlers can therefore try to access a powered down GPU.
The fix is simply to take the PM ref in panthor_device_unplug() a little bit earlier, before drm_dev_unplug().
--- drivers/gpu/drm/panthor/panthor_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panthor/panthor_device.c +2 -2
@@ -82,6 +82,8 @@ void panthor_device_unplug(struct panthor_device *ptdev)return ; } +drm_WARN_ON (&ptdev->base,pm_runtime_get_sync (ptdev->base.dev) <0 ); +/* Call drm_dev_unplug() so any access to HW blocks happening after * that point get rejected. */
@@ -92,8 +94,6 @@ void panthor_device_unplug(struct panthor_device *ptdev)*/ mutex_unlock (&ptdev->unplug.lock); -drm_WARN_ON (&ptdev->base,pm_runtime_get_sync (ptdev->base.dev) <0 ); -/* Now, try to cleanly shutdown the GPU before the device resources * get reclaimed. */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 166/507 drm/panthor: Fix UAF on kernel BO VA nodes
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
[ Upstream commit 98dd5143447af0ee33551776d8b2560c35d0bc4a ]
If the MMU is down, panthor_vm_unmap_range() might return an error. We expect the page table to be updated still, and if the MMU is blocked, the rest of the GPU should be blocked too, so no risk of accessing physical memory returned to the system (which the current code doesn't cover for anyway).
Proceed with the rest of the cleanup instead of bailing out and leaving the va_node inserted in the drm_mm, which leads to UAF when other adjacent nodes are removed from the drm_mm tree.
--- drivers/gpu/drm/panthor/panthor_gem.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/panthor/panthor_gem.c +3 -11
@@ -87,7 +87,6 @@ static void panthor_gem_free_object(struct drm_gem_object *obj)void panthor_kernel_bo_destroy (struct panthor_kernel_bo *bo) {struct panthor_vm *vm; -int ret;if (IS_ERR_OR_NULL (bo))return ;
@@ -95,18 +94,11 @@ void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo) vm = bo->vm;panthor_kernel_bo_vunmap (bo); -if (drm_WARN_ON (bo->obj->dev, -to_panthor_bo (bo->obj)->exclusive_vm_root_gem !=panthor_vm_root_gem (vm))) - goto out_free_bo; - - ret =panthor_vm_unmap_range (vm, bo->va_node.start, bo->va_node.size); -if (ret) - goto out_free_bo; - +drm_WARN_ON (bo->obj->dev, +to_panthor_bo (bo->obj)->exclusive_vm_root_gem !=panthor_vm_root_gem (vm)); +panthor_vm_unmap_range (vm, bo->va_node.start, bo->va_node.size);panthor_vm_free_va (vm, &bo->va_node);drm_gem_object_put (bo->obj); - -out_free_bo:panthor_vm_put (vm);kfree (bo); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 167/507 firmware: ti_sci: Set IO Isolation only if the firmware is capable
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richard (TI.com) <[email protected]>
[ Upstream commit 999e9bc953e321651d69556fdd5dfd178f96f128 ]
Prevent calling ti_sci_cmd_set_io_isolation() on firmware that does not support the IO_ISOLATION capability. Add the MSG_FLAG_CAPS_IO_ISOLATION capability flag and check it before attempting to set IO isolation during suspend/resume operations.
Without this check, systems with older firmware may experience undefined behavior or errors when entering/exiting suspend states.
--- drivers/firmware/ti_sci.c | 21 +++++++++++++-------- drivers/firmware/ti_sci.h | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-)
drivers/firmware/ti_sci.c +13 -8
@@ -3751,9 +3751,11 @@ static int __maybe_unused ti_sci_suspend_noirq(struct device *dev)struct ti_sci_info *info =dev_get_drvdata (dev);int ret =0 ; - ret =ti_sci_cmd_set_io_isolation (&info->handle,TISCI_MSG_VALUE_IO_ENABLE ); -if (ret) -return ret; +if (info->fw_caps &MSG_FLAG_CAPS_IO_ISOLATION ) { + ret =ti_sci_cmd_set_io_isolation (&info->handle,TISCI_MSG_VALUE_IO_ENABLE ); +if (ret) +return ret; + }return 0 ; }
@@ -3767,9 +3769,11 @@ static int __maybe_unused ti_sci_resume_noirq(struct device *dev)u8 pin;u8 mode; - ret =ti_sci_cmd_set_io_isolation (&info->handle,TISCI_MSG_VALUE_IO_DISABLE ); -if (ret) -return ret; +if (info->fw_caps &MSG_FLAG_CAPS_IO_ISOLATION ) { + ret =ti_sci_cmd_set_io_isolation (&info->handle,TISCI_MSG_VALUE_IO_DISABLE ); +if (ret) +return ret; + } ret =ti_sci_msg_cmd_lpm_wake_reason (&info->handle, &source, &time, &pin, &mode);/* Do not fail to resume on error as the wake reason is not critical */
@@ -3928,11 +3932,12 @@ static int ti_sci_probe(struct platform_device *pdev) }ti_sci_msg_cmd_query_fw_caps (&info->handle, &info->fw_caps); -dev_dbg (dev,"Detected firmware capabilities: %s%s%s%s\n" , +dev_dbg (dev,"Detected firmware capabilities: %s%s%s%s%s\n" , info->fw_caps &MSG_FLAG_CAPS_GENERIC ?"Generic" :"" , info->fw_caps &MSG_FLAG_CAPS_LPM_PARTIAL_IO ?" Partial-IO" :"" , info->fw_caps &MSG_FLAG_CAPS_LPM_DM_MANAGED ?" DM-Managed" :"" , - info->fw_caps &MSG_FLAG_CAPS_LPM_ABORT ?" LPM-Abort" :"" + info->fw_caps &MSG_FLAG_CAPS_LPM_ABORT ?" LPM-Abort" :"" , + info->fw_caps &MSG_FLAG_CAPS_IO_ISOLATION ?" IO-Isolation" :"" );ti_sci_setup_ops (info);
drivers/firmware/ti_sci.h +2 -0
@@ -149,6 +149,7 @@ struct ti_sci_msg_req_reboot {* MSG_FLAG_CAPS_LPM_PARTIAL_IO: Partial IO in LPM * MSG_FLAG_CAPS_LPM_DM_MANAGED: LPM can be managed by DM * MSG_FLAG_CAPS_LPM_ABORT: Abort entry to LPM +* MSG_FLAG_CAPS_IO_ISOLATION: IO Isolation support * * Response to a generic message with message type TI_SCI_MSG_QUERY_FW_CAPS * providing currently available SOC/firmware capabilities. SoC that don't
@@ -160,6 +161,7 @@ struct ti_sci_msg_resp_query_fw_caps {#define MSG_FLAG_CAPS_LPM_PARTIAL_IO TI_SCI_MSG_FLAG(4)#define MSG_FLAG_CAPS_LPM_DM_MANAGED TI_SCI_MSG_FLAG(5)#define MSG_FLAG_CAPS_LPM_ABORT TI_SCI_MSG_FLAG(9) +#define MSG_FLAG_CAPS_IO_ISOLATION TI_SCI_MSG_FLAG(7)#define MSG_MASK_CAPS_LPM GENMASK_ULL(4, 1)u64 fw_caps; } __packed;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 168/507 iommu/amd: Fix potential out-of-bounds read in iommu_mmio_show
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Songtang Liu <[email protected]>
[ Upstream commit a0c7005333f9a968abb058b1d77bbcd7fb7fd1e7 ]
In iommu_mmio_write(), it validates the user-provided offset with the
check: iommu->dbg_mmio_offset > iommu->mmio_phys_end - 4. This assumes a 4-byte access. However, the corresponding show handler, iommu_mmio_show(), uses readq() to perform an 8-byte (64-bit) read.
If a user provides an offset equal to mmio_phys_end - 4, the check passes, and will lead to a 4-byte out-of-bounds read.
Fix this by adjusting the boundary check to use sizeof(u64), which corresponds to the size of the readq() operation.
--- drivers/iommu/amd/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd/debugfs.c +1 -1
@@ -37,7 +37,7 @@ static ssize_t iommu_mmio_write(struct file *filp, const char __user *ubuf,if (ret)return ret; -if (iommu->dbg_mmio_offset > iommu->mmio_phys_end -4 ) { +if (iommu->dbg_mmio_offset > iommu->mmio_phys_end -sizeof (u64)) { iommu->dbg_mmio_offset =-1 ;return -EINVAL ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 169/507 cleanup: fix scoped_class()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit 4e97bae1b412cd6ed8053b3d8a242122952985cc ]
This is a class, not a guard so why on earth is it checking for guard pointers or conditional lock acquisition? None of it makes any sense at all.
I'm not sure what happened back then. Maybe I had a brief psychedelic period that I completely forgot about and spaced out into a zone where that initial macro implementation made any sense at all.
--- include/linux/cleanup.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
include/linux/cleanup.h +8 -7
@@ -290,15 +290,16 @@ static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \ class_##_name##_t var __cleanup(class_##_name##_destructor) = \ class_##_name##_constructor -#define scoped_class(_name, var, args) \ - for (CLASS(_name, var)(args); \ -__guard_ptr (_name)(&var) || !__is_cond_ptr (_name); \ - ({ goto _label; })) \ -if (0 ) { \ -_label: \ -break ; \ +#define __scoped_class(_name, var, _label, args...) \ + for (CLASS(_name, var)(args); ; ({ goto _label; })) \ +if (0 ) { \ +_label: \ +break ; \ } else +#define scoped_class(_name, var, args...) \ + __scoped_class(_name, var, __UNIQUE_ID(label), args) +/* * DEFINE_GUARD(name, type, lock, unlock): * trivial wrapper around DEFINE_CLASS() above specifically
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 170/507 spi: tegra210-quad: Fix timeout handling
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vishwaroop A <[email protected]>
[ Upstream commit b4e002d8a7cee3b1d70efad0e222567f92a73000 ]
When the CPU that the QSPI interrupt handler runs on (typically CPU 0) is excessively busy, it can lead to rare cases of the IRQ thread not running before the transfer timeout is reached.
While handling the timeouts, any pending transfers are cleaned up and the message that they correspond to is marked as failed, which leaves the curr_xfer field pointing at stale memory.
To avoid this, clear curr_xfer to NULL upon timeout and check for this condition when the IRQ thread is finally run.
While at it, also make sure to clear interrupts on failure so that new interrupts can be run.
A better, more involved, fix would move the interrupt clearing into a hard IRQ handler. Ideally we would also want to signal that the IRQ thread no longer needs to be run after the timeout is hit to avoid the extra check for a valid transfer.
--- drivers/spi/spi-tegra210-quad.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/spi/spi-tegra210-quad.c +20 -2
@@ -1024,8 +1024,10 @@ static void tegra_qspi_handle_error(struct tegra_qspi *tqspi)dev_err (tqspi->dev,"error in transfer, fifo status 0x%08x\n" , tqspi->status_reg);tegra_qspi_dump_regs (tqspi);tegra_qspi_flush_fifos (tqspi, true); -if (device_reset (tqspi->dev) <0 ) +if (device_reset (tqspi->dev) <0 ) {dev_warn_once (tqspi->dev,"device reset failed\n" ); +tegra_qspi_mask_clear_irq (tqspi); + } }static void tegra_qspi_transfer_end (struct spi_device *spi)
@@ -1176,9 +1178,11 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, }/* Reset controller if timeout happens */ -if (device_reset (tqspi->dev) <0 ) +if (device_reset (tqspi->dev) <0 ) {dev_warn_once (tqspi->dev,"device reset failed\n" ); +tegra_qspi_mask_clear_irq (tqspi); + } ret = -EIO ; goto exit; }
@@ -1200,11 +1204,13 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,tegra_qspi_transfer_end (spi);spi_transfer_delay_exec (xfer); } + tqspi->curr_xfer =NULL ; transfer_phase++; } ret =0 ; exit: + tqspi->curr_xfer =NULL ; msg->status = ret;return ret;
@@ -1290,6 +1296,8 @@ static int tegra_qspi_non_combined_seq_xfer(struct tegra_qspi *tqspi, msg->actual_length += xfer->len + dummy_bytes; complete_xfer: + tqspi->curr_xfer =NULL ; +if (ret <0 ) {tegra_qspi_transfer_end (spi);spi_transfer_delay_exec (xfer);
@@ -1395,6 +1403,7 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_qspi *tqspi)tegra_qspi_calculate_curr_xfer_param (tqspi, t);tegra_qspi_start_cpu_based_transfer (tqspi, t); exit: + tqspi->curr_xfer =NULL ;spin_unlock_irqrestore (&tqspi->lock, flags);return IRQ_HANDLED ; }
@@ -1480,6 +1489,15 @@ static irqreturn_t tegra_qspi_isr_thread(int irq, void *context_data) {struct tegra_qspi *tqspi = context_data; +/* +* Occasionally the IRQ thread takes a long time to wake up (usually +* when the CPU that it's running on is excessively busy) and we have +* already reached the timeout before and cleaned up the timed out +* transfer. Avoid any processing in that case and bail out early. +*/ +if (!tqspi->curr_xfer) +return IRQ_NONE ; + tqspi->status_reg =tegra_qspi_readl (tqspi,QSPI_FIFO_STATUS );if (tqspi->cur_direction &DATA_DIR_TX )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 171/507 libbpf: Fix parsing of multi-split BTF
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Maguire <[email protected]>
[ Upstream commit 4f596acc260e691a2e348f64230392f3472feea3 ]
When creating multi-split BTF we correctly set the start string offset to be the size of the base string section plus the base BTF start string offset; the latter is needed for multi-split BTF since the offset is non-zero there.
Unfortunately the BTF parsing case needed that logic and it was missed.
--- tools/lib/bpf/btf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/lib/bpf/btf.c +2 -2
@@ -1062,7 +1062,7 @@ static struct btf *btf_new(const void *data, __u32 size, struct btf *base_btf, bif (base_btf) { btf->base_btf = base_btf; btf->start_id =btf__type_cnt (base_btf); - btf->start_str_off = base_btf->hdr->str_len; + btf->start_str_off = base_btf->hdr->str_len + base_btf->start_str_off; }if (is_mmap) {
@@ -5819,7 +5819,7 @@ void btf_set_base_btf(struct btf *btf, const struct btf *base_btf) { btf->base_btf = (struct btf *)base_btf; btf->start_id =btf__type_cnt (base_btf); - btf->start_str_off = base_btf->hdr->str_len; + btf->start_str_off = base_btf->hdr->str_len + base_btf->start_str_off; }int btf__relocate (struct btf *btf,const struct btf *base_btf)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 172/507 ARM: dts: am335x-netcom-plus-2xx: add missing GPIO labels
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yegor Yefremov <[email protected]>
[ Upstream commit d0c4b1723c419a18cb434903c7754954ecb51d35 ]
--- arch/arm/boot/dts/ti/omap/am335x-netcom-plus-2xx.dts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/ti/omap/am335x-netcom-plus-2xx.dts +4 -4
@@ -222,10 +222,10 @@ &gpio3 { "ModeA1", "ModeA2", "ModeA3", - "NC", - "NC", - "NC", - "NC", + "ModeB0", + "ModeB1", + "ModeB2", + "ModeB3", "NC", "NC", "NC",
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 173/507 ARM: dts: omap3: beagle-xm: Correct obsolete TWL4030 power compatible
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jihed Chaibi <[email protected]>
[ Upstream commit f7f3bc18300a230e0f1bfb17fc8889435c1e47f5 ]
The "ti,twl4030-power-beagleboard-xm" compatible string is obsolete and is not supported by any in-kernel driver. Currently, the kernel falls back to the second entry, "ti,twl4030-power-idle-osc-off", to bind a driver to this node.
Make this fallback explicit by removing the obsolete board-specific compatible. This preserves the existing functionality while making the DTS compliant with the new, stricter 'ti,twl.yaml' binding.
--- arch/arm/boot/dts/ti/omap/omap3-beagle-xm.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/ti/omap/omap3-beagle-xm.dts +1 -1
@@ -291,7 +291,7 @@ codec { }; twl_power: power { - compatible = "ti,twl4030-power-beagleboard-xm", "ti,twl4030-power-idle-osc-off"; + compatible = "ti,twl4030-power-idle-osc-off"; ti,use_poweroff; }; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 174/507 ARM: dts: omap3: n900: Correct obsolete TWL4030 power compatible
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jihed Chaibi <[email protected]>
[ Upstream commit 3862123e9b56663c7a3e4a308e6e65bffe44f646 ]
The "ti,twl4030-power-n900" compatible string is obsolete and is not supported by any in-kernel driver. Currently, the kernel falls back to the second entry, "ti,twl4030-power-idle-osc-off", to bind a driver to this node.
Make this fallback explicit by removing the obsolete board-specific compatible. This preserves the existing functionality while making the DTS compliant with the new, stricter 'ti,twl.yaml' binding.
--- arch/arm/boot/dts/ti/omap/omap3-n900.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/ti/omap/omap3-n900.dts +1 -1
@@ -508,7 +508,7 @@ twl_audio: audio { }; twl_power: power { - compatible = "ti,twl4030-power-n900", "ti,twl4030-power-idle-osc-off"; + compatible = "ti,twl4030-power-idle-osc-off"; ti,use_poweroff; }; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 175/507 entry,unwind/deferred: Fix unwind_reset_info() placement
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit cf76553aaa363620f58a6b6409bf544f4bcfa8de ]
Stephen reported that on KASAN builds he's seeing:
vmlinux.o: warning: objtool: user_exc_vmm_communication+0x15a: call to __kasan_check_read() leaves .noinstr.text section vmlinux.o: warning: objtool: exc_debug_user+0x182: call to __kasan_check_read() leaves .noinstr.text section vmlinux.o: warning: objtool: exc_int3+0x123: call to __kasan_check_read() leaves .noinstr.text section vmlinux.o: warning: objtool: noist_exc_machine_check+0x17a: call to __kasan_check_read() leaves .noinstr.text section vmlinux.o: warning: objtool: fred_exc_machine_check+0x17e: call to __kasan_check_read() leaves .noinstr.text section
This turns out to be atomic ops from unwind_reset_info() that have explicit instrumentation. Place unwind_reset_info() in the preceding instrumentation_begin() section.
--- include/linux/irq-entry-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/irq-entry-common.h +1 -1
@@ -253,11 +253,11 @@ static __always_inline void exit_to_user_mode_prepare(struct pt_regs *regs) static __always_inline void exit_to_user_mode(void) {instrumentation_begin (); +unwind_reset_info ();trace_hardirqs_on_prepare ();lockdep_hardirqs_on_prepare ();instrumentation_end (); -unwind_reset_info ();user_enter_irqoff ();arch_exit_to_user_mode ();lockdep_hardirqs_on (CALLER_ADDR0 );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 176/507 coresight: ETR: Fix ETR buffer use-after-free issue
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaoqi Zhuang <[email protected]>
[ Upstream commit 35501ac3c7d40a7bb9568c2f89d6b56beaf9bed3 ]
When ETR is enabled as CS_MODE_SYSFS, if the buffer size is changed and enabled again, currently sysfs_buf will point to the newly allocated memory(buf_new) and free the old memory(buf_old). But the etr_buf that is being used by the ETR remains pointed to buf_old, not updated to buf_new. In this case, it will result in a memory use-after-free issue.
Fix this by checking ETR's mode before updating and releasing buf_old, if the mode is CS_MODE_SYSFS, then skip updating and releasing it.
--- drivers/hwtracing/coresight/coresight-tmc-etr.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/hwtracing/coresight/coresight-tmc-etr.c +7 -0
@@ -1250,6 +1250,13 @@ static struct etr_buf *tmc_etr_get_sysfs_buffer(struct coresight_device *csdev)* with the lock released. */ raw_spin_lock_irqsave (&drvdata->spinlock, flags); + +/* +* If the ETR is already enabled, continue with the existing buffer. +*/ +if (coresight_get_mode (csdev) ==CS_MODE_SYSFS ) + goto out; + sysfs_buf =READ_ONCE (drvdata->sysfs_buf);if (!sysfs_buf || (sysfs_buf->size != drvdata->size)) {raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 177/507 x86/boot: Fix page table access in 5-level to 4-level paging transition
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Usama Arif <[email protected]>
[ Upstream commit eb2266312507d7b757859e2227aa5c4ba6280ebe ]
When transitioning from 5-level to 4-level paging, the existing code incorrectly accesses page table entries by directly dereferencing CR3 and applying PAGE_MASK. This approach has several issues:
- __native_read_cr3() returns the raw CR3 register value, which on x86_64 includes not just the physical address but also flags. Bits above the physical address width of the system i.e. above __PHYSICAL_MASK_SHIFT) are also not masked.
- The PGD entry is masked by PAGE_SIZE which doesn't take into account the higher bits such as _PAGE_BIT_NOPTISHADOW.
Replace this with proper accessor functions:
- native_read_cr3_pa(): Uses CR3_ADDR_MASK to additionally mask metadata out of CR3 (like SME or LAM bits). All remaining bits are real address bits or reserved and must be 0.
- mask pgd value with PTE_PFN_MASK instead of PAGE_MASK, accounting for flags above bit 51 (_PAGE_BIT_NOPTISHADOW in particular). Bits below 51, but above the max physical address are reserved and must be 0.
--- arch/x86/boot/compressed/pgtable_64.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/x86/boot/compressed/pgtable_64.c +7 -4
@@ -3,6 +3,7 @@#include <asm/bootparam.h> #include <asm/bootparam_utils.h> #include <asm/e820/types.h> +#include <asm/pgtable.h> #include <asm/processor.h> #include "../string.h" #include "efi.h"
@@ -168,9 +169,10 @@ asmlinkage void configure_5level_paging(struct boot_params *bp, void *pgtable)* For 4- to 5-level paging transition, set up current CR3 as * the first and the only entry in a new top-level page table. */ - *trampoline_32bit =__native_read_cr3 () | _PAGE_TABLE_NOENC; + *trampoline_32bit =native_read_cr3_pa () | _PAGE_TABLE_NOENC; }else { -unsigned long src; +u64 *new_cr3; +pgd_t *pgdp;/* * For 5- to 4-level paging transition, copy page table pointed
@@ -180,8 +182,9 @@ asmlinkage void configure_5level_paging(struct boot_params *bp, void *pgtable)* We cannot just point to the page table from trampoline as it * may be above 4G. */ - src = *(unsigned long *)__native_read_cr3 () &PAGE_MASK ; -memcpy (trampoline_32bit, (void *)src,PAGE_SIZE ); + pgdp = (pgd_t *)native_read_cr3_pa (); + new_cr3 = (u64 *)(native_pgd_val (pgdp[0 ]) &PTE_PFN_MASK ); +memcpy (trampoline_32bit, new_cr3,PAGE_SIZE ); }toggle_la57 (trampoline_32bit);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 178/507 efi/libstub: Fix page table access in 5-level to 4-level paging transition
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Usama Arif <[email protected]>
[ Upstream commit 84361123413efc84b06f3441c6c827b95d902732 ]
When transitioning from 5-level to 4-level paging, the existing code incorrectly accesses page table entries by directly dereferencing CR3 and applying PAGE_MASK. This approach has several issues:
- __native_read_cr3() returns the raw CR3 register value, which on x86_64 includes not just the physical address but also flags Bits above the physical address width of the system (i.e. above __PHYSICAL_MASK_SHIFT) are also not masked.
- The pgd value is masked by PAGE_SIZE which doesn't take into account the higher bits such as _PAGE_BIT_NOPTISHADOW.
Replace this with proper accessor functions:
- native_read_cr3_pa(): Uses CR3_ADDR_MASK to additionally mask metadata out of CR3 (like SME or LAM bits). All remaining bits are real address bits or reserved and must be 0.
- mask pgd value with PTE_PFN_MASK instead of PAGE_MASK, accounting for flags above bit 51 (_PAGE_BIT_NOPTISHADOW in particular). Bits below 51, but above the max physical address are reserved and must be 0.
--- drivers/firmware/efi/libstub/x86-5lvl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/efi/libstub/x86-5lvl.c +2 -2
@@ -66,7 +66,7 @@ void efi_5level_switch(void)bool have_la57 =native_read_cr4 () &X86_CR4_LA57 ;bool need_toggle = want_la57 ^ have_la57;u64 *pgt = (void *)la57_toggle +PAGE_SIZE ; -u64 *cr3 = (u64 *)__native_read_cr3 (); +pgd_t *cr3 = (pgd_t *)native_read_cr3_pa ();u64 *new_cr3;if (!la57_toggle || !need_toggle)
@@ -82,7 +82,7 @@ void efi_5level_switch(void) new_cr3[0 ] = (u64 )cr3 | _PAGE_TABLE_NOENC; }else {/* take the new root table pointer from the current entry #0 */ - new_cr3 = (u64 *)(cr3[0 ] &PAGE_MASK ); + new_cr3 = (u64 *)(native_pgd_val (cr3[0 ]) &PTE_PFN_MASK );/* copy the new root table if it is not 32-bit addressable */ if ((u64 )new_cr3 >U32_MAX )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 179/507 locktorture: Fix memory leak in param_set_cpumask()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Liang <[email protected]>
[ Upstream commit e52b43883d084a9af263c573f2a1bd1ca5088389 ]
With CONFIG_CPUMASK_OFFSTACK=y, the 'bind_writers' buffer is allocated via alloc_cpumask_var() in param_set_cpumask(). But it is not freed, when setting the module parameter multiple times by sysfs interface or removing module.
Below kmemleak trace is seen for this issue:
unreferenced object 0xffff888100aabff8 (size 8):
comm "bash", pid 323, jiffies 4295059233
hex dump (first 8 bytes):
07 00 00 00 00 00 00 00 ........
backtrace (crc ac50919):
__kmalloc_node_noprof+0x2e5/0x420
alloc_cpumask_var_node+0x1f/0x30
param_set_cpumask+0x26/0xb0 [locktorture]
param_attr_store+0x93/0x100
module_attr_store+0x1b/0x30
kernfs_fop_write_iter+0x114/0x1b0
vfs_write+0x300/0x410
ksys_write+0x60/0xd0
do_syscall_64+0xa4/0x260
entry_SYSCALL_64_after_hwframe+0x77/0x7fThis issue can be reproduced by:
insmod locktorture.ko bind_writers=1
rmmod locktorture
or:
insmod locktorture.ko bind_writers=1
echo 2 > /sys/module/locktorture/parameters/bind_writers
Considering that setting the module parameter 'bind_writers' or 'bind_readers' by sysfs interface has no real effect, set the parameter permissions to 0444. To fix the memory leak when removing module, free 'bind_writers' and 'bind_readers' memory in lock_torture_cleanup().
--- kernel/locking/locktorture.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/locking/locktorture.c +6 -2
@@ -103,8 +103,8 @@ static const struct kernel_param_ops lt_bind_ops = { .get = param_get_cpumask, }; -module_param_cb (bind_readers, <_bind_ops, &bind_readers,0644 ); -module_param_cb (bind_writers, <_bind_ops, &bind_writers,0644 ); +module_param_cb (bind_readers, <_bind_ops, &bind_readers,0444 ); +module_param_cb (bind_writers, <_bind_ops, &bind_writers,0444 );long torture_sched_setaffinity (pid_t pid,const struct cpumask *in_mask,bool dowarn);
@@ -1211,6 +1211,10 @@ static void lock_torture_cleanup(void) cxt.cur_ops->exit (); cxt.init_called = false; } + +free_cpumask_var (bind_readers); +free_cpumask_var (bind_writers); +torture_cleanup_end (); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 180/507 wifi: rtw89: usb: use common error path for skbs in rtw89_usb_rx_handler()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit 28a45575289f3292aa9cb7bacae18ba3ee7a6adf ]
Allow adding rx_skb to rx_free_queue for later reuse on the common error handling path, otherwise free it.
Found by Linux Verification Center (linuxtesting.org).
--- drivers/net/wireless/realtek/rtw89/usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/usb.c +3 -3
@@ -410,8 +410,7 @@ static void rtw89_usb_rx_handler(struct work_struct *work)if (skb_queue_len (&rtwusb->rx_queue) >=RTW89_USB_MAX_RXQ_LEN ) {rtw89_warn (rtwdev,"rx_queue overflow\n" ); -dev_kfree_skb_any (rx_skb); -continue ; + goto free_or_reuse; }memset (&desc_info,0 ,sizeof (desc_info));
@@ -422,7 +421,7 @@ static void rtw89_usb_rx_handler(struct work_struct *work)rtw89_debug (rtwdev,RTW89_DBG_HCI ,"failed to allocate RX skb of size %u\n" , desc_info.pkt_size); -continue ; + goto free_or_reuse; } pkt_offset = desc_info.offset + desc_info.rxd_len;
@@ -432,6 +431,7 @@ static void rtw89_usb_rx_handler(struct work_struct *work)rtw89_core_rx (rtwdev, &desc_info, skb); +free_or_reuse:if (skb_queue_len (&rtwusb->rx_free_queue) >=RTW89_USB_RX_SKB_NUM )dev_kfree_skb_any (rx_skb);else
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 181/507 wifi: rtw89: usb: fix leak in rtw89_usb_write_port()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit 7543818e97d5d54b3b2f75f1c4dedee298d7d914 ]
When there is an attempt to write data and RTW89_FLAG_UNPLUGGED is set, this means device is disconnected and no urb is submitted. Return appropriate error code to the caller to properly free the allocated resources.
Found by Linux Verification Center (linuxtesting.org).
--- drivers/net/wireless/realtek/rtw89/usb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/usb.c +4 -3
@@ -256,7 +256,7 @@ static int rtw89_usb_write_port(struct rtw89_dev *rtwdev, u8 ch_dma,int ret;if (test_bit (RTW89_FLAG_UNPLUGGED , rtwdev->flags)) -return 0 ; +return -ENODEV ; urb =usb_alloc_urb (0 ,GFP_ATOMIC );if (!urb)
@@ -305,8 +305,9 @@ static void rtw89_usb_ops_tx_kick_off(struct rtw89_dev *rtwdev, u8 txch) ret =rtw89_usb_write_port (rtwdev, txch, skb->data, skb->len, txcb);if (ret) { -rtw89_err (rtwdev,"write port txch %d failed: %d\n" , - txch, ret); +if (ret != -ENODEV ) +rtw89_err (rtwdev,"write port txch %d failed: %d\n" , + txch, ret);skb_dequeue (&txcb->tx_ack_queue);kfree (txcb);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 182/507 mfd: da9055: Fix missing regmap_del_irq_chip() in error path
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 1b58acfd067ca16116b9234cd6b2d30cc8ab7502 ]
When da9055_device_init() fails after regmap_add_irq_chip() succeeds but mfd_add_devices() fails, the error handling path only calls mfd_remove_devices() but forgets to call regmap_del_irq_chip(). This results in a resource leak.
Fix this by adding regmap_del_irq_chip() to the error path so that resources are released properly.
--- drivers/mfd/da9055-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/da9055-core.c +1 -0
@@ -388,6 +388,7 @@ int da9055_device_init(struct da9055 *da9055) err:mfd_remove_devices (da9055->dev); +regmap_del_irq_chip (da9055->chip_irq, da9055->irq_data);return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 183/507 wifi: ath12k: Fix timeout error during beacon stats retrieval
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manish Dharanenthiran <[email protected]>
[ Upstream commit 2977567b244f056d86658160659f06cd6c78ba3d ]
Currently, for beacon_stats, ath12k_mac_get_fw_stats() is called for each started BSS on the specified hardware. ath12k_mac_get_fw_stats() will wait for the fw_stats_done completion after fetching the requested data from firmware. For the beacon_stats, fw_stats_done completion will be set only when stats are received for all BSSes. However, for other stats like vdev_stats or pdev_stats, there is one request to the firmware for all enabled BSSes. Since beacon_stats is fetched individually for all BSSes enabled in that pdev, waiting for the completion event results in a timeout error when multiple BSSes are enabled.
Avoid this by completing the fw_stats_done immediately after updating the requested BSS's beacon stats in the list. Subsequently, this list will be used to display the beacon stats for all enabled BSSes in the requested pdev.
Additionally, remove 'num_bcn_recvd' from the ath12k_fw_stats struct as it is no longer needed.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/core.c | 2 -- drivers/net/wireless/ath/ath12k/core.h | 1 - drivers/net/wireless/ath/ath12k/wmi.c | 10 +--------- 3 files changed, 1 insertion(+), 12 deletions(-)
drivers/net/wireless/ath/ath12k/core.c +0 -2
@@ -1,7 +1,6 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */
@@ -1250,7 +1249,6 @@ void ath12k_fw_stats_reset(struct ath12k *ar)spin_lock_bh (&ar->data_lock);ath12k_fw_stats_free (&ar->fw_stats); ar->fw_stats.num_vdev_recvd =0 ; - ar->fw_stats.num_bcn_recvd =0 ;spin_unlock_bh (&ar->data_lock); }
drivers/net/wireless/ath/ath12k/core.h +0 -1
@@ -640,7 +640,6 @@ struct ath12k_fw_stats {struct list_head vdevs;struct list_head bcn;u32 num_vdev_recvd; -u32 num_bcn_recvd; };struct ath12k_dbg_htt_stats {
drivers/net/wireless/ath/ath12k/wmi.c +1 -9
@@ -8298,18 +8298,10 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar,ath12k_warn (ab,"empty beacon stats" );return ; } -/* Mark end until we reached the count of all started VDEVs -* within the PDEV -*/ -if (ar->num_started_vdevs) - is_end = ((++ar->fw_stats.num_bcn_recvd) == - ar->num_started_vdevs);list_splice_tail_init (&stats->bcn, &ar->fw_stats.bcn); - -if (is_end) -complete (&ar->fw_stats_done); +complete (&ar->fw_stats_done); } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 184/507 ext4: correct the checking of quota files before moving extents
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Yi <[email protected]>
[ Upstream commit a2e5a3cea4b18f6e2575acc444a5e8cce1fc8260 ]
The move extent operation should return -EOPNOTSUPP if any of the inodes is a quota inode, rather than requiring both to be quota inodes.
Message-ID: <[email protected]>
--- fs/ext4/move_extent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/move_extent.c +1 -1
@@ -485,7 +485,7 @@ mext_check_arguments(struct inode *orig_inode,return -ETXTBSY ; } -if (ext4_is_quota_file (orig_inode) &&ext4_is_quota_file (donor_inode)) { +if (ext4_is_quota_file (orig_inode) ||ext4_is_quota_file (donor_inode)) {ext4_debug ("ext4 move extent: The argument files should not be quota files [ino:orig %lu, donor %lu]\n" , orig_inode->i_ino, donor_inode->i_ino);return -EOPNOTSUPP ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 185/507 accel/amdxdna: Fix dma_fence leak when job is canceled
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <[email protected]>
[ Upstream commit dea9f84776b96a703f504631ebe9fea07bd2c181 ]
Currently, dma_fence_put(job->fence) is called in job notification callback. However, if a job is canceled, the notification callback is never invoked, leading to a memory leak. Move dma_fence_put(job->fence) to the job cleanup function to ensure the fence is always released.
--- drivers/accel/amdxdna/aie2_ctx.c | 1 - drivers/accel/amdxdna/amdxdna_ctx.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/accel/amdxdna/aie2_ctx.c +0 -1
@@ -183,7 +183,6 @@ aie2_sched_notify(struct amdxdna_sched_job *job)up (&job->hwctx->priv->job_sem); job->job_done = true; -dma_fence_put (fence);mmput_async (job->mm);aie2_job_put (job); }
drivers/accel/amdxdna/amdxdna_ctx.c +1 -0
@@ -375,6 +375,7 @@ void amdxdna_sched_job_cleanup(struct amdxdna_sched_job *job)trace_amdxdna_debug_point (job->hwctx->name, job->seq,"job release" );amdxdna_arg_bos_put (job);amdxdna_gem_put_obj (job->cmd_bo); +dma_fence_put (job->fence); } int amdxdna_cmd_submit(struct amdxdna_client *client,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 186/507 io_uring: use WRITE_ONCE for user shared memory
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ Upstream commit 93e197e524b14d185d011813b72773a1a49d932d ]
IORING_SETUP_NO_MMAP rings remain user accessible even before the ctx setup is finalised, so use WRITE_ONCE consistently when initialising rings.
--- io_uring/io_uring.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
io_uring/io_uring.c +6 -4
@@ -3570,10 +3570,6 @@ static __cold int io_allocate_scq_urings(struct io_ring_ctx *ctx,if (!(ctx->flags &IORING_SETUP_NO_SQARRAY )) ctx->sq_array = (u32 *)((char *)rings + sq_array_offset); - rings->sq_ring_mask = p->sq_entries -1 ; - rings->cq_ring_mask = p->cq_entries -1 ; - rings->sq_ring_entries = p->sq_entries; - rings->cq_ring_entries = p->cq_entries;if (p->flags &IORING_SETUP_SQE128 ) size =array_size (2 *sizeof (struct io_uring_sqe ), p->sq_entries);
@@ -3596,6 +3592,12 @@ static __cold int io_allocate_scq_urings(struct io_ring_ctx *ctx,return ret; } ctx->sq_sqes =io_region_get_ptr (&ctx->sq_region); + +memset (rings,0 ,sizeof (*rings)); +WRITE_ONCE (rings->sq_ring_mask, ctx->sq_entries -1 ); +WRITE_ONCE (rings->cq_ring_mask, ctx->cq_entries -1 ); +WRITE_ONCE (rings->sq_ring_entries, ctx->sq_entries); +WRITE_ONCE (rings->cq_ring_entries, ctx->cq_entries);return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 187/507 perf/x86: Fix NULL event access and potential PEBS record loss
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dapeng Mi <[email protected]>
[ Upstream commit 7e772a93eb61cb6265bdd1c5bde17d0f2718b452 ]
When intel_pmu_drain_pebs_icl() is called to drain PEBS records, the perf_event_overflow() could be called to process the last PEBS record.
While perf_event_overflow() could trigger the interrupt throttle and stop all events of the group, like what the below call-chain shows.
perf_event_overflow()
-> __perf_event_overflow()
->__perf_event_account_interrupt()
-> perf_event_throttle_group()
-> perf_event_throttle()
-> event->pmu->stop()
-> x86_pmu_stop()The side effect of stopping the events is that all corresponding event pointers in cpuc->events[] array are cleared to NULL.
Assume there are two PEBS events (event a and event b) in a group. When intel_pmu_drain_pebs_icl() calls perf_event_overflow() to process the last PEBS record of PEBS event a, interrupt throttle is triggered and all pointers of event a and event b are cleared to NULL. Then intel_pmu_drain_pebs_icl() tries to process the last PEBS record of event b and encounters NULL pointer access.
To avoid this issue, move cpuc->events[] clearing from x86_pmu_stop() to x86_pmu_del(). It's safe since cpuc->active_mask or cpuc->pebs_enabled is always checked before access the event pointer from cpuc->events[].
--- arch/x86/events/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/events/core.c +3 -2
@@ -1344,6 +1344,7 @@ static void x86_pmu_enable(struct pmu *pmu) hwc->state |=PERF_HES_ARCH ;x86_pmu_stop (event,PERF_EF_UPDATE ); + cpuc->events[hwc->idx] =NULL ; }/*
@@ -1365,6 +1366,7 @@ static void x86_pmu_enable(struct pmu *pmu)* if cpuc->enabled = 0, then no wrmsr as * per x86_pmu_enable_event() */ + cpuc->events[hwc->idx] = event;x86_pmu_start (event,PERF_EF_RELOAD ); } cpuc->n_added =0 ;
@@ -1531,7 +1533,6 @@ static void x86_pmu_start(struct perf_event *event, int flags) event->hw.state =0 ; - cpuc->events[idx] = event;__set_bit (idx, cpuc->active_mask);static_call (x86_pmu_enable)(event);perf_event_update_userpage (event);
@@ -1610,7 +1611,6 @@ void x86_pmu_stop(struct perf_event *event, int flags)if (test_bit (hwc->idx, cpuc->active_mask)) {static_call (x86_pmu_disable)(event);__clear_bit (hwc->idx, cpuc->active_mask); - cpuc->events[hwc->idx] =NULL ;WARN_ON_ONCE (hwc->state &PERF_HES_STOPPED ); hwc->state |=PERF_HES_STOPPED ; }
@@ -1648,6 +1648,7 @@ static void x86_pmu_del(struct perf_event *event, int flags)* Not a TXN, therefore cleanup properly. */ x86_pmu_stop (event,PERF_EF_UPDATE ); + cpuc->events[event->hw.idx] =NULL ;for (i =0 ; i < cpuc->n_events; i++) {if (event == cpuc->event_list[i])
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 188/507 perf/x86/intel: Correct large PEBS flag check
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dapeng Mi <[email protected]>
[ Upstream commit 5e4e355ae7cdeb0fef5dbe908866e1f895abfacc ]
current large PEBS flag check only checks if sample_regs_user contains unsupported GPRs but doesn't check if sample_regs_intr contains unsupported GPRs.
Of course, currently PEBS HW supports to sample all perf supported GPRs, the missed check doesn't cause real issue. But it won't be true any more after the subsequent patches support to sample SSP register. SSP sampling is not supported by adaptive PEBS HW and it would be supported until arch-PEBS HW. So correct this issue.
--- arch/x86/events/intel/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/events/intel/core.c +3 -1
@@ -4029,7 +4029,9 @@ static unsigned long intel_pmu_large_pebs_flags(struct perf_event *event)if (!event->attr.exclude_kernel) flags &= ~PERF_SAMPLE_REGS_USER ;if (event->attr.sample_regs_user & ~PEBS_GP_REGS ) - flags &= ~(PERF_SAMPLE_REGS_USER |PERF_SAMPLE_REGS_INTR ); + flags &= ~PERF_SAMPLE_REGS_USER ; +if (event->attr.sample_regs_intr & ~PEBS_GP_REGS ) + flags &= ~PERF_SAMPLE_REGS_INTR ;return flags; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 189/507 regulator: core: disable supply if enabling main regulator fails
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabor Juhos <[email protected]>
[ Upstream commit fb1ebb10468da414d57153ddebaab29c38ef1a78 ]
For 'always-on' and 'boot-on' regulators, the set_machine_constraints() may enable supply before enabling the main regulator, however if the latter fails, the function returns with an error but the supply remains enabled.
When this happens, the regulator_register() function continues on the error path where it puts the supply regulator. Since enabling the supply is not balanced with a disable call, a warning similar to the following gets issued from _regulator_put():
[ 1.603889] WARNING: CPU: 2 PID: 44 at _regulator_put+0x8c/0xa0
[ 1.603908] Modules linked in:
[ 1.603926] CPU: 2 UID: 0 PID: 44 Comm: kworker/u16:3 Not tainted 6.18.0-rc4 #0 NONE
[ 1.603938] Hardware name: Qualcomm Technologies, Inc. IPQ9574/AP-AL02-C7 (DT)
[ 1.603945] Workqueue: async async_run_entry_fn
[ 1.603958] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 1.603967] pc : _regulator_put+0x8c/0xa0
[ 1.603976] lr : _regulator_put+0x7c/0xa0
...
[ 1.604140] Call trace:
[ 1.604145] _regulator_put+0x8c/0xa0 (P)
[ 1.604156] regulator_register+0x2ec/0xbf0
[ 1.604166] devm_regulator_register+0x60/0xb0
[ 1.604178] rpm_reg_probe+0x120/0x208
[ 1.604187] platform_probe+0x64/0xa8
...In order to avoid this, change the set_machine_constraints() function to disable the supply if enabling the main regulator fails.
--- drivers/regulator/core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/regulator/core.c +5 -0
@@ -1618,6 +1618,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)* and we have control then make sure it is enabled. */ if (rdev->constraints->always_on || rdev->constraints->boot_on) { +bool supply_enabled = false; +/* If we want to enable this regulator, make sure that we know * the supplying regulator. */
@@ -1637,11 +1639,14 @@ static int set_machine_constraints(struct regulator_dev *rdev) rdev->supply =NULL ;return ret; } + supply_enabled = true; } ret =_regulator_do_enable (rdev);if (ret <0 && ret != -EINVAL ) {rdev_err (rdev,"failed to enable: %pe\n" ,ERR_PTR (ret)); +if (supply_enabled) +regulator_disable (rdev->supply);return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 190/507 md: delete mddev kobj before deleting gendisk kobj
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Ni <[email protected]>
[ Upstream commit cc394b94dc40b661efc9895665abf03640ffff2d ]
In sync del gendisk path, it deletes gendisk first and the directory /sys/block/md is removed. Then it releases mddev kobj in a delayed work. If we enable debug log in sysfs_remove_group, we can see the debug log 'sysfs group bitmap not found for kobject md'. It's the reason that the parent kobj has been deleted, so it can't find parent directory.
In creating path, it allocs gendisk first, then adds mddev kobj. So it should delete mddev kobj before deleting gendisk.
Before commit 9e59d609763f ("md: call del_gendisk in control path"), it releases mddev kobj first. If the kobj hasn't been deleted, it does clean job and deletes the kobj. Then it calls del_gendisk and releases gendisk kobj. So it doesn't need to call kobject_del to delete mddev kobj. After this patch, in sync del gendisk path, the sequence changes. So it needs to call kobject_del to delete mddev kobj.
After this patch, the sequence is:
1. kobject del mddev kobj
2. del_gendisk deletes gendisk kobj
3. mddev_delayed_delete releases mddev kobj
4. md_kobj_release releases gendisk kobj
--- drivers/md/md.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/md.c +3 -1
@@ -887,8 +887,10 @@ void mddev_unlock(struct mddev *mddev)* do_md_stop. dm raid only uses md_stop to stop. So dm raid * doesn't need to check MD_DELETED when getting reconfig lock */ -if (test_bit (MD_DELETED , &mddev->flags)) +if (test_bit (MD_DELETED , &mddev->flags)) { +kobject_del (&mddev->kobj);del_gendisk (mddev->gendisk); + } } }EXPORT_SYMBOL_GPL (mddev_unlock);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 191/507 md: fix rcu protection in md_wakeup_thread
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yun Zhou <[email protected]>
[ Upstream commit 0dc76205549b4c25705e54345f211b9f66e018a0 ]
We attempted to use RCU to protect the pointer 'thread', but directly passed the value when calling md_wakeup_thread(). This means that the RCU pointer has been acquired before rcu_read_lock(), which renders rcu_read_lock() ineffective and could lead to a use-after-free.
--- drivers/md/md.c | 14 ++++++-------- drivers/md/md.h | 8 +++++++- 2 files changed, 13 insertions(+), 9 deletions(-)
drivers/md/md.c +6 -8
@@ -100,7 +100,7 @@ static int remove_and_add_spares(struct mddev *mddev, struct md_rdev *this);static void mddev_detach (struct mddev *mddev);static void export_rdev (struct md_rdev *rdev,struct mddev *mddev); -static void md_wakeup_thread_directly (struct md_thread __rcu *thread); +static void md_wakeup_thread_directly (struct md_thread __rcu **thread);/* * Default number of read corrections we'll attempt on an rdev
@@ -4984,7 +4984,7 @@ static void stop_sync_thread(struct mddev *mddev, bool locked)* Thread might be blocked waiting for metadata update which will now * never happen */ -md_wakeup_thread_directly (mddev->sync_thread); +md_wakeup_thread_directly (&mddev->sync_thread);if (work_pending (&mddev->sync_work))flush_work (&mddev->sync_work);
@@ -8196,22 +8196,21 @@ static int md_thread(void *arg)return 0 ; } -static void md_wakeup_thread_directly (struct md_thread __rcu *thread) +static void md_wakeup_thread_directly (struct md_thread __rcu **thread) {struct md_thread *t;rcu_read_lock (); - t =rcu_dereference (thread); + t =rcu_dereference (*thread);if (t)wake_up_process (t->tsk);rcu_read_unlock (); } -void md_wakeup_thread (struct md_thread __rcu *thread) +void __md_wakeup_thread (struct md_thread __rcu *thread) {struct md_thread *t; -rcu_read_lock (); t =rcu_dereference (thread);if (t) {pr_debug ("md: waking up MD thread %s.\n" , t->tsk->comm);
@@ -8219,9 +8218,8 @@ void md_wakeup_thread(struct md_thread __rcu *thread)if (wq_has_sleeper (&t->wqueue))wake_up (&t->wqueue); } -rcu_read_unlock (); } -EXPORT_SYMBOL (md_wakeup_thread); +EXPORT_SYMBOL (__md_wakeup_thread);struct md_thread *md_register_thread (void (*run) (struct md_thread *),struct mddev *mddev,const char *name)
drivers/md/md.h +7 -1
@@ -878,6 +878,12 @@ struct md_io_clone {#define THREAD_WAKEUP 0 +#define md_wakeup_thread (thread) do { \ + rcu_read_lock(); \ + __md_wakeup_thread(thread); \ + rcu_read_unlock(); \ +} while (0) +static inline void safe_put_page (struct page *p) {if (p)put_page (p);
@@ -891,7 +897,7 @@ extern struct md_thread *md_register_thread(struct mddev *mddev, const char *name);extern void md_unregister_thread (struct mddev *mddev,struct md_thread __rcu **threadp); -extern void md_wakeup_thread (struct md_thread __rcu *thread); +extern void __md_wakeup_thread (struct md_thread __rcu *thread);extern void md_check_recovery (struct mddev *mddev);extern void md_reap_sync_thread (struct mddev *mddev);extern enum sync_action md_sync_action (struct mddev *mddev);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 192/507 md: avoid repeated calls to del_gendisk
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Ni <[email protected]>
[ Upstream commit 90e3bb44c0a86e245d8e5c6520206fa113acb1ee ]
There is a uaf problem which is found by case 23rdev-lifetime:
Oops: general protection fault, probably for non-canonical address 0xdead000000000122 RIP: 0010:bdi_unregister+0x4b/0x170 Call Trace: <TASK> __del_gendisk+0x356/0x3e0 mddev_unlock+0x351/0x360 rdev_attr_store+0x217/0x280 kernfs_fop_write_iter+0x14a/0x210 vfs_write+0x29e/0x550 ksys_write+0x74/0xf0 do_syscall_64+0xbb/0x380 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff5250a177e
The sequence is:
1. rdev remove path gets reconfig_mutex
2. rdev remove path release reconfig_mutex in mddev_unlock
3. md stop calls do_md_stop and sets MD_DELETED
4. rdev remove path calls del_gendisk because MD_DELETED is set
5. md stop path release reconfig_mutex and calls del_gendisk again
So there is a race condition we should resolve. This patch adds a flag MD_DO_DELETE to avoid the race condition.
--- drivers/md/md.c | 3 ++- drivers/md/md.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/md/md.c +2 -1
@@ -887,7 +887,8 @@ void mddev_unlock(struct mddev *mddev)* do_md_stop. dm raid only uses md_stop to stop. So dm raid * doesn't need to check MD_DELETED when getting reconfig lock */ -if (test_bit (MD_DELETED , &mddev->flags)) { +if (test_bit (MD_DELETED , &mddev->flags) && + !test_and_set_bit (MD_DO_DELETE , &mddev->flags)) {kobject_del (&mddev->kobj);del_gendisk (mddev->gendisk); }
drivers/md/md.h +1 -0
@@ -353,6 +353,7 @@ enum mddev_flags {MD_HAS_MULTIPLE_PPLS ,MD_NOT_READY ,MD_BROKEN , +MD_DO_DELETE , MD_DELETED, };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 193/507 nbd: defer config put in recv_work
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Qixing <[email protected]>
[ Upstream commit 9517b82d8d422d426a988b213fdd45c6b417b86d ]
There is one uaf issue in recv_work when running NBD_CLEAR_SOCK and NBD_CMD_RECONFIGURE:
nbd_genl_connect // conf_ref=2 (connect and recv_work A)
nbd_open // conf_ref=3
recv_work A done // conf_ref=2
NBD_CLEAR_SOCK // conf_ref=1
nbd_genl_reconfigure // conf_ref=2 (trigger recv_work B)
close nbd // conf_ref=1
recv_work B
config_put // conf_ref=0
atomic_dec(&config->recv_threads); -> UAF
Or only running NBD_CLEAR_SOCK:
nbd_genl_connect // conf_ref=2
nbd_open // conf_ref=3
NBD_CLEAR_SOCK // conf_ref=2
close nbd
nbd_release
config_put // conf_ref=1
recv_work
config_put // conf_ref=0
atomic_dec(&config->recv_threads); -> UAF
Commit 87aac3a80af5 ("nbd: call nbd_config_put() before notifying the waiter") moved nbd_config_put() to run before waking up the waiter in recv_work, in order to ensure that nbd_start_device_ioctl() would not be woken up while nbd->task_recv was still uncleared.
However, in nbd_start_device_ioctl(), after being woken up it explicitly calls flush_workqueue() to make sure all current works are finished. Therefore, there is no need to move the config put ahead of the wakeup.
Move nbd_config_put() to the end of recv_work, so that the reference is held for the whole lifetime of the worker thread. This makes sure the config cannot be freed while recv_work is still running, even if clear
+ reconfigure interleave.
In addition, we don't need to worry about recv_work dropping the last nbd_put (which causes deadlock):
path A (netlink with NBD_CFLAG_DESTROY_ON_DISCONNECT):
connect // nbd_refs=1 (trigger recv_work) open nbd // nbd_refs=2
NBD_CLEAR_SOCK
close nbd
nbd_release
nbd_disconnect_and_put
flush_workqueue // recv_work done
nbd_config_put
nbd_put // nbd_refs=1
nbd_put // nbd_refs=0
queue_workpath B (netlink without NBD_CFLAG_DESTROY_ON_DISCONNECT):
connect // nbd_refs=2 (trigger recv_work) open nbd // nbd_refs=3
NBD_CLEAR_SOCK // conf_refs=2
close nbd
nbd_release
nbd_config_put // conf_refs=1
nbd_put // nbd_refs=2
recv_work done // conf_refs=0, nbd_refs=1 rmmod // nbd_refs=0
Depends-on: e2daec488c57 ("nbd: Fix hungtask when nbd_config_put")
--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/nbd.c +1 -1
@@ -1024,9 +1024,9 @@ static void recv_work(struct work_struct *work)nbd_mark_nsock_dead (nbd, nsock,1 );mutex_unlock (&nsock->tx_lock); -nbd_config_put (nbd);atomic_dec (&config->recv_threads);wake_up (&config->recv_wq); +nbd_config_put (nbd);kfree (args); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 194/507 scsi: stex: Fix reboot_notifier leak in probe error path
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 20da637eb545b04753e20c675cfe97b04c7b600b ]
In stex_probe(), register_reboot_notifier() is called at the beginning, but if any subsequent initialization step fails, the function returns without unregistering the notifier, resulting in a resource leak.
Add unregister_reboot_notifier() in the out_disable error path to ensure proper cleanup on all failure paths.
--- drivers/scsi/stex.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/stex.c +1 -0
@@ -1844,6 +1844,7 @@ static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) out_scsi_host_put:scsi_host_put (host); out_disable: +unregister_reboot_notifier (&stex_notifier);pci_disable_device (pdev);return err;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 195/507 scsi: smartpqi: Fix device resources accessed after device removal
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike McGowen <[email protected]>
[ Upstream commit b518e86d1a70a88f6592a7c396cf1b93493d1aab ]
Correct possible race conditions during device removal.
Previously, a scheduled work item to reset a LUN could still execute after the device was removed, leading to use-after-free and other resource access issues.
This race condition occurs because the abort handler may schedule a LUN reset concurrently with device removal via sdev_destroy(), leading to use-after-free and improper access to freed resources.
- Check in the device reset handler if the device is still present in the controller's SCSI device list before running; if not, the reset is skipped.
- Cancel any pending TMF work that has not started in sdev_destroy().
- Ensure device freeing in sdev_destroy() is done while holding the LUN reset mutex to avoid races with ongoing resets.
--- drivers/scsi/smartpqi/smartpqi_init.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/scsi/smartpqi/smartpqi_init.c +19 -0
@@ -6409,10 +6409,22 @@ static int pqi_device_reset(struct pqi_ctrl_info *ctrl_info, struct pqi_scsi_devstatic int pqi_device_reset_handler (struct pqi_ctrl_info *ctrl_info,struct pqi_scsi_dev *device,u8 lun,struct scsi_cmnd *scmd,u8 scsi_opcode) { +unsigned long flags;int rc;mutex_lock (&ctrl_info->lun_reset_mutex); +spin_lock_irqsave (&ctrl_info->scsi_device_list_lock, flags); +if (pqi_find_scsi_dev (ctrl_info, device->bus, device->target, device->lun) ==NULL ) { +dev_warn (&ctrl_info->pci_dev->dev, +"skipping reset of scsi %d:%d:%d:%u, device has been removed\n" , + ctrl_info->scsi_host->host_no, device->bus, device->target, device->lun); +spin_unlock_irqrestore (&ctrl_info->scsi_device_list_lock, flags); +mutex_unlock (&ctrl_info->lun_reset_mutex); +return 0 ; + } +spin_unlock_irqrestore (&ctrl_info->scsi_device_list_lock, flags); +dev_err (&ctrl_info->pci_dev->dev,"resetting scsi %d:%d:%d:%u SCSI cmd at %p due to cmd opcode 0x%02x\n" , ctrl_info->scsi_host->host_no, device->bus, device->target, lun, scmd, scsi_opcode);
@@ -6593,7 +6605,9 @@ static void pqi_sdev_destroy(struct scsi_device *sdev) {struct pqi_ctrl_info *ctrl_info;struct pqi_scsi_dev *device; +struct pqi_tmf_work *tmf_work;int mutex_acquired; +unsigned int lun;unsigned long flags; ctrl_info =shost_to_hba (sdev->host);
@@ -6620,8 +6634,13 @@ static void pqi_sdev_destroy(struct scsi_device *sdev)mutex_unlock (&ctrl_info->scan_mutex); +for (lun =0 , tmf_work = device->tmf_work; lun <PQI_MAX_LUNS_PER_DEVICE ; lun++, tmf_work++) +cancel_work_sync (&tmf_work->work_struct); + +mutex_lock (&ctrl_info->lun_reset_mutex);pqi_dev_info (ctrl_info,"removed" , device);pqi_free_device (device); +mutex_unlock (&ctrl_info->lun_reset_mutex); }static int pqi_getpciinfo_ioctl (struct pqi_ctrl_info *ctrl_info,void __user *arg)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 196/507 staging: most: remove broken i2c driver
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit 495df2da6944477d282d5cc0c13174d06e25b310 ]
The MOST I2C driver has been completely broken for five years without anyone noticing so remove the driver from staging.
Specifically, commit 723de0f9171e ("staging: most: remove device from interface structure") started requiring drivers to set the interface device pointer before registration, but the I2C driver was never updated which results in a NULL pointer dereference if anyone ever tries to probe it.
--- drivers/staging/most/Kconfig | 2 - drivers/staging/most/Makefile | 1 - drivers/staging/most/i2c/Kconfig | 13 -- drivers/staging/most/i2c/Makefile | 4 - drivers/staging/most/i2c/i2c.c | 374 ------------------------------ 5 files changed, 394 deletions(-) delete mode 100644 drivers/staging/most/i2c/Kconfig delete mode 100644 drivers/staging/most/i2c/Makefile delete mode 100644 drivers/staging/most/i2c/i2c.c
drivers/staging/most/Kconfig +0 -2
@@ -24,6 +24,4 @@ source "drivers/staging/most/video/Kconfig" source "drivers/staging/most/dim2/Kconfig" -source "drivers/staging/most/i2c/Kconfig" - endif
drivers/staging/most/Makefile +0 -1
@@ -3,4 +3,3 @@ obj-$(CONFIG_MOST_NET) += net/ obj-$(CONFIG_MOST_VIDEO) += video/ obj-$(CONFIG_MOST_DIM2) += dim2/ -obj-$(CONFIG_MOST_I2C) += i2c/
drivers/staging/most/i2c/Kconfig deleted +0 -13
@@ -1,13 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# MOST I2C configuration -# - -config MOST_I2C - tristate "I2C" - depends on I2C - help - Say Y here if you want to connect via I2C to network transceiver. - - To compile this driver as a module, choose M here: the - module will be called most_i2c.
drivers/staging/most/i2c/Makefile deleted +0 -4
@@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_MOST_I2C) += most_i2c.o - -most_i2c-objs := i2c.o
drivers/staging/most/i2c/i2c.c deleted +0 -374
374 lines not on this page · raw message
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 197/507 iio: imu: bmi270: fix dev_err_probe error msg
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rodrigo Gobbi <[email protected]>
[ Upstream commit 02f86101e430cce9a99a044b483c4ed5b91bb3b8 ]
The bmi270 can be connected to I2C or a SPI interface. If it is a SPI, during probe, if devm_regmap_init() fails, it should print the "spi" term rather "i2c".
--- drivers/iio/imu/bmi270/bmi270_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/bmi270/bmi270_spi.c +1 -1
@@ -60,7 +60,7 @@ static int bmi270_spi_probe(struct spi_device *spi) &bmi270_spi_regmap_config);if (IS_ERR (regmap))return dev_err_probe (dev,PTR_ERR (regmap), -"Failed to init i2c regmap" ); +"Failed to init spi regmap\n" );return bmi270_core_probe (dev, regmap, chip_info); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 198/507 dt-bindings: PCI: amlogic: Fix the register name of the DBI region
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 4813dea9e272ba0a57c50b8d51d440dd8e3ccdd7 ]
Binding incorrectly specifies the 'DBI' region as 'ELBI'. DBI is a must have region for DWC controllers as it has the Root Port and controller specific registers, while ELBI has optional registers.
Hence, fix the binding. Though this is an ABI break, this change is needed to accurately describe the PCI memory map.
--- Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml +3 -3
@@ -36,13 +36,13 @@ properties: reg: items: - - description: External local bus interface registers + - description: Data Bus Interface registers - description: Meson designed configuration registers - description: PCIe configuration space reg-names: items: - - const: elbi + - const: dbi - const: cfg - const: config
@@ -113,7 +113,7 @@ examples: pcie: pcie@f9800000 { compatible = "amlogic,axg-pcie", "snps,dw-pcie"; reg = <0xf9800000 0x400000>, <0xff646000 0x2000>, <0xf9f00000 0x100000>; - reg-names = "elbi", "cfg", "config"; + reg-names = "dbi", "cfg", "config"; interrupts = <GIC_SPI 177 IRQ_TYPE_EDGE_RISING>; clocks = <&pclk>, <&clk_port>, <&clk_phy>; clock-names = "pclk", "port", "general";
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 199/507 RDMA/rtrs: server: Fix error handling in get_or_create_srv
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ma Ke <[email protected]>
[ Upstream commit a338d6e849ab31f32c08b4fcac11c0c72afbb150 ]
After device_initialize() is called, use put_device() to release the device according to kernel device management rules. While direct kfree() work in this case, using put_device() is more correct.
Found by code review.
--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +1 -1
@@ -1450,7 +1450,7 @@ static struct rtrs_srv_sess *get_or_create_srv(struct rtrs_srv_ctx *ctx,kfree (srv->chunks); err_free_srv: -kfree (srv); +put_device (&srv->dev);return ERR_PTR (-ENOMEM ); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 200/507 ARM: dts: stm32: stm32mp157c-phycore: Fix STMPE811 touchscreen node properties
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jihed Chaibi <[email protected]>
[ Upstream commit e40b061cd379f4897e705d17cf1b4572ad0f3963 ]
Move st,adc-freq, st,mod-12b, st,ref-sel, and st,sample-time properties from the touchscreen subnode to the parent touch@44 node. These properties are defined in the st,stmpe.yaml schema for the parent node, not the touchscreen subnode, resolving the validation error about unevaluated properties.
--- .../boot/dts/st/stm32mp157c-phycore-stm32mp15-som.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/st/stm32mp157c-phycore-stm32mp15-som.dtsi +4 -4
@@ -185,13 +185,13 @@ touch@44 { interrupt-parent = <&gpioi>; vio-supply = <&v3v3>; vcc-supply = <&v3v3>; + st,sample-time = <4>; + st,mod-12b = <1>; + st,ref-sel = <0>; + st,adc-freq = <1>; touchscreen { compatible = "st,stmpe-ts"; - st,sample-time = <4>; - st,mod-12b = <1>; - st,ref-sel = <0>; - st,adc-freq = <1>; st,ave-ctrl = <1>; st,touch-det-delay = <2>; st,settling = <2>;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 201/507 coresight: tmc: add the handle of the event to the path
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carl Worth <[email protected]>
[ Upstream commit aaa5abcc9d44d2c8484f779ab46d242d774cabcb ]
The handle is essential for retrieving the AUX_EVENT of each CPU and is required in perf mode. It has been added to the coresight_path so that dependent devices can access it from the path when needed.
The existing bug can be reproduced with:
perf record -e cs_etm//k -C 0-9 dd if=/dev/zero of=/dev/null
Showing an oops as follows:
Unable to handle kernel paging request at virtual address 000f6e84934ed19e Call trace: tmc_etr_get_buffer+0x30/0x80 [coresight_tmc] (P) catu_enable_hw+0xbc/0x3d0 [coresight_catu] catu_enable+0x70/0xe0 [coresight_catu] coresight_enable_path+0xb0/0x258 [coresight]
--- drivers/hwtracing/coresight/coresight-etm-perf.c | 1 + drivers/hwtracing/coresight/coresight-tmc-etr.c | 3 ++- include/linux/coresight.h | 10 ++++++---- 3 files changed, 9 insertions(+), 5 deletions(-)
drivers/hwtracing/coresight/coresight-etm-perf.c +1 -0
@@ -520,6 +520,7 @@ static void etm_event_start(struct perf_event *event, int flags) goto out; path =etm_event_cpu_path (event_data, cpu); + path->handle = handle;/* We need a sink, no need to continue without one */ sink =coresight_get_sink (path);if (WARN_ON_ONCE (!sink))
drivers/hwtracing/coresight/coresight-tmc-etr.c +2 -1
@@ -1334,7 +1334,8 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev)struct etr_buf *tmc_etr_get_buffer (struct coresight_device *csdev,enum cs_mode mode,void *data) { -struct perf_output_handle *handle = data; +struct coresight_path *path = data; +struct perf_output_handle *handle = path->handle;struct etr_perf_buffer *etr_perf;switch (mode) {
include/linux/coresight.h +6 -4
@@ -333,12 +333,14 @@ static struct coresight_dev_list (var) = { \/** * struct coresight_path - data needed by enable/disable path -* @path_list: path from source to sink. -* @trace_id: trace_id of the whole path. +* @path_list: path from source to sink. +* @trace_id: trace_id of the whole path. +* @handle: handle of the aux_event. */ struct coresight_path { -struct list_head path_list; -u8 trace_id; +struct list_head path_list; +u8 trace_id; +struct perf_output_handle *handle; };enum cs_mode {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 202/507 ntfs3: init run lock for extend inode
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit be99c62ac7e7af514e4b13f83c891a3cccefaa48 ]
After setting the inode mode of $Extend to a regular file, executing the truncate system call will enter the do_truncate() routine, causing the run_lock uninitialized error reported by syzbot.
Prior to patch 4e8011ffec79, if the inode mode of $Extend was not set to a regular file, the do_truncate() routine would not be entered.
Add the run_lock initialization when loading $Extend.
syzbot reported:
INFO: trying to register non-static key.
Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 assign_lock_key+0x133/0x150 kernel/locking/lockdep.c:984 register_lock_class+0x105/0x320 kernel/locking/lockdep.c:1299 __lock_acquire+0x99/0xd20 kernel/locking/lockdep.c:5112 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590 ntfs_set_size+0x140/0x200 fs/ntfs3/inode.c:860 ntfs_extend+0x1d9/0x970 fs/ntfs3/file.c:387 ntfs_setattr+0x2e8/0xbe0 fs/ntfs3/file.c:808
--- fs/ntfs3/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/ntfs3/inode.c +1 -0
@@ -472,6 +472,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,/* Records in $Extend are not a files or general directories. */ inode->i_op = &ntfs_file_inode_operations; mode =S_IFREG ; +init_rwsem (&ni->file.run_lock); }else { err = -EINVAL ; goto out;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 203/507 drm/panthor: Fix potential memleak of vma structure
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akash Goel <[email protected]>
[ Upstream commit 4492d54d59872bb72e119ff9f77969ab4d8a0e6b ]
This commit addresses a memleak issue of panthor_vma (or drm_gpuva) structure in Panthor driver, that can happen if the GPU page table update operation to map the pages fail.
The issue is very unlikely to occur in practice.
v2: Add panthor_vm_op_ctx_return_vma() helper (Boris)
v3: Add WARN_ON_ONCE (Boris)
--- drivers/gpu/drm/panthor/panthor_mmu.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/panthor/panthor_mmu.c +17 -1
@@ -1118,6 +1118,20 @@ static void panthor_vm_cleanup_op_ctx(struct panthor_vm_op_ctx *op_ctx, } } +static void +panthor_vm_op_ctx_return_vma (struct panthor_vm_op_ctx *op_ctx, +struct panthor_vma *vma) +{ +for (u32 i =0 ; i <ARRAY_SIZE (op_ctx->preallocated_vmas); i++) { +if (!op_ctx->preallocated_vmas[i]) { + op_ctx->preallocated_vmas[i] = vma; +return ; + } + } + +WARN_ON_ONCE (1 ); +} +static struct panthor_vma *panthor_vm_op_ctx_get_vma (struct panthor_vm_op_ctx *op_ctx) {
@@ -2057,8 +2071,10 @@ static int panthor_gpuva_sm_step_map(struct drm_gpuva_op *op, void *priv) ret =panthor_vm_map_pages (vm, op->map.va.addr,flags_to_prot (vma->flags), op_ctx->map.sgt, op->map.gem.offset, op->map.va.range); -if (ret) +if (ret) { +panthor_vm_op_ctx_return_vma (op_ctx, vma);return ret; + }/* Ref owned by the mapping now, clear the obj field so we don't release the * pinning/obj ref behind GPUVA's back.
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 204/507 scsi: ufs: core: fix incorrect buffer duplication in ufshcd_read_string_desc()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bean Huo <[email protected]>
[ Upstream commit d794b499f948801f54d67ddbc34a6eac5a6d150a ]
The function ufshcd_read_string_desc() was duplicating memory starting from the beginning of struct uc_string_id, which included the length and type fields. As a result, the allocated buffer contained unwanted metadata in addition to the string itself.
The correct behavior is to duplicate only the Unicode character array in the structure. Update the code so that only the actual string content is copied into the new buffer.
--- drivers/ufs/core/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +1 -1
@@ -3831,7 +3831,7 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index, str[ret++] ='\0' ; }else { - str =kmemdup (uc_str, uc_str->len,GFP_KERNEL ); + str =kmemdup (uc_str->uc, uc_str->len,GFP_KERNEL );if (!str) { ret = -ENOMEM ; goto out;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 205/507 md: delete md_redundancy_group when array is becoming inactive
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Nan <[email protected]>
[ Upstream commit 0ce112d9171ad766d4c6716951e73f91a0bfc184 ]
'md_redundancy_group' are created in md_run() and deleted in del_gendisk(), but these are not paired. Writing inactive/active to sysfs array_state can trigger md_run() multiple times without del_gendisk(), leading to duplicate creation as below:
sysfs: cannot create duplicate filename '/devices/virtual/block/md0/md/sync_action'
Call Trace: dump_stack_lvl+0x9f/0x120 dump_stack+0x14/0x20 sysfs_warn_dup+0x96/0xc0 sysfs_add_file_mode_ns+0x19c/0x1b0 internal_create_group+0x213/0x830 sysfs_create_group+0x17/0x20 md_run+0x856/0xe60 ? __x64_sys_openat+0x23/0x30 do_md_run+0x26/0x1d0 array_state_store+0x559/0x760 md_attr_store+0xc9/0x1e0 sysfs_kf_write+0x6f/0xa0 kernfs_fop_write_iter+0x141/0x2a0 vfs_write+0x1fc/0x5a0 ksys_write+0x79/0x180 __x64_sys_write+0x1d/0x30 x64_sys_call+0x2818/0x2880 do_syscall_64+0xa9/0x580 entry_SYSCALL_64_after_hwframe+0x4b/0x53 md: cannot register extra attributes for md0
Creation of it depends on 'pers', its lifecycle cannot be aligned with gendisk. So fix this issue by triggering 'md_redundancy_group' deletion when the array is becoming inactive.
--- drivers/md/md.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/md/md.c +4 -0
@@ -6696,6 +6696,10 @@ static int do_md_stop(struct mddev *mddev, int mode)if (!md_is_rdwr (mddev))set_disk_ro (disk,0 ); +if (mode ==2 && mddev->pers->sync_request && + mddev->to_remove ==NULL ) + mddev->to_remove = &md_redundancy_group; +__md_stop_writes (mddev);__md_stop (mddev);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 206/507 cpufreq/amd-pstate: Call cppc_set_auto_sel() only for online CPUs
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gautham R. Shenoy <[email protected]>
[ Upstream commit bb31fef0d03ed17d587b40e3458786be408fb9df ]
amd_pstate_change_mode_without_dvr_change() calls cppc_set_auto_sel() for all the present CPUs.
However, this callpath eventually calls cppc_set_reg_val() which accesses the per-cpu cpc_desc_ptr object. This object is initialized only for online CPUs via acpi_soft_cpu_online() --> __acpi_processor_start() --> acpi_cppc_processor_probe().
Hence, restrict calling cppc_set_auto_sel() to only the online CPUs.
--- drivers/cpufreq/amd-pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/amd-pstate.c +1 -1
@@ -1282,7 +1282,7 @@ static int amd_pstate_change_mode_without_dvr_change(int mode)if (cpu_feature_enabled (X86_FEATURE_CPPC ) || cppc_state ==AMD_PSTATE_ACTIVE )return 0 ; -for_each_present_cpu (cpu) { +for_each_online_cpu (cpu) {cppc_set_auto_sel (cpu, (cppc_state ==AMD_PSTATE_PASSIVE ) ?0 :1 ); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 207/507 powerpc/kdump: Fix size calculation for hot-removed memory ranges
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sourabh Jain <[email protected]>
[ Upstream commit 7afe2383eff05f76f4ce2cfda658b7889c89f101 ]
The elfcorehdr segment in the kdump image stores information about the memory regions (called crash memory ranges) that the kdump kernel must capture.
When a memory hot-remove event occurs, the kernel regenerates the elfcorehdr for the currently loaded kdump image to remove the hot-removed memory from the crash memory ranges.
Call chain:remove_mem_range()update_crash_elfcorehdr()arch_crash_handle_hotplug_event()crash_handle_hotplug_event()
While removing the hot-removed memory from the crash memory ranges in remove_mem_range(), if the removed memory lies within an existing crash range, that range is split into two. During this split, the size of the second range was being calculated incorrectly.
This leads to dump capture failure with makedumpfile with below error:
$ makedumpfile -l -d 31 /proc/vmcore /tmp/vmcore
readpage_elf: Attempt to read non-existent page at 0xbbdab0000.
readmem: type_addr: 0, addr:c000000bbdab7f00, size:16validate_mem_section: Can't read mem_section array.readpage_elf: Attempt to read non-existent page at 0xbbdab0000.
readmem: type_addr: 0, addr:c000000bbdab7f00, size:8get_mm_sparsemem: Can't get the address of mem_section.
The updated crash memory range in PT_LOAD entry is holding incorrect data (checkout FileSiz and MemSiz):
readelf -a /proc/vmcore
<snip...>
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000b013d0000 0xc000000b80000000 0x0000000b80000000
0xffffffffc0000000 0xffffffffc0000000 RWE 0x0
<snip...>
Update the size calculation for the new crash memory range to fix this issue.
Note: This problem will not occur if the kdump kernel is loaded or reloaded after a memory hot-remove operation.
--- arch/powerpc/kexec/ranges.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kexec/ranges.c +1 -1
@@ -697,8 +697,8 @@ int remove_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size)* two half. */ else { + size = mem_rngs->ranges[i].end - end +1 ; mem_rngs->ranges[i].end = base -1 ; - size = mem_rngs->ranges[i].end - end; ret =add_mem_range (mem_ranges, end +1 , size); } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 208/507 powerpc/32: Fix unpaired stwcx. on interrupt exit
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit 10e1c77c3636d815db802ceef588522c2d2d947c ]
Commit b96bae3ae2cb ("powerpc/32: Replace ASM exception exit by C exception exit from ppc64") erroneouly copied to powerpc/32 the logic from powerpc/64 based on feature CPU_FTR_STCX_CHECKS_ADDRESS which is always 0 on powerpc/32.
Re-instate the logic implemented by commit b64f87c16f3c ("[POWERPC] Avoid unpaired stwcx. on some processors") which is based on CPU_FTR_NEED_PAIRED_STWCX feature.
--- arch/powerpc/kernel/entry_32.S | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
arch/powerpc/kernel/entry_32.S +4 -6
@@ -263,10 +263,9 @@ interrupt_return: mtspr SPRN_SRR1,r12 BEGIN_FTR_SECTION + lwarx r0,0,r1 +END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) stwcx. r0,0,r1 /* to clear the reservation */ -FTR_SECTION_ELSE - lwarx r0,0,r1 -ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS) lwz r3,_CCR(r1) lwz r4,_LINK(r1)
@@ -306,10 +305,9 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS) mtspr SPRN_SRR1,r12 BEGIN_FTR_SECTION + lwarx r0,0,r1 +END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX) stwcx. r0,0,r1 /* to clear the reservation */ -FTR_SECTION_ELSE - lwarx r0,0,r1 -ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS) lwz r3,_LINK(r1) lwz r4,_CTR(r1)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 209/507 macintosh/mac_hid: fix race condition in mac_hid_toggle_emumouse
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
[ Upstream commit 1e4b207ffe54cf33a4b7a2912c4110f89c73bf3f ]
The following warning appears when running syzkaller, and this issue also exists in the mainline code.
------------[ cut here ]------------ list_add double add: new=ffffffffa57eee28, prev=ffffffffa57eee28, next=ffffffffa5e63100. WARNING: CPU: 0 PID: 1491 at lib/list_debug.c:35 __list_add_valid_or_report+0xf7/0x130 Modules linked in: CPU: 0 PID: 1491 Comm: syz.1.28 Not tainted 6.6.0+ #3 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:__list_add_valid_or_report+0xf7/0x130 RSP: 0018:ff1100010dfb7b78 EFLAGS: 00010282 RAX: 0000000000000000 RBX: ffffffffa57eee18 RCX: ffffffff97fc9817 RDX: 0000000000040000 RSI: ffa0000002383000 RDI: 0000000000000001 RBP: ffffffffa57eee28 R08: 0000000000000001 R09: ffe21c0021bf6f2c R10: 0000000000000001 R11: 6464615f7473696c R12: ffffffffa5e63100 R13: ffffffffa57eee28 R14: ffffffffa57eee28 R15: ff1100010dfb7d48 FS: 00007fb14398b640(0000) GS:ff11000119600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000010d096005 CR4: 0000000000773ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 80000000 Call Trace: <TASK> input_register_handler+0xb3/0x210 mac_hid_start_emulation+0x1c5/0x290 mac_hid_toggle_emumouse+0x20a/0x240 proc_sys_call_handler+0x4c2/0x6e0 new_sync_write+0x1b1/0x2d0 vfs_write+0x709/0x950 ksys_write+0x12a/0x250 do_syscall_64+0x5a/0x110 entry_SYSCALL_64_after_hwframe+0x78/0xe2
The WARNING occurs when two processes concurrently write to the mac-hid emulation sysctl, causing a race condition in mac_hid_toggle_emumouse(). Both processes read old_val=0, then both try to register the input handler, leading to a double list_add of the same handler.
CPU0 CPU1
------------------------- -------------------------
vfs_write() //write 1 vfs_write() //write 1
proc_sys_write() proc_sys_write()
mac_hid_toggle_emumouse() mac_hid_toggle_emumouse()
old_val = *valp // old_val=0
old_val = *valp // old_val=0
mutex_lock_killable()
proc_dointvec() // *valp=1
mac_hid_start_emulation()
input_register_handler()
mutex_unlock()
mutex_lock_killable()
proc_dointvec()
mac_hid_start_emulation()
input_register_handler() //Trigger Warning
mutex_unlock()Fix this by moving the old_val read inside the mutex lock region.
--- drivers/macintosh/mac_hid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/macintosh/mac_hid.c +2 -1
@@ -187,13 +187,14 @@ static int mac_hid_toggle_emumouse(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int *valp = table->data; -int old_val = *valp; +int old_val;int rc; rc =mutex_lock_killable (&mac_hid_emumouse_mutex);if (rc)return rc; + old_val = *valp; rc =proc_dointvec (table, write, buffer, lenp, ppos);if (rc ==0 && write && *valp != old_val) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 210/507 wifi: cw1200: Fix potential memory leak in cw1200_bh_rx_helper()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdun Nihaal <[email protected]>
[ Upstream commit 5e88e864118c20e63a1571d0ff0a152e5d684959 ]
In one of the error paths, the memory allocated for skb_rx is not freed. Fix that by freeing it before returning.
--- drivers/net/wireless/st/cw1200/bh.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/st/cw1200/bh.c +4 -2
@@ -317,10 +317,12 @@ static int cw1200_bh_rx_helper(struct cw1200_common *priv,if (wsm_id &0x0400 ) {int rc =wsm_release_tx_buffer (priv,1 ); -if (WARN_ON (rc <0 )) +if (WARN_ON (rc <0 )) { +dev_kfree_skb (skb_rx);return rc; -else if (rc >0 ) + }else if (rc >0 ) { *tx =1 ; + } }/* cw1200_wsm_rx takes care on SKB livetime */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 211/507 nbd: defer config unlock in nbd_genl_connect
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Qixing <[email protected]>
[ Upstream commit 1649714b930f9ea6233ce0810ba885999da3b5d4 ]
There is one use-after-free warning when running NBD_CMD_CONNECT and NBD_CLEAR_SOCK:
nbd_genl_connect
nbd_alloc_and_init_config // config_refs=1
nbd_start_device // config_refs=2
set NBD_RT_HAS_CONFIG_REF open nbd // config_refs=3
recv_work done // config_refs=2
NBD_CLEAR_SOCK // config_refs=1 close nbd // config_refs=0
refcount_inc -> uaf
------------[ cut here ]------------ refcount_t: addition on 0; use-after-free. WARNING: CPU: 24 PID: 1014 at lib/refcount.c:25 refcount_warn_saturate+0x12e/0x290 nbd_genl_connect+0x16d0/0x1ab0 genl_family_rcv_msg_doit+0x1f3/0x310 genl_rcv_msg+0x44a/0x790
The issue can be easily reproduced by adding a small delay before refcount_inc(&nbd->config_refs) in nbd_genl_connect():
mutex_unlock(&nbd->config_lock);
if (!ret) {
set_bit(NBD_RT_HAS_CONFIG_REF, &config->runtime_flags);
+ printk("before sleep\n");
+ mdelay(5 * 1000);
+ printk("after sleep\n");
refcount_inc(&nbd->config_refs);
nbd_connect_reply(info, nbd->index);
}--- drivers/block/nbd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/nbd.c +2 -1
@@ -2241,12 +2241,13 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info) ret =nbd_start_device (nbd); out: -mutex_unlock (&nbd->config_lock);if (!ret) {set_bit (NBD_RT_HAS_CONFIG_REF , &config->runtime_flags);refcount_inc (&nbd->config_refs);nbd_connect_reply (info, nbd->index); } +mutex_unlock (&nbd->config_lock); +nbd_config_put (nbd);if (put_dev)nbd_put (nbd);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 212/507 coresight: Change device mode to atomic type
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 693d1eaca940f277af24c74873ef2313816ff444 ]
The device mode is defined as local type. This type cannot promise SMP-safe access.
Change to atomic type and impose relax ordering, which ensures the SMP-safe synchronisation and the ordering between the mode setting and relevant operations.
--- include/linux/coresight.h | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
include/linux/coresight.h +11 -14
@@ -252,15 +252,11 @@ struct coresight_trace_id_map {* by @coresight_ops. * @access: Device i/o access abstraction for this device. * @dev: The device entity associated to this component. -* @mode: This tracer's mode, i.e sysFS, Perf or disabled. This is -* actually an 'enum cs_mode', but is stored in an atomic type. -* This is always accessed through local_read() and local_set(), -* but wherever it's done from within the Coresight device's lock, -* a non-atomic read would also work. This is the main point of -* synchronisation between code happening inside the sysfs mode's -* coresight_mutex and outside when running in Perf mode. A compare -* and exchange swap is done to atomically claim one mode or the -* other. +* @mode: The device mode, i.e sysFS, Perf or disabled. This is actually +* an 'enum cs_mode' but stored in an atomic type. Access is always +* through atomic APIs, ensuring SMP-safe synchronisation between +* racing from sysFS and Perf mode. A compare-and-exchange +* operation is done to atomically claim one mode or the other. * @refcnt: keep track of what is in use. Only access this outside of the * device's spinlock when the coresight_mutex held and mode == * CS_MODE_SYSFS. Otherwise it must be accessed from inside the
@@ -289,7 +285,7 @@ struct coresight_device {const struct coresight_ops *ops;struct csdev_access access;struct device dev; -local_t mode; +atomic_t mode;int refcnt;bool orphan;/* sink specific fields */
@@ -651,13 +647,14 @@ static inline bool coresight_is_percpu_sink(struct coresight_device *csdev)static inline bool coresight_take_mode (struct coresight_device *csdev,enum cs_mode new_mode) { -return local_cmpxchg (&csdev->mode,CS_MODE_DISABLED , new_mode) == -CS_MODE_DISABLED ; +int curr =CS_MODE_DISABLED ; + +return atomic_try_cmpxchg_acquire (&csdev->mode, &curr, new_mode); }static inline enum cs_mode coresight_get_mode (struct coresight_device *csdev) { -return local_read (&csdev->mode); +return atomic_read_acquire (&csdev->mode); } static inline void coresight_set_mode(struct coresight_device *csdev,
@@ -673,7 +670,7 @@ static inline void coresight_set_mode(struct coresight_device *csdev,WARN (new_mode !=CS_MODE_DISABLED && current_mode !=CS_MODE_DISABLED && current_mode != new_mode,"Device already in use\n" ); -local_set (&csdev->mode, new_mode); +atomic_set_release (&csdev->mode, new_mode); }struct coresight_device *coresight_register (struct coresight_desc *desc);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 213/507 coresight: etm4x: Always set tracers device mode on target CPU
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 28eee2158575aea8fee7807adb9248ceaf9196f1 ]
When enabling a tracer via SysFS interface, the device mode may be set by any CPU - not necessarily the target CPU. This can lead to race condition in SMP, and may result in incorrect mode values being read.
Consider the following example, where CPU0 attempts to enable the tracer on CPU1 (the target CPU):
CPU0 CPU1
etm4_enable()
` coresight_take_mode(SYSFS)
` etm4_enable_sysfs()
` smp_call_function_single() ----> etm4_enable_hw_smp_call()
/
/ CPU idle:
/ etm4_cpu_save()
/ ` coresight_get_mode()
Failed to enable h/w / ^^^
` coresight_set_mode(DISABLED) <-' Read the intermediate SYSFS mode
In this case, CPU0 initiates the operation by taking the SYSFS mode to avoid conflicts with the Perf mode. It then sends an IPI to CPU1 to configure the tracer registers. If any error occurs during this process, CPU0 rolls back by setting the mode to DISABLED.
However, if CPU1 enters an idle state during this time, it might read the intermediate SYSFS mode. As a result, the CPU PM flow could wrongly save and restore tracer context that is actually disabled.
To resolve the issue, this commit moves the device mode setting logic on the target CPU. This ensures that the device mode is only modified by the target CPU, eliminating race condition between mode writes and reads across CPUs.
An additional change introduces the etm4_disable_sysfs_smp_call() function for SMP calls, which disables the tracer and explicitly set the mode to DISABLED during SysFS operations. Rename etm4_disable_hw_smp_call() to etm4_disable_sysfs_smp_call() for naming consistency.
The flow is updated with this change:
CPU0 CPU1
etm4_enable()
` etm4_enable_sysfs()
` smp_call_function_single() ----> etm4_enable_hw_smp_call()
` coresight_take_mode(SYSFS)
Failed, set back to DISABLED
` coresight_set_mode(DISABLED)
CPU idle:
etm4_cpu_save()
` coresight_get_mode()
^^^
Read out the DISABLED mode--- .../coresight/coresight-etm4x-core.c | 60 ++++++++++++------- 1 file changed, 38 insertions(+), 22 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x-core.c +38 -22
@@ -589,13 +589,26 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata)return rc; } -static void etm4_enable_hw_smp_call (void *info) +static void etm4_enable_sysfs_smp_call (void *info) {struct etm4_enable_arg *arg = info; +struct coresight_device *csdev;if (WARN_ON (!arg))return ; + + csdev = arg->drvdata->csdev; +if (!coresight_take_mode (csdev,CS_MODE_SYSFS )) { +/* Someone is already using the tracer */ + arg->rc = -EBUSY ; +return ; + } + arg->rc =etm4_enable_hw (arg->drvdata); + +/* The tracer didn't start */ +if (arg->rc) +coresight_set_mode (csdev,CS_MODE_DISABLED ); }/*
@@ -808,13 +821,14 @@ static int etm4_enable_perf(struct coresight_device *csdev,struct perf_event *event, struct coresight_path *path) { - int ret = 0; struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); +int ret; -if (WARN_ON_ONCE (drvdata->cpu !=smp_processor_id ())) { - ret = -EINVAL ; - goto out; - } +if (WARN_ON_ONCE (drvdata->cpu !=smp_processor_id ())) +return -EINVAL ; + +if (!coresight_take_mode (csdev,CS_MODE_PERF )) +return -EBUSY ;/* Configure the tracer based on the session's specifics */ ret =etm4_parse_event_config (csdev, event);
@@ -830,6 +844,9 @@ static int etm4_enable_perf(struct coresight_device *csdev, ret =etm4_enable_hw (drvdata); out: +/* Failed to start tracer; roll back to DISABLED mode */ +if (ret) +coresight_set_mode (csdev,CS_MODE_DISABLED );return ret; }
@@ -861,7 +878,7 @@ static int etm4_enable_sysfs(struct coresight_device *csdev, struct coresight_pa*/ arg.drvdata = drvdata; ret =smp_call_function_single (drvdata->cpu, - etm4_enable_hw_smp_call, &arg,1 ); + etm4_enable_sysfs_smp_call, &arg,1 );if (!ret) ret = arg.rc;if (!ret)
@@ -882,11 +899,6 @@ static int etm4_enable(struct coresight_device *csdev, struct perf_event *event, {int ret; -if (!coresight_take_mode (csdev, mode)) { -/* Someone is already using the tracer */ -return -EBUSY ; - } -switch (mode) {case CS_MODE_SYSFS : ret =etm4_enable_sysfs (csdev, path);
@@ -898,10 +910,6 @@ static int etm4_enable(struct coresight_device *csdev, struct perf_event *event, ret = -EINVAL ; } -/* The tracer didn't start */ -if (ret) -coresight_set_mode (csdev,CS_MODE_DISABLED ); -return ret; }
@@ -953,10 +961,9 @@ static void etm4_disable_trace_unit(struct etmv4_drvdata *drvdata)isb (); } -static void etm4_disable_hw (void *info) +static void etm4_disable_hw (struct etmv4_drvdata *drvdata) {u32 control; -struct etmv4_drvdata *drvdata = info;struct etmv4_config *config = &drvdata->config;struct coresight_device *csdev = drvdata->csdev;struct csdev_access *csa = &csdev->access;
@@ -993,6 +1000,15 @@ static void etm4_disable_hw(void *info) "cpu: %d disable smp call done\n", drvdata->cpu); } +static void etm4_disable_sysfs_smp_call (void *info) +{ +struct etmv4_drvdata *drvdata = info; + +etm4_disable_hw (drvdata); + +coresight_set_mode (drvdata->csdev,CS_MODE_DISABLED ); +} +static int etm4_disable_perf (struct coresight_device *csdev,struct perf_event *event) {
@@ -1022,6 +1038,8 @@ static int etm4_disable_perf(struct coresight_device *csdev,/* TRCVICTLR::SSSTATUS, bit[9] */ filters->ssstatus = (control &BIT (9 )); +coresight_set_mode (drvdata->csdev,CS_MODE_DISABLED ); +/* * perf will release trace ids when _free_aux() is * called at the end of the session.
@@ -1047,7 +1065,8 @@ static void etm4_disable_sysfs(struct coresight_device *csdev)* Executing etm4_disable_hw on the cpu whose ETM is being disabled * ensures that register writes occur when cpu is powered. */ -smp_call_function_single (drvdata->cpu, etm4_disable_hw, drvdata,1 ); +smp_call_function_single (drvdata->cpu, etm4_disable_sysfs_smp_call, + drvdata,1 );raw_spin_unlock (&drvdata->spinlock);
@@ -1087,9 +1106,6 @@ static void etm4_disable(struct coresight_device *csdev,etm4_disable_perf (csdev, event);break ; } - -if (mode) -coresight_set_mode (csdev,CS_MODE_DISABLED ); }static int etm4_resume_perf (struct coresight_device *csdev)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 214/507 coresight: etm3x: Always set tracers device mode on target CPU
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit ab3fde32afe6a77e5cc60f868e44e6e09424752b ]
The ETMv3 driver shares the same issue as ETMv4 regarding race conditions when accessing the device mode.
This commit applies the same fix: ensuring that the device mode is modified only by the target CPU to eliminate race conditions across CPUs.
--- .../coresight/coresight-etm3x-core.c | 59 +++++++++++++------ 1 file changed, 40 insertions(+), 19 deletions(-)
drivers/hwtracing/coresight/coresight-etm3x-core.c +40 -19
@@ -439,13 +439,26 @@ struct etm_enable_arg {int rc; }; -static void etm_enable_hw_smp_call (void *info) +static void etm_enable_sysfs_smp_call (void *info) {struct etm_enable_arg *arg = info; +struct coresight_device *csdev;if (WARN_ON (!arg))return ; + + csdev = arg->drvdata->csdev; +if (!coresight_take_mode (csdev,CS_MODE_SYSFS )) { +/* Someone is already using the tracer */ + arg->rc = -EBUSY ; +return ; + } + arg->rc =etm_enable_hw (arg->drvdata); + +/* The tracer didn't start */ +if (arg->rc) +coresight_set_mode (csdev,CS_MODE_DISABLED ); }static int etm_cpu_id (struct coresight_device *csdev)
@@ -465,16 +478,26 @@ static int etm_enable_perf(struct coresight_device *csdev, struct coresight_path *path) {struct etm_drvdata *drvdata =dev_get_drvdata (csdev->dev.parent); +int ret;if (WARN_ON_ONCE (drvdata->cpu !=smp_processor_id ()))return -EINVAL ; +if (!coresight_take_mode (csdev,CS_MODE_PERF )) +return -EBUSY ; +/* Configure the tracer based on the session's specifics */ etm_parse_event_config (drvdata, event); drvdata->traceid = path->trace_id;/* And enable it */ -return etm_enable_hw (drvdata); + ret =etm_enable_hw (drvdata); + +/* Failed to start tracer; roll back to DISABLED mode */ +if (ret) +coresight_set_mode (csdev,CS_MODE_DISABLED ); + +return ret; }static int etm_enable_sysfs (struct coresight_device *csdev,struct coresight_path *path)
@@ -494,7 +517,7 @@ static int etm_enable_sysfs(struct coresight_device *csdev, struct coresight_patif (cpu_online (drvdata->cpu)) { arg.drvdata = drvdata; ret =smp_call_function_single (drvdata->cpu, - etm_enable_hw_smp_call, &arg,1 ); + etm_enable_sysfs_smp_call, &arg,1 );if (!ret) ret = arg.rc;if (!ret)
@@ -517,12 +540,6 @@ static int etm_enable(struct coresight_device *csdev, struct perf_event *event, enum cs_mode mode, struct coresight_path *path) { int ret; -struct etm_drvdata *drvdata =dev_get_drvdata (csdev->dev.parent); - -if (!coresight_take_mode (csdev, mode)) { -/* Someone is already using the tracer */ -return -EBUSY ; - }switch (mode) {case CS_MODE_SYSFS :
@@ -535,17 +552,12 @@ static int etm_enable(struct coresight_device *csdev, struct perf_event *event, ret = -EINVAL ; } -/* The tracer didn't start */ -if (ret) -coresight_set_mode (drvdata->csdev,CS_MODE_DISABLED ); -return ret; } -static void etm_disable_hw (void *info) +static void etm_disable_hw (struct etm_drvdata *drvdata) {int i; -struct etm_drvdata *drvdata = info;struct etm_config *config = &drvdata->config;struct coresight_device *csdev = drvdata->csdev;
@@ -567,6 +579,15 @@ static void etm_disable_hw(void *info) "cpu: %d disable smp call done\n", drvdata->cpu); } +static void etm_disable_sysfs_smp_call (void *info) +{ +struct etm_drvdata *drvdata = info; + +etm_disable_hw (drvdata); + +coresight_set_mode (drvdata->csdev,CS_MODE_DISABLED ); +} +static void etm_disable_perf (struct coresight_device *csdev) {struct etm_drvdata *drvdata =dev_get_drvdata (csdev->dev.parent);
@@ -588,6 +609,8 @@ static void etm_disable_perf(struct coresight_device *csdev)CS_LOCK (drvdata->csa.base); +coresight_set_mode (drvdata->csdev,CS_MODE_DISABLED ); +/* * perf will release trace ids when _free_aux() * is called at the end of the session
@@ -612,7 +635,8 @@ static void etm_disable_sysfs(struct coresight_device *csdev)* Executing etm_disable_hw on the cpu whose ETM is being disabled * ensures that register writes occur when cpu is powered. */ -smp_call_function_single (drvdata->cpu, etm_disable_hw, drvdata,1 ); +smp_call_function_single (drvdata->cpu, etm_disable_sysfs_smp_call, + drvdata,1 );spin_unlock (&drvdata->spinlock);cpus_read_unlock ();
@@ -652,9 +676,6 @@ static void etm_disable(struct coresight_device *csdev,WARN_ON_ONCE (mode);return ; } - -if (mode) -coresight_set_mode (csdev,CS_MODE_DISABLED ); }static const struct coresight_ops_source etm_source_ops = {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 215/507 coresight: etm4x: Correct polling IDLE bit
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 4dc4e22f9536341255f5de6047977a80ff47eaef ]
Since commit 4ff6039ffb79 ("coresight-etm4x: add isb() before reading the TRCSTATR"), the code has incorrectly been polling the PMSTABLE bit instead of the IDLE bit.
This commit corrects the typo.
--- drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-etm4x-core.c +1 -1
@@ -1924,7 +1924,7 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) state->trcpdcr =etm4x_read32 (csa,TRCPDCR );/* wait for TRCSTATR.IDLE to go up */ -if (etm4x_wait_status (csa,TRCSTATR_PMSTABLE_BIT ,1 )) { +if (etm4x_wait_status (csa,TRCSTATR_IDLE_BIT ,1 )) {dev_err (etm_dev,"timeout while waiting for Idle Trace Status\n" );etm4_os_unlock (drvdata);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 216/507 coresight: etm4x: Add context synchronization before enabling trace
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 64eb04ae545294e105ad91714dc3167a0b660731 ]
According to the software usage PKLXF in Arm ARM (ARM DDI 0487 L.a), a Context synchronization event is required before enabling the trace unit.
An ISB is added to meet this requirement, particularly for guarding the operations in the flow:
etm4x_allow_trace()
`> kvm_tracing_set_el1_configuration()
`> write_sysreg_s(trfcr_while_in_guest, SYS_TRFCR_EL12)
Improved the barrier comments to provide more accurate information.
--- .../coresight/coresight-etm4x-core.c | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x-core.c +23 -4
@@ -446,10 +446,24 @@ static int etm4_enable_trace_unit(struct etmv4_drvdata *drvdata)etm4x_relaxed_write32 (csa,TRCRSR_TA ,TRCRSR );etm4x_allow_trace (drvdata); + +/* +* According to software usage PKLXF in Arm ARM (ARM DDI 0487 L.a), +* execute a Context synchronization event to guarantee the trace unit +* will observe the new values of the System registers. +*/ +if (!csa->io_mem) +isb (); +/* Enable the trace unit */ etm4x_relaxed_write32 (csa,1 ,TRCPRGCTLR ); -/* Synchronize the register updates for sysreg access */ +/* +* As recommended by section 4.3.7 ("Synchronization when using system +* instructions to progrom the trace unit") of ARM IHI 0064H.b, the +* self-hosted trace analyzer must perform a Context synchronization +* event between writing to the TRCPRGCTLR and reading the TRCSTATR. +*/ if (!csa->io_mem)isb ();
@@ -931,11 +945,16 @@ static void etm4_disable_trace_unit(struct etmv4_drvdata *drvdata)*/ etm4x_prohibit_trace (drvdata);/* -* Make sure everything completes before disabling, as recommended -* by section 7.3.77 ("TRCVICTLR, ViewInst Main Control Register, -* SSTATUS") of ARM IHI 0064D +* Prevent being speculative at the point of disabling the trace unit, +* as recommended by section 7.3.77 ("TRCVICTLR, ViewInst Main Control +* Register, SSTATUS") of ARM IHI 0064D */ dsb (sy); +/* +* According to software usage VKHHY in Arm ARM (ARM DDI 0487 L.a), +* execute a Context synchronization event to guarantee no new +* program-flow trace is generated. +*/ isb ();/* Trace synchronization barrier, is a nop if not supported */ tsb_csync ();
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 217/507 coresight: etm4x: Properly control filter in CPU idle with FEAT_TRF
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 1fdc2cd347a7bc58acacb6144404ee892cea6c2e ]
If a CPU supports FEAT_TRF, as described in the section K5.5 "Context switching", Arm ARM (ARM DDI 0487 L.a), it defines a flow to prohibit program-flow trace, execute a TSB CSYNC instruction for flushing, followed by clearing TRCPRGCTLR.EN bit.
To restore the state, the reverse sequence is required.
This differs from the procedure described in the section 3.4.1 "The procedure when powering down the PE" of ARM IHI0064H.b, which involves the OS Lock to prevent external debugger accesses and implicitly disables trace.
To be compatible with different ETM versions, explicitly control trace unit using etm4_disable_trace_unit() and etm4_enable_trace_unit() during CPU idle to comply with FEAT_TRF.
As a result, the save states for TRFCR_ELx and trcprgctlr are redundant, remove them.
--- drivers/hwtracing/coresight/coresight-etm4x-core.c | 14 +++++++------- drivers/hwtracing/coresight/coresight-etm4x.h | 3 --- 2 files changed, 7 insertions(+), 10 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x-core.c +7 -7
@@ -1858,9 +1858,11 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) goto out; } +if (!drvdata->paused) +etm4_disable_trace_unit (drvdata); + state = drvdata->save_state; - state->trcprgctlr =etm4x_read32 (csa,TRCPRGCTLR );if (drvdata->nr_pe) state->trcprocselr =etm4x_read32 (csa,TRCPROCSELR ); state->trcconfigr =etm4x_read32 (csa,TRCCONFIGR );
@@ -1970,9 +1972,6 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) {int ret =0 ; -/* Save the TRFCR irrespective of whether the ETM is ON */ -if (drvdata->trfcr) - drvdata->save_trfcr =read_trfcr ();/* * Save and restore the ETM Trace registers only if * the ETM is active.
@@ -1994,7 +1993,6 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)etm4_cs_unlock (drvdata, csa);etm4x_relaxed_write32 (csa, state->trcclaimset,TRCCLAIMSET ); -etm4x_relaxed_write32 (csa, state->trcprgctlr,TRCPRGCTLR );if (drvdata->nr_pe)etm4x_relaxed_write32 (csa, state->trcprocselr,TRCPROCSELR );etm4x_relaxed_write32 (csa, state->trcconfigr,TRCCONFIGR );
@@ -2079,13 +2077,15 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)/* Unlock the OS lock to re-enable trace and external debug access */ etm4_os_unlock (drvdata); + +if (!drvdata->paused) +etm4_enable_trace_unit (drvdata); +etm4_cs_lock (drvdata, csa); }static void etm4_cpu_restore (struct etmv4_drvdata *drvdata) { -if (drvdata->trfcr) -write_trfcr (drvdata->save_trfcr);if (drvdata->state_needs_restore)__etm4_cpu_restore (drvdata); }
drivers/hwtracing/coresight/coresight-etm4x.h +0 -3
@@ -866,7 +866,6 @@ struct etmv4_config {* struct etm4_save_state - state to be preserved when ETM is without power */ struct etmv4_save_state { -u32 trcprgctlr;u32 trcprocselr;u32 trcconfigr;u32 trcauxctlr;
@@ -980,7 +979,6 @@ struct etmv4_save_state {* at runtime, due to the additional setting of TRFCR_CX when * in EL2. Otherwise, 0. * @config: structure holding configuration parameters. -* @save_trfcr: Saved TRFCR_EL1 register during a CPU PM event. * @save_state: State to be preserved across power loss * @state_needs_restore: True when there is context to restore after PM exit * @skip_power_up: Indicates if an implementation can skip powering up
@@ -1037,7 +1035,6 @@ struct etmv4_drvdata {bool lpoverride;u64 trfcr;struct etmv4_config config; -u64 save_trfcr;struct etmv4_save_state *save_state;bool state_needs_restore;bool skip_power_up;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 218/507 perf tools: Fix missing feature check for inherit + SAMPLE_READ
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 367377f45c0b568882567f797b7b18b263505be7 ]
It should also have PERF_SAMPLE_TID to enable inherit and PERF_SAMPLE_READ on recent kernels. Not having _TID makes the feature check wrongly detect the inherit and _READ support.
It was reported that the following command failed due to the error in the missing feature check on Intel SPR machines.
$ perf record -e '{cpu/mem-loads-aux/S,cpu/mem-loads,ldlat=3/PS}' -- ls
Error:
Failure to open event 'cpu/mem-loads,ldlat=3/PS' on PMU 'cpu' which will be removed.
Invalid event (cpu/mem-loads,ldlat=3/PS) in per-thread mode, enable system wide with '-a'.--- tools/perf/util/evsel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/evsel.c +1 -1
@@ -2396,7 +2396,7 @@ static bool evsel__detect_missing_features(struct evsel *evsel, struct perf_cpu/* Please add new feature detection here. */ attr.inherit = true; - attr.sample_type =PERF_SAMPLE_READ ; + attr.sample_type =PERF_SAMPLE_READ |PERF_SAMPLE_TID ;if (has_attr_feature (&attr,/*flags=*/ 0 )) goto found; perf_missing_features.inherit_sample_read = true;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 219/507 drm/tidss: Remove max_pclk_khz and min_pclk_khz from tidss display features
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jayesh Choudhary <[email protected]>
[ Upstream commit 527e132573dfa793818a536b18eec49598a6f6f5 ]
The TIDSS hardware does not have independent maximum or minimum pixel clock limits for each video port. Instead, these limits are determined by the SoC's clock architecture. Previously, this constraint was modeled using the 'max_pclk_khz' and 'min_pclk_khz' fields in 'dispc_features', but this approach is static and does not account for the dynamic behavior of PLLs.
This patch removes the 'max_pclk_khz' and 'min_pclk_khz' fields from 'dispc_features'. The correct way to check if a requested mode's pixel clock is supported is by using 'clk_round_rate()' in the 'mode_valid()' hook. If the best frequency match for the mode clock falls within the supported tolerance, it is approved. TIDSS supports a 5% pixel clock tolerance, which is now reflected in the validation logic.
This change allows existing DSS-compatible drivers to be reused across SoCs that only differ in their pixel clock characteristics. The validation uses 'clk_round_rate()' for each mode, which may introduce additional delay (about 3.5 ms for 30 modes), but this is generally negligible. Users desiring faster validation may bypass these calls selectively, for example, checking only the highest resolution mode, as shown here[1].
[1]: https://lore.kernel.org/all/[email protected]/
Stable-dep-of: 86db652fc22f ("drm/tidss: Move OLDI mode validation to OLDI bridge mode_valid hook")
--- drivers/gpu/drm/tidss/tidss_dispc.c | 86 +++++++++++------------------ drivers/gpu/drm/tidss/tidss_dispc.h | 3 - 2 files changed, 31 insertions(+), 58 deletions(-)
drivers/gpu/drm/tidss/tidss_dispc.c +31 -55
@@ -56,12 +56,6 @@ static const u16 tidss_k2g_common_regs[DISPC_COMMON_REG_TABLE_LEN] = { };const struct dispc_features dispc_k2g_feats = { - .min_pclk_khz =4375 , - - .max_pclk_khz = { - [DISPC_VP_DPI ] =150000 , - }, -/* * XXX According TRM the RGB input buffer width up to 2560 should * work on 3 taps, but in practice it only works up to 1280.
@@ -144,11 +138,6 @@ static const u16 tidss_am65x_common_regs[DISPC_COMMON_REG_TABLE_LEN] = { };const struct dispc_features dispc_am65x_feats = { - .max_pclk_khz = { - [DISPC_VP_DPI ] =165000 , - [DISPC_VP_OLDI_AM65X ] =165000 , - }, - .scaling = { .in_width_max_5tap_rgb =1280 , .in_width_max_3tap_rgb =2560 ,
@@ -244,11 +233,6 @@ static const u16 tidss_j721e_common_regs[DISPC_COMMON_REG_TABLE_LEN] = { };const struct dispc_features dispc_j721e_feats = { - .max_pclk_khz = { - [DISPC_VP_DPI ] =170000 , - [DISPC_VP_INTERNAL ] =600000 , - }, - .scaling = { .in_width_max_5tap_rgb =2048 , .in_width_max_3tap_rgb =4096 ,
@@ -315,11 +299,6 @@ const struct dispc_features dispc_j721e_feats = { };const struct dispc_features dispc_am625_feats = { - .max_pclk_khz = { - [DISPC_VP_DPI ] =165000 , - [DISPC_VP_INTERNAL ] =170000 , - }, - .scaling = { .in_width_max_5tap_rgb =1280 , .in_width_max_3tap_rgb =2560 ,
@@ -376,15 +355,6 @@ const struct dispc_features dispc_am625_feats = { };const struct dispc_features dispc_am62a7_feats = { -/* -* if the code reaches dispc_mode_valid with VP1, -* it should return MODE_BAD. -*/ - .max_pclk_khz = { - [DISPC_VP_TIED_OFF ] =0 , - [DISPC_VP_DPI ] =165000 , - }, - .scaling = { .in_width_max_5tap_rgb =1280 , .in_width_max_3tap_rgb =2560 ,
@@ -441,10 +411,6 @@ const struct dispc_features dispc_am62a7_feats = { };const struct dispc_features dispc_am62l_feats = { - .max_pclk_khz = { - [DISPC_VP_DPI ] =165000 , - }, - .subrev =DISPC_AM62L , .common ="common" ,
@@ -1347,33 +1313,54 @@ static void dispc_vp_set_default_color(struct dispc_device *dispc, DISPC_OVR_DEFAULT_COLOR2, (v >> 32) & 0xffff); } +/* +* Calculate the percentage difference between the requested pixel clock rate +* and the effective rate resulting from calculating the clock divider value. +*/ +unsigned int dispc_pclk_diff (unsigned long rate,unsigned long real_rate) +{ +int r = rate /100 , rr = real_rate /100 ; + +return (unsigned int )(abs (((rr - r) *100 ) / r)); +} + +static int check_pixel_clock (struct dispc_device *dispc,u32 hw_videoport, +unsigned long clock) +{ +unsigned long round_clock; + + round_clock =clk_round_rate (dispc->vp_clk[hw_videoport], clock); +/* +* To keep the check consistent with dispc_vp_set_clk_rate(), we +* use the same 5% check here. +*/ +if (dispc_pclk_diff (clock, round_clock) >5 ) +return -EINVAL ; + +return 0 ; +} +enum drm_mode_status dispc_vp_mode_valid (struct dispc_device *dispc,u32 hw_videoport,const struct drm_display_mode *mode) {u32 hsw, hfp, hbp, vsw, vfp, vbp;enum dispc_vp_bus_type bus_type; -int max_pclk; bus_type = dispc->feat->vp_bus_type[hw_videoport]; - max_pclk = dispc->feat->max_pclk_khz[bus_type]; - -if (WARN_ON (max_pclk ==0 )) +if (WARN_ON (bus_type ==DISPC_VP_TIED_OFF ))return MODE_BAD ; -if (mode->clock < dispc->feat->min_pclk_khz) -return MODE_CLOCK_LOW ; - -if (mode->clock > max_pclk) -return MODE_CLOCK_HIGH ; -if (mode->hdisplay >4096 )return MODE_BAD ;if (mode->vdisplay >4096 )return MODE_BAD ; +if (check_pixel_clock (dispc, hw_videoport, mode->clock *1000 )) +return MODE_CLOCK_RANGE ; +/* TODO: add interlace support */ if (mode->flags &DRM_MODE_FLAG_INTERLACE )return MODE_NO_INTERLACE ;
@@ -1437,17 +1424,6 @@ void dispc_vp_disable_clk(struct dispc_device *dispc, u32 hw_videoport)clk_disable_unprepare (dispc->vp_clk[hw_videoport]); } -/* -* Calculate the percentage difference between the requested pixel clock rate -* and the effective rate resulting from calculating the clock divider value. -*/ -unsigned int dispc_pclk_diff (unsigned long rate,unsigned long real_rate) -{ -int r = rate /100 , rr = real_rate /100 ; - -return (unsigned int )(abs (((rr - r) *100 ) / r)); -} -int dispc_vp_set_clk_rate (struct dispc_device *dispc,u32 hw_videoport,unsigned long rate) {
drivers/gpu/drm/tidss/tidss_dispc.h +0 -3
@@ -74,9 +74,6 @@ enum dispc_dss_subrevision { };struct dispc_features { -int min_pclk_khz; -int max_pclk_khz[DISPC_VP_MAX_BUS_TYPE ]; -struct dispc_features_scaling scaling;enum dispc_dss_subrevision subrev;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 220/507 drm/tidss: Move OLDI mode validation to OLDI bridge mode_valid hook
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jayesh Choudhary <[email protected]>
[ Upstream commit 86db652fc22f5674ffe3b1f7c91c397c69d26d94 ]
After integrating OLDI support[0], it is necessary to identify which VP instances use OLDI, since the OLDI driver owns the video port clock (as a serial clock). Clock operations on these VPs must be delegated to the OLDI driver, not handled by the TIDSS driver. This issue also emerged in upstream discussions when DSI-related clock management was attempted in the TIDSS driver[1].
To address this, add an 'is_ext_vp_clk' array to the 'tidss_device' structure, marking a VP as 'true' during 'tidss_oldi_init()' and as 'false' during 'tidss_oldi_deinit()'. TIDSS then uses 'is_ext_vp_clk' to skip clock validation checks in 'dispc_vp_mode_valid()' for VPs under OLDI control.
Since OLDI uses the DSS VP clock directly as a serial interface and manages its own rate, mode validation should be implemented in the OLDI bridge's 'mode_valid' hook. This patch adds that logic, ensuring proper delegation and avoiding spurious clock handling in the TIDSS driver.
[0]: https://lore.kernel.org/all/[email protected]/
[1]: https://lore.kernel.org/all/[email protected]/
--- drivers/gpu/drm/tidss/tidss_dispc.c | 7 +++++++ drivers/gpu/drm/tidss/tidss_drv.h | 2 ++ drivers/gpu/drm/tidss/tidss_oldi.c | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+)
drivers/gpu/drm/tidss/tidss_dispc.c +7 -0
@@ -1329,6 +1329,13 @@ static int check_pixel_clock(struct dispc_device *dispc, u32 hw_videoport, {unsigned long round_clock; +/* +* For VP's with external clocking, clock operations must be +* delegated to respective driver, so we skip the check here. +*/ +if (dispc->tidss->is_ext_vp_clk[hw_videoport]) +return 0 ; + round_clock =clk_round_rate (dispc->vp_clk[hw_videoport], clock);/* * To keep the check consistent with dispc_vp_set_clk_rate(), we
drivers/gpu/drm/tidss/tidss_drv.h +2 -0
@@ -22,6 +22,8 @@ struct tidss_device {const struct dispc_features *feat;struct dispc_device *dispc; +bool is_ext_vp_clk[TIDSS_MAX_PORTS ]; +unsigned int num_crtcs;struct drm_crtc *crtcs[TIDSS_MAX_PORTS ];
drivers/gpu/drm/tidss/tidss_oldi.c +22 -0
@@ -309,6 +309,25 @@ static u32 *tidss_oldi_atomic_get_input_bus_fmts(struct drm_bridge *bridge,return input_fmts; } +static enum drm_mode_status +tidss_oldi_mode_valid (struct drm_bridge *bridge, +const struct drm_display_info *info, +const struct drm_display_mode *mode) +{ +struct tidss_oldi *oldi =drm_bridge_to_tidss_oldi (bridge); +unsigned long round_clock; + + round_clock =clk_round_rate (oldi->serial, mode->clock *7 *1000 ); +/* +* To keep the check consistent with dispc_vp_set_clk_rate(), +* we use the same 5% check here. +*/ +if (dispc_pclk_diff (mode->clock *7 *1000 , round_clock) >5 ) +return -EINVAL ; + +return 0 ; +} +static const struct drm_bridge_funcs tidss_oldi_bridge_funcs = { .attach = tidss_oldi_bridge_attach, .atomic_pre_enable = tidss_oldi_atomic_pre_enable,
@@ -317,6 +336,7 @@ static const struct drm_bridge_funcs tidss_oldi_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, + .mode_valid = tidss_oldi_mode_valid, };static int get_oldi_mode (struct device_node *oldi_tx,int *companion_instance)
@@ -430,6 +450,7 @@ void tidss_oldi_deinit(struct tidss_device *tidss)for (int i =0 ; i < tidss->num_oldis; i++) {if (tidss->oldis[i]) {drm_bridge_remove (&tidss->oldis[i]->bridge); + tidss->is_ext_vp_clk[tidss->oldis[i]->parent_vp] = false; tidss->oldis[i] =NULL ; } }
@@ -581,6 +602,7 @@ int tidss_oldi_init(struct tidss_device *tidss) oldi->bridge.timings = &default_tidss_oldi_timings; tidss->oldis[tidss->num_oldis++] = oldi; + tidss->is_ext_vp_clk[oldi->parent_vp] = true; oldi->tidss = tidss;drm_bridge_add (&oldi->bridge);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 221/507 clk: renesas: r9a09g077: Propagate rate changes to parent clocks
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit 145dfd70b9c70e5bc03494a7ce8fa3748ac01af3 ]
Add the CLK_SET_RATE_PARENT flag to divider clock registration so that rate changes can propagate to parent clocks when needed. This allows the CPG divider clocks to request rate adjustments from their parent, ensuring correct frequency scaling and improved flexibility in clock rate selection.
--- drivers/clk/renesas/r9a09g077-cpg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/renesas/r9a09g077-cpg.c +2 -2
@@ -178,7 +178,7 @@ r9a09g077_cpg_div_clk_register(struct device *dev,if (core->dtable) clk_hw = clk_hw_register_divider_table(dev, core->name, - parent_name, 0, + parent_name, CLK_SET_RATE_PARENT, addr, GET_SHIFT(core->conf), GET_WIDTH(core->conf),
@@ -187,7 +187,7 @@ r9a09g077_cpg_div_clk_register(struct device *dev, &pub->rmw_lock); else clk_hw = clk_hw_register_divider(dev, core->name, - parent_name, 0, + parent_name, CLK_SET_RATE_PARENT, addr, GET_SHIFT(core->conf), GET_WIDTH(core->conf),
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 222/507 clk: renesas: r9a06g032: Fix memory leak in error path
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit f8def051bbcf8677f64701e9699bf6d11e2780cd ]
The current code uses of_iomap() to map registers but never calls iounmap() on any error path after the mapping. This causes a memory leak when probe fails after successful ioremap, for example when of_clk_add_provider() or r9a06g032_add_clk_domain() fails.
Replace of_iomap() with devm_of_iomap() to automatically unmap the region on probe failure. Update the error check accordingly to use IS_ERR() and PTR_ERR() since devm_of_iomap() returns ERR_PTR on error.
--- drivers/clk/renesas/r9a06g032-clocks.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/renesas/r9a06g032-clocks.c +3 -3
@@ -1333,9 +1333,9 @@ static int __init r9a06g032_clocks_probe(struct platform_device *pdev)if (IS_ERR (mclk))return PTR_ERR (mclk); - clocks->reg =of_iomap (np,0 ); -if (WARN_ON (!clocks->reg)) -return -ENOMEM ; + clocks->reg =devm_of_iomap (dev, np,0 ,NULL ); +if (IS_ERR (clocks->reg)) +return PTR_ERR (clocks->reg);r9a06g032_init_h2mode (clocks);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 223/507 lib/vsprintf: Check pointer before dereferencing in time_and_date()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 372a12bd5df0199aa234eaf8ef31ed7ecd61d40f ]
The pointer may be invalid when gets to the printf(). In particular the time_and_date() dereferencing it in some cases without checking.
Move the check from rtc_str() to time_and_date() to cover all cases.
--- lib/vsprintf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/vsprintf.c +3 -3
@@ -1928,9 +1928,6 @@ char *rtc_str(char *buf, char *end, const struct rtc_time *tm,bool found = true;int count =2 ; -if (check_pointer (&buf, end, tm, spec)) -return buf; -switch (fmt[count]) {case 'd' : have_t = false;
@@ -1996,6 +1993,9 @@ static noinline_for_stackchar *time_and_date (char *buf,char *end,void *ptr,struct printf_spec spec,const char *fmt) { +if (check_pointer (&buf, end, ptr, spec)) +return buf; +switch (fmt[1 ]) {case 'R' :return rtc_str (buf, end, (const struct rtc_time *)ptr, spec, fmt);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 224/507 ocfs2: relax BUG() to ocfs2_error() in __ocfs2_move_extent()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit 8a7d58845fae061c62b50bc5eeb9bae4a1dedc3d ]
In '__ocfs2_move_extent()', relax 'BUG()' to 'ocfs2_error()' just to avoid crashing the whole kernel due to a filesystem corruption.
--- fs/ocfs2/move_extents.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/ocfs2/move_extents.c +7 -1
@@ -98,7 +98,13 @@ static int __ocfs2_move_extent(handle_t *handle, rec = &el->l_recs[index]; -BUG_ON (ext_flags != rec->e_flags); +if (ext_flags != rec->e_flags) { + ret =ocfs2_error (inode->i_sb, +"Inode %llu has corrupted extent %d with flags 0x%x at cpos %u\n" , + (unsigned long long )ino, index, rec->e_flags, cpos); + goto out; + } +/* * after moving/defraging to new location, the extent is not going * to be refcounted anymore.
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 225/507 ocfs2: use correct endian in ocfs2_dinode_has_extents
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <[email protected]>
[ Upstream commit c9dff86eb78a4b6b02b1e407993c946ccaf9bfb4 ]
Fields in ocfs2_dinode is little endian, covert to host endian when checking those contents.
--- fs/ocfs2/inode.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/ocfs2/inode.c +6 -4
@@ -201,13 +201,15 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags,static int ocfs2_dinode_has_extents (struct ocfs2_dinode *di) {/* inodes flagged with other stuff in id2 */ -if (di->i_flags & (OCFS2_SUPER_BLOCK_FL |OCFS2_LOCAL_ALLOC_FL | -OCFS2_CHAIN_FL |OCFS2_DEALLOC_FL )) +if (le32_to_cpu (di->i_flags) & + (OCFS2_SUPER_BLOCK_FL |OCFS2_LOCAL_ALLOC_FL |OCFS2_CHAIN_FL | +OCFS2_DEALLOC_FL ))return 0 ;/* i_flags doesn't indicate when id2 is a fast symlink */ -if (S_ISLNK (di->i_mode) && di->i_size && di->i_clusters ==0 ) +if (S_ISLNK (le16_to_cpu (di->i_mode)) &&le64_to_cpu (di->i_size) && + !le32_to_cpu (di->i_clusters))return 0 ; -if (di->i_dyn_features &OCFS2_INLINE_DATA_FL ) +if (le16_to_cpu (di->i_dyn_features) &OCFS2_INLINE_DATA_FL )return 0 ;return 1 ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 226/507 ACPI: property: Fix fwnode refcount leak in acpi_fwnode_graph_parse_endpoint()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 593ee49222a0d751062fd9a5e4a963ade4ec028a ]
acpi_fwnode_graph_parse_endpoint() calls fwnode_get_parent() to obtain the parent fwnode but returns without calling fwnode_handle_put() on it. This potentially leads to a fwnode refcount leak and prevents the parent node from being released properly.
Call fwnode_handle_put() on the parent fwnode before returning to prevent the leak from occurring.
--- drivers/acpi/property.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/property.c +1 -0
@@ -1693,6 +1693,7 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,if (fwnode_property_read_u32 (fwnode,"reg" , &endpoint->id))fwnode_property_read_u32 (fwnode,"endpoint" , &endpoint->id); +fwnode_handle_put (port_fwnode);return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 227/507 scsi: sim710: Fix resource leak by adding missing ioport_unmap() calls
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit acd194d9b5bac419e04968ffa44351afabb50bac ]
The driver calls ioport_map() to map I/O ports in sim710_probe_common() but never calls ioport_unmap() to release the mapping. This causes resource leaks in both the error path when request_irq() fails and in the normal device removal path via sim710_device_remove().
Add ioport_unmap() calls in the out_release error path and in sim710_device_remove().
--- drivers/scsi/sim710.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/sim710.c +2 -0
@@ -133,6 +133,7 @@ static int sim710_probe_common(struct device *dev, unsigned long base_addr, out_put_host:scsi_host_put (host); out_release: +ioport_unmap (hostdata->base);release_region (base_addr,64 ); out_free:kfree (hostdata);
@@ -148,6 +149,7 @@ static int sim710_device_remove(struct device *dev)scsi_remove_host (host);NCR_700_release (host); +ioport_unmap (hostdata->base);kfree (hostdata);free_irq (host->irq, host);release_region (host->base,64 );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 228/507 leds: netxbig: Fix GPIO descriptor leak in error paths
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 03865dd8af52eb16c38062df2ed30a91b604780e ]
The function netxbig_gpio_ext_get() acquires GPIO descriptors but fails to release them when errors occur mid-way through initialization. The cleanup callback registered by devm_add_action_or_reset() only runs on success, leaving acquired GPIOs leaked on error paths.
Add goto-based error handling to release all acquired GPIOs before returning errors.
--- drivers/leds/leds-netxbig.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-)
drivers/leds/leds-netxbig.c +26 -10
@@ -364,6 +364,9 @@ static int netxbig_gpio_ext_get(struct device *dev,if (!addr)return -ENOMEM ; + gpio_ext->addr = addr; + gpio_ext->num_addr =0 ; +/* * We cannot use devm_ managed resources with these GPIO descriptors * since they are associated with the "GPIO extension device" which
@@ -375,45 +378,58 @@ static int netxbig_gpio_ext_get(struct device *dev, gpiod =gpiod_get_index (gpio_ext_dev,"addr" , i,GPIOD_OUT_LOW );if (IS_ERR (gpiod)) -return PTR_ERR (gpiod); + goto err_set_code;gpiod_set_consumer_name (gpiod,"GPIO extension addr" ); addr[i] = gpiod; + gpio_ext->num_addr++; } - gpio_ext->addr = addr; - gpio_ext->num_addr = num_addr; ret =gpiod_count (gpio_ext_dev,"data" );if (ret <0 ) {dev_err (dev,"Failed to count GPIOs in DT property data-gpios\n" ); -return ret; + goto err_free_addr; } num_data = ret; data =devm_kcalloc (dev, num_data,sizeof (*data),GFP_KERNEL ); -if (!data) -return -ENOMEM ; +if (!data) { + ret = -ENOMEM ; + goto err_free_addr; + } + + gpio_ext->data = data; + gpio_ext->num_data =0 ;for (i =0 ; i < num_data; i++) { gpiod =gpiod_get_index (gpio_ext_dev,"data" , i,GPIOD_OUT_LOW );if (IS_ERR (gpiod)) -return PTR_ERR (gpiod); + goto err_free_data;gpiod_set_consumer_name (gpiod,"GPIO extension data" ); data[i] = gpiod; + gpio_ext->num_data++; } - gpio_ext->data = data; - gpio_ext->num_data = num_data; gpiod =gpiod_get (gpio_ext_dev,"enable" ,GPIOD_OUT_LOW );if (IS_ERR (gpiod)) {dev_err (dev,"Failed to get GPIO from DT property enable-gpio\n" ); -return PTR_ERR (gpiod); + goto err_free_data; }gpiod_set_consumer_name (gpiod,"GPIO extension enable" ); gpio_ext->enable = gpiod;return devm_add_action_or_reset (dev, netxbig_gpio_ext_remove, gpio_ext); + +err_free_data: +for (i =0 ; i < gpio_ext->num_data; i++) +gpiod_put (gpio_ext->data[i]); +err_set_code: + ret =PTR_ERR (gpiod); +err_free_addr: +for (i =0 ; i < gpio_ext->num_addr; i++) +gpiod_put (gpio_ext->addr[i]); +return ret; } static int netxbig_leds_get_of_pdata(struct device *dev,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 229/507 accel/amdxdna: Clear mailbox interrupt register during channel creation
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <[email protected]>
[ Upstream commit 6ff9385c07aa311f01f87307e6256231be7d8675 ]
The mailbox interrupt register is not always cleared when a mailbox channel is created. This can leave stale interrupt states from previous operations.
Fix this by explicitly clearing the interrupt register in the mailbox channel creation function.
--- drivers/accel/amdxdna/amdxdna_mailbox.c | 1 + 1 file changed, 1 insertion(+)
drivers/accel/amdxdna/amdxdna_mailbox.c +1 -0
@@ -513,6 +513,7 @@ xdna_mailbox_create_channel(struct mailbox *mb, } mb_chann->bad_state = false; +mailbox_reg_write (mb_chann, mb_chann->iohub_int_addr,0 );MB_DBG (mb_chann,"Mailbox channel created (irq: %d)" , mb_chann->msix_irq);return mb_chann;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 230/507 accel/amdxdna: Fix deadlock between context destroy and job timeout
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <[email protected]>
[ Upstream commit ca2583412306ceda9304a7c4302fd9efbf43e963 ]
Hardware context destroy function holds dev_lock while waiting for all jobs to complete. The timeout job also needs to acquire dev_lock, this leads to a deadlock.
Fix the issue by temporarily releasing dev_lock before waiting for all jobs to finish, and reacquiring it afterward.
--- drivers/accel/amdxdna/aie2_ctx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/accel/amdxdna/aie2_ctx.c +4 -2
@@ -675,17 +675,19 @@ void aie2_hwctx_fini(struct amdxdna_hwctx *hwctx) ndev->hwctx_num--;XDNA_DBG (xdna,"%s sequence number %lld" , hwctx->name, hwctx->priv->seq); -drm_sched_entity_destroy (&hwctx->priv->entity); -aie2_hwctx_wait_for_idle (hwctx);/* Request fw to destroy hwctx and cancel the rest pending requests */ aie2_release_resource (hwctx); +mutex_unlock (&xdna->dev_lock); +drm_sched_entity_destroy (&hwctx->priv->entity); +/* Wait for all submitted jobs to be completed or canceled */ wait_event (hwctx->priv->job_free_wq,atomic64_read (&hwctx->job_submit_cnt) ==atomic64_read (&hwctx->job_free_cnt)); +mutex_lock (&xdna->dev_lock);drm_sched_fini (&hwctx->priv->sched);aie2_ctx_syncobj_destroy (hwctx);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 231/507 bpf: Free special fields when update [lru_,]percpu_hash maps
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Hwang <[email protected]>
[ Upstream commit 6af6e49a76c9af7d42eb923703e7648cb2bf401a ]
As [lru_,]percpu_hash maps support BPF_KPTR_{REF,PERCPU}, missing calls to 'bpf_obj_free_fields()' in 'pcpu_copy_value()' could cause the memory referenced by BPF_KPTR_{REF,PERCPU} fields to be held until the map gets freed.
Fix this by calling 'bpf_obj_free_fields()' after 'copy_map_value[,_long]()' in 'pcpu_copy_value()'.
--- kernel/bpf/hashtab.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
kernel/bpf/hashtab.c +8 -2
@@ -939,15 +939,21 @@ static void free_htab_elem(struct bpf_htab *htab, struct htab_elem *l)static void pcpu_copy_value (struct bpf_htab *htab,void __percpu *pptr,void *value,bool onallcpus) { +void *ptr; +if (!onallcpus) {/* copy true value_size bytes */ -copy_map_value (&htab->map,this_cpu_ptr (pptr), value); + ptr =this_cpu_ptr (pptr); +copy_map_value (&htab->map, ptr, value); +bpf_obj_free_fields (htab->map.record, ptr); }else {u32 size =round_up (htab->map.value_size,8 );int off =0 , cpu;for_each_possible_cpu (cpu) { -copy_map_value_long (&htab->map,per_cpu_ptr (pptr, cpu), value + off); + ptr =per_cpu_ptr (pptr, cpu); +copy_map_value_long (&htab->map, ptr, value + off); +bpf_obj_free_fields (htab->map.record, ptr); off += size; } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 232/507 PCI: keystone: Exit ks_pcie_probe() for invalid mode
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Vadapalli <[email protected]>
[ Upstream commit 95d9c3f0e4546eaec0977f3b387549a8463cd49f ]
Commit under Fixes introduced support for PCIe EP mode on AM654x platforms. When the mode happens to be either "DW_PCIE_RC_TYPE" or "DW_PCIE_EP_TYPE", the PCIe Controller is configured accordingly. However, when the mode is neither of them, an error message is displayed, but the driver probe succeeds. Since this "invalid" mode is not associated with a functional PCIe Controller, the probe should fail.
Fix the behavior by exiting "ks_pcie_probe()" with the return value of "-EINVAL" in addition to displaying the existing error message when the mode is invalid.
--- drivers/pci/controller/dwc/pci-keystone.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/dwc/pci-keystone.c +2 -0
@@ -1338,6 +1338,8 @@ static int ks_pcie_probe(struct platform_device *pdev)break ;default :dev_err (dev,"INVALID device type %d\n" , mode); + ret = -EINVAL ; + goto err_get_sync; }ks_pcie_enable_error_irq (ks_pcie);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 233/507 arm64: dts: rockchip: Move the EEPROM to correct I2C bus on Radxa ROCK 5A
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: FUKAUMI Naoki <[email protected]>
[ Upstream commit 92e6e0b0e595afdda6296c760551ad3ffe9d5231 ]
The BL24C16 EEPROM chip found on Radxa ROCK 5A is connected to the i2c0 bus, [1] so move the eeprom node from the i2c2 bus to the i2c0 bus.
[1] Link: https://dl.radxa.com/rock5/5a/docs/hw/radxa_rock5a_V1.1_sch.pdf p.19
--- arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts +6 -6
@@ -221,6 +221,12 @@ regulator-state-mem { regulator-off-in-suspend; }; }; + + eeprom: eeprom@50 { + compatible = "belling,bl24c16a", "atmel,24c16"; + reg = <0x50>; + pagesize = <16>; + }; }; &i2c2 {
@@ -242,12 +248,6 @@ regulator-state-mem { regulator-off-in-suspend; }; }; - - eeprom: eeprom@50 { - compatible = "belling,bl24c16a", "atmel,24c16"; - reg = <0x50>; - pagesize = <16>; - }; }; &i2c3 {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 234/507 arm64: dts: rockchip: Add eeprom vcc-supply for Radxa ROCK 5A
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: FUKAUMI Naoki <[email protected]>
[ Upstream commit 3069ff1930aa71e125874c780ffaa6caeda5800a ]
The VCC supply for the BL24C16 EEPROM chip found on Radxa ROCK 5A is vcc_3v3_pmu, which is routed to vcc_3v3_s3 via a zero-ohm resistor. [1] Describe this supply.
[1] https://dl.radxa.com/rock5/5a/docs/hw/radxa_rock5a_V1.1_sch.pdf p.4, p.19
--- arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts +2 -1
@@ -226,6 +226,7 @@ eeprom: eeprom@50 { compatible = "belling,bl24c16a", "atmel,24c16"; reg = <0x50>; pagesize = <16>; + vcc-supply = <&vcc_3v3_pmu>; }; };
@@ -593,7 +594,7 @@ regulator-state-mem { }; }; - vcc_3v3_s3: dcdc-reg8 { + vcc_3v3_pmu: vcc_3v3_s3: dcdc-reg8 { regulator-name = "vcc_3v3_s3"; regulator-always-on; regulator-boot-on;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 235/507 arm64: dts: rockchip: Add eeprom vcc-supply for Radxa ROCK 3C
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: FUKAUMI Naoki <[email protected]>
[ Upstream commit 260316d35cf8f8606c5ed7a349cc92e1e71d8150 ]
The VCC supply for the BL24C16 EEPROM chip found on Radxa ROCK 3C is vcca1v8_pmu. [1] Describe this supply.
[1] https://dl.radxa.com/rock3/docs/hw/3c/v1400/radxa_rock_3c_v1400_schematic.pdf p.13
--- arch/arm64/boot/dts/rockchip/rk3566-rock-3c.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/rockchip/rk3566-rock-3c.dts +1 -0
@@ -466,6 +466,7 @@ eeprom: eeprom@50 { compatible = "belling,bl24c16a", "atmel,24c16"; reg = <0x50>; pagesize = <16>; + vcc-supply = <&vcca1v8_pmu>; }; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 236/507 crypto: iaa - Fix incorrect return value in save_iaa_wq()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zilin Guan <[email protected]>
[ Upstream commit 76ce17f6f7f78ab79b9741388bdb4dafa985b4e9 ]
The save_iaa_wq() function unconditionally returns 0, even when an error is encountered. This prevents the error code from being propagated to the caller.
Fix this by returning the 'ret' variable, which holds the actual status of the operations within the function.
--- drivers/crypto/intel/iaa/iaa_crypto_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/intel/iaa/iaa_crypto_main.c +1 -1
@@ -805,7 +805,7 @@ static int save_iaa_wq(struct idxd_wq *wq)if (!cpus_per_iaa) cpus_per_iaa =1 ; out: -return 0 ; +return ret; }static void remove_iaa_wq (struct idxd_wq *wq)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 237/507 s390/fpu: Fix false-positive kmsan report in fpu_vstl()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksei Nikiforov <[email protected]>
[ Upstream commit 14e4e4175b64dd9216b522f6ece8af6997d063b2 ]
A false-positive kmsan report is detected when running ping command.
An inline assembly instruction 'vstl' can write varied amount of bytes depending on value of 'index' argument. If 'index' > 0, 'vstl' writes at least 2 bytes.
clang generates kmsan write helper call depending on inline assembly constraints. Constraints are evaluated compile-time, but value of 'index' argument is known only at runtime.
clang currently generates call to __msan_instrument_asm_store with 1 byte as size. Manually call kmsan function to indicate correct amount of bytes written and fix false-positive report.
This change fixes following kmsan reports:
[ 36.563119] ===================================================== [ 36.563594] BUG: KMSAN: uninit-value in virtqueue_add+0x35c6/0x7c70 [ 36.563852] virtqueue_add+0x35c6/0x7c70 [ 36.564016] virtqueue_add_outbuf+0xa0/0xb0 [ 36.564266] start_xmit+0x288c/0x4a20 [ 36.564460] dev_hard_start_xmit+0x302/0x900 [ 36.564649] sch_direct_xmit+0x340/0xea0 [ 36.564894] __dev_queue_xmit+0x2e94/0x59b0 [ 36.565058] neigh_resolve_output+0x936/0xb40 [ 36.565278] __neigh_update+0x2f66/0x3a60 [ 36.565499] neigh_update+0x52/0x60 [ 36.565683] arp_process+0x1588/0x2de0 [ 36.565916] NF_HOOK+0x1da/0x240 [ 36.566087] arp_rcv+0x3e4/0x6e0 [ 36.566306] __netif_receive_skb_list_core+0x1374/0x15a0 [ 36.566527] netif_receive_skb_list_internal+0x1116/0x17d0 [ 36.566710] napi_complete_done+0x376/0x740 [ 36.566918] virtnet_poll+0x1bae/0x2910 [ 36.567130] __napi_poll+0xf4/0x830 [ 36.567294] net_rx_action+0x97c/0x1ed0 [ 36.567556] handle_softirqs+0x306/0xe10 [ 36.567731] irq_exit_rcu+0x14c/0x2e0 [ 36.567910] do_io_irq+0xd4/0x120 [ 36.568139] io_int_handler+0xc2/0xe8 [ 36.568299] arch_cpu_idle+0xb0/0xc0 [ 36.568540] arch_cpu_idle+0x76/0xc0 [ 36.568726] default_idle_call+0x40/0x70 [ 36.568953] do_idle+0x1d6/0x390 [ 36.569486] cpu_startup_entry+0x9a/0xb0 [ 36.569745] rest_init+0x1ea/0x290 [ 36.570029] start_kernel+0x95e/0xb90 [ 36.570348] startup_continue+0x2e/0x40 [ 36.570703] [ 36.570798] Uninit was created at: [ 36.571002] kmem_cache_alloc_node_noprof+0x9e8/0x10e0 [ 36.571261] kmalloc_reserve+0x12a/0x470 [ 36.571553] __alloc_skb+0x310/0x860 [ 36.571844] __ip_append_data+0x483e/0x6a30 [ 36.572170] ip_append_data+0x11c/0x1e0 [ 36.572477] raw_sendmsg+0x1c8c/0x2180 [ 36.572818] inet_sendmsg+0xe6/0x190 [ 36.573142] __sys_sendto+0x55e/0x8e0 [ 36.573392] __s390x_sys_socketcall+0x19ae/0x2ba0 [ 36.573571] __do_syscall+0x12e/0x240 [ 36.573823] system_call+0x6e/0x90 [ 36.573976] [ 36.574017] Byte 35 of 98 is uninitialized [ 36.574082] Memory access of size 98 starts at 0000000007aa0012 [ 36.574218] [ 36.574325] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Tainted: G B N 6.17.0-dirty #16 NONE [ 36.574541] Tainted: [B]=BAD_PAGE, [N]=TEST [ 36.574617] Hardware name: IBM 3931 A01 703 (KVM/Linux) [ 36.574755] =====================================================
[ 63.532541] ===================================================== [ 63.533639] BUG: KMSAN: uninit-value in virtqueue_add+0x35c6/0x7c70 [ 63.533989] virtqueue_add+0x35c6/0x7c70 [ 63.534940] virtqueue_add_outbuf+0xa0/0xb0 [ 63.535861] start_xmit+0x288c/0x4a20 [ 63.536708] dev_hard_start_xmit+0x302/0x900 [ 63.537020] sch_direct_xmit+0x340/0xea0 [ 63.537997] __dev_queue_xmit+0x2e94/0x59b0 [ 63.538819] neigh_resolve_output+0x936/0xb40 [ 63.539793] ip_finish_output2+0x1ee2/0x2200 [ 63.540784] __ip_finish_output+0x272/0x7a0 [ 63.541765] ip_finish_output+0x4e/0x5e0 [ 63.542791] ip_output+0x166/0x410 [ 63.543771] ip_push_pending_frames+0x1a2/0x470 [ 63.544753] raw_sendmsg+0x1f06/0x2180 [ 63.545033] inet_sendmsg+0xe6/0x190 [ 63.546006] __sys_sendto+0x55e/0x8e0 [ 63.546859] __s390x_sys_socketcall+0x19ae/0x2ba0 [ 63.547730] __do_syscall+0x12e/0x240 [ 63.548019] system_call+0x6e/0x90 [ 63.548989] [ 63.549779] Uninit was created at: [ 63.550691] kmem_cache_alloc_node_noprof+0x9e8/0x10e0 [ 63.550975] kmalloc_reserve+0x12a/0x470 [ 63.551969] __alloc_skb+0x310/0x860 [ 63.552949] __ip_append_data+0x483e/0x6a30 [ 63.553902] ip_append_data+0x11c/0x1e0 [ 63.554912] raw_sendmsg+0x1c8c/0x2180 [ 63.556719] inet_sendmsg+0xe6/0x190 [ 63.557534] __sys_sendto+0x55e/0x8e0 [ 63.557875] __s390x_sys_socketcall+0x19ae/0x2ba0 [ 63.558869] __do_syscall+0x12e/0x240 [ 63.559832] system_call+0x6e/0x90 [ 63.560780] [ 63.560972] Byte 35 of 98 is uninitialized [ 63.561741] Memory access of size 98 starts at 0000000005704312 [ 63.561950] [ 63.562824] CPU: 3 UID: 0 PID: 192 Comm: ping Tainted: G B N 6.17.0-dirty #16 NONE [ 63.563868] Tainted: [B]=BAD_PAGE, [N]=TEST [ 63.564751] Hardware name: IBM 3931 A01 703 (KVM/Linux) [ 63.564986] =====================================================
--- arch/s390/include/asm/fpu-insn.h | 3 +++ 1 file changed, 3 insertions(+)
arch/s390/include/asm/fpu-insn.h +3 -0
@@ -12,6 +12,7 @@#ifndef __ASSEMBLER__#include <linux/instrumented.h> +#include <linux/kmsan.h> #include <asm/asm-extable.h> asm(".include \"asm/fpu-insn-asm.h\"\n" );
@@ -393,6 +394,7 @@ static __always_inline void fpu_vstl(u8 v1, u32 index, const void *vxr) : [vxr] "=Q" (*(u8 *)vxr) : [index] "d" (index), [v1] "I" (v1) : "memory"); + kmsan_unpoison_memory(vxr, size); }#else /* CONFIG_CC_HAS_ASM_AOR_FORMAT_FLAGS */
@@ -409,6 +411,7 @@ static __always_inline void fpu_vstl(u8 v1, u32 index, const void *vxr) : [vxr] "=R" (*(u8 *)vxr) : [index] "d" (index), [v1] "I" (v1) : "memory", "1"); + kmsan_unpoison_memory(vxr, size); }#endif /* CONFIG_CC_HAS_ASM_AOR_FORMAT_FLAGS */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 238/507 arm64: dts: qcom: qrb2210-rb1: Fix UART3 wakeup IRQ storm
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Praveen Talari <[email protected]>
[ Upstream commit 9c92d36b0b1ea8b2a19dbe0416434f3491dbfaaf ]
For BT use cases, pins are configured with pull-up state in sleep state to avoid noise. If IRQ type is configured as level high and the GPIO line is also in a high state, it causes continuous interrupt assertions leading to an IRQ storm when wakeup irq enables at system suspend/runtime suspend.
Switching to edge-triggered interrupt (IRQ_TYPE_EDGE_FALLING) resolves this by only triggering on state transitions (high-to-low) rather than maintaining sensitivity to the static level state, effectively preventing the continuous interrupt condition and eliminating the wakeup IRQ storm.
--- arch/arm64/boot/dts/qcom/qrb2210-rb1.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/qrb2210-rb1.dts +1 -1
@@ -648,7 +648,7 @@ key_volp_n: key-volp-n-state { &uart3 { /delete-property/ interrupts; interrupts-extended = <&intc GIC_SPI 330 IRQ_TYPE_LEVEL_HIGH>, - <&tlmm 11 IRQ_TYPE_LEVEL_HIGH>; + <&tlmm 11 IRQ_TYPE_EDGE_FALLING>; pinctrl-0 = <&uart3_default>; pinctrl-1 = <&uart3_sleep>; pinctrl-names = "default", "sleep";
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 239/507 drm/msm/dpu: drop dpu_hw_dsc_destroy() prototype
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit d9792823d18ff9895eaf5769a29a54804f24bc25 ]
The commit a106ed98af68 ("drm/msm/dpu: use devres-managed allocation for HW blocks") dropped all dpu_hw_foo_destroy() functions, but the prototype for dpu_hw_dsc_destroy() was omitted. Drop it now to clean up the header.
Patchwork: https://patchwork.freedesktop.org/patch/683697/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h | 6 ------ 1 file changed, 6 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h +0 -6
@@ -71,12 +71,6 @@ struct dpu_hw_dsc *dpu_hw_dsc_init_1_2(struct drm_device *dev,const struct dpu_dsc_cfg *cfg, void __iomem *addr); -/** -* dpu_hw_dsc_destroy - destroys dsc driver context -* @dsc: Pointer to dsc driver context returned by dpu_hw_dsc_init -*/ -void dpu_hw_dsc_destroy (struct dpu_hw_dsc *dsc); -static inline struct dpu_hw_dsc *to_dpu_hw_dsc (struct dpu_hw_blk *hw) { return container_of(hw, struct dpu_hw_dsc, base);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 240/507 ps3disk: use memcpy_{from,to}_bvec index
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rene Rebe <[email protected]>
[ Upstream commit 79bd8c9814a273fa7ba43399e1c07adec3fc95db ]
With 6e0a48552b8c (ps3disk: use memcpy_{from,to}_bvec) converting ps3disk to new bvec helpers, incrementing the offset was accidently lost, corrupting consecutive buffers. Restore index for non-corrupted data transfers.
--- drivers/block/ps3disk.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/block/ps3disk.c +4 -0
@@ -85,10 +85,14 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev,struct bio_vec bvec;rq_for_each_segment (bvec, req, iter) { +dev_dbg (&dev->sbd.core,"%s:%u: %u sectors from %llu\n" , + __func__, __LINE__,bio_sectors (iter.bio), + iter.bio->bi_iter.bi_sector);if (gather)memcpy_from_bvec (dev->bounce_buf + offset, &bvec);else memcpy_to_bvec (&bvec, dev->bounce_buf + offset); + offset += bvec.bv_len; } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 241/507 PCI: Prevent resource tree corruption when BAR resize fails
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
[ Upstream commit 91c4c89db41499eea1b29c56655f79c3bae66e93 ]
pbus_reassign_bridge_resources() saves bridge windows into the saved list before attempting to adjust resource assignments to perform a BAR resize operation. If resource adjustments cannot be completed fully, rollback is attempted by restoring the resource from the saved list.
The rollback, however, does not check whether the resources it restores were assigned by the partial resize attempt. If restore changes addresses of the resource, it can result in corrupting the resource tree.
An example of a corrupted resource tree with overlapping addresses:
6200000000000-6203fbfffffff : pciex@620c3c0000000
6200000000000-6203fbff0ffff : PCI Bus 0030:01
6200020000000-62000207fffff : 0030:01:00.0
6200000000000-6203fbff0ffff : PCI Bus 0030:02A resource that are assigned into the resource tree must remain unchanged. Thus, release such a resource before attempting to restore and claim it back.
For simplicity, always do the release and claim back for the resource even in the cases where it is restored to the same address range.
Note: this fix may "break" some cases where devices "worked" because the resource tree corruption allowed address space double counting to fit more resource than what can now be assigned without double counting. The upcoming changes to BAR resizing should address those scenarios (to the extent possible).
--- drivers/pci/setup-bus.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/pci/setup-bus.c +5 -0
@@ -2489,6 +2489,11 @@ int pci_reassign_bridge_resources(struct pci_dev *bridge, unsigned long type) bridge = dev_res->dev; i =pci_resource_num (bridge, res); +if (res->parent) { +release_child_resources (res); +pci_release_resource (bridge, i); + } +restore_dev_resource (dev_res);pci_claim_resource (bridge, i);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 242/507 bpf: Prevent nesting overflow in bpf_try_get_buffers
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sahil Chandna <[email protected]>
[ Upstream commit c1da3df7191f1b4df9256bcd30d78f78201e1d17 ]
bpf_try_get_buffers() returns one of multiple per-CPU buffers based on a per-CPU nesting counter. This mechanism expects that buffers are not endlessly acquired before being returned. migrate_disable() ensures that a task remains on the same CPU, but it does not prevent the task from being preempted by another task on that CPU.
Without disabled preemption, a task may be preempted while holding a buffer, allowing another task to run on same CPU and acquire an additional buffer. Several such preemptions can cause the per-CPU nest counter to exceed MAX_BPRINTF_NEST_LEVEL and trigger the warning in bpf_try_get_buffers(). Adding preempt_disable()/preempt_enable() around buffer acquisition and release prevents this task preemption and preserves the intended bounded nesting behavior.
--- kernel/bpf/helpers.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/bpf/helpers.c +3 -0
@@ -774,9 +774,11 @@ int bpf_try_get_buffers(struct bpf_bprintf_buffers **bufs) {int nest_level; +preempt_disable (); nest_level =this_cpu_inc_return (bpf_bprintf_nest_level);if (WARN_ON_ONCE (nest_level >MAX_BPRINTF_NEST_LEVEL )) {this_cpu_dec (bpf_bprintf_nest_level); +preempt_enable ();return -EBUSY ; } *bufs =this_cpu_ptr (&bpf_bprintf_bufs[nest_level -1 ]);
@@ -789,6 +791,7 @@ void bpf_put_buffers(void)if (WARN_ON_ONCE (this_cpu_read (bpf_bprintf_nest_level) ==0 ))return ;this_cpu_dec (bpf_bprintf_nest_level); +preempt_enable (); }void bpf_bprintf_cleanup (struct bpf_bprintf_data *data)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 243/507 bpf: Handle return value of ftrace_set_filter_ip in register_fentry
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Menglong Dong <[email protected]>
[ Upstream commit fea3f5e83c5cd80a76d97343023a2f2e6bd862bf ]
The error that returned by ftrace_set_filter_ip() in register_fentry() is not handled properly. Just fix it.
--- kernel/bpf/trampoline.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/bpf/trampoline.c +3 -1
@@ -220,7 +220,9 @@ static int register_fentry(struct bpf_trampoline *tr, void *new_addr) }if (tr->func.ftrace_managed) { -ftrace_set_filter_ip (tr->fops, (unsigned long )ip,0 ,1 ); + ret =ftrace_set_filter_ip (tr->fops, (unsigned long )ip,0 ,1 ); +if (ret) +return ret; ret =register_ftrace_direct (tr->fops, (long )new_addr); }else { ret =bpf_arch_text_poke (ip,BPF_MOD_CALL ,NULL , new_addr);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 244/507 selftests/bpf: Fix failure paths in send_signal test
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <[email protected]>
[ Upstream commit c13339039891dbdfa6c1972f0483bd07f610b776 ]
When test_send_signal_kern__open_and_load() fails parent closes the pipe which cases ASSERT_EQ(read(pipe_p2c...)) to fail, but child continues and enters infinite loop, while parent is stuck in wait(NULL). Other error paths have similar issue, so kill the child before waiting on it.
The bug was discovered while compiling all of selftests with -O1 instead of -O2 which caused progs/test_send_signal_kern.c to fail to load.
--- tools/testing/selftests/bpf/prog_tests/send_signal.c | 5 +++++ 1 file changed, 5 insertions(+)
tools/testing/selftests/bpf/prog_tests/send_signal.c +5 -0
@@ -206,6 +206,11 @@ static void test_send_signal_common(struct perf_event_attr *attr, skel_open_load_failure:close (pipe_c2p[0 ]);close (pipe_p2c[1 ]); +/* +* Child is either about to exit cleanly or stuck in case of errors. +* Nudge it to exit. +*/ +kill (pid,SIGKILL );wait (NULL ); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 245/507 bpf: Check skb->transport_header is set in bpf_skb_check_mtu
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin KaFai Lau <[email protected]>
[ Upstream commit d946f3c98328171fa50ddb908593cf833587f725 ]
The bpf_skb_check_mtu helper needs to use skb->transport_header when the BPF_MTU_CHK_SEGS flag is used:
bpf_skb_check_mtu(skb, ifindex, &mtu_len, 0, BPF_MTU_CHK_SEGS)
The transport_header is not always set. There is a WARN_ON_ONCE report when CONFIG_DEBUG_NET is enabled + skb->gso_size is set + bpf_prog_test_run is used:
WARNING: CPU: 1 PID: 2216 at ./include/linux/skbuff.h:3071 skb_gso_validate_network_len bpf_skb_check_mtu bpf_prog_3920e25740a41171_tc_chk_segs_flag # A test in the next patch bpf_test_run bpf_prog_test_run_skb
For a normal ingress skb (not test_run), skb_reset_transport_header
is performed but there is plan to avoid setting it as described in
commit 2170a1f09148 ("net: no longer reset transport_header in __netif_receive_skb_core()").
This patch fixes the bpf helper by checking skb_transport_header_was_set(). The check is done just before skb->transport_header is used, to avoid breaking the existing bpf prog. The WARN_ON_ONCE is limited to bpf_prog_test_run, so targeting bpf-next.
--- net/core/filter.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/core/filter.c +6 -3
@@ -6414,9 +6414,12 @@ BPF_CALL_5(bpf_skb_check_mtu, struct sk_buff *, skb,*/ if (skb_is_gso (skb)) { ret =BPF_MTU_CHK_RET_SUCCESS ; -if (flags &BPF_MTU_CHK_SEGS && - !skb_gso_validate_network_len (skb, mtu)) - ret =BPF_MTU_CHK_RET_SEGS_TOOBIG ; +if (flags &BPF_MTU_CHK_SEGS ) { +if (!skb_transport_header_was_set (skb)) +return -EINVAL ; +if (!skb_gso_validate_network_len (skb, mtu)) + ret =BPF_MTU_CHK_RET_SEGS_TOOBIG ; + } } out: *mtu_len = mtu;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 246/507 mshv: Fix deposit memory in MSHV_ROOT_HVCALL
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nuno Das Neves <[email protected]>
[ Upstream commit 4cc1aa469cd6b714adc958547a4866247bfd60a9 ]
When the MSHV_ROOT_HVCALL ioctl is executing a hypercall, and gets HV_STATUS_INSUFFICIENT_MEMORY, it deposits memory and then returns -EAGAIN to userspace. The expectation is that the VMM will retry.
However, some VMM code in the wild doesn't do this and simply fails. Rather than force the VMM to retry, change the ioctl to deposit memory on demand and immediately retry the hypercall as is done with all the other hypercall helper functions.
In addition to making the ioctl easier to use, removing the need for multiple syscalls improves performance.
There is a complication: unlike the other hypercall helper functions, in MSHV_ROOT_HVCALL the input is opaque to the kernel. This is problematic for rep hypercalls, because the next part of the input list can't be copied on each loop after depositing pages (this was the original reason for returning -EAGAIN in this case).
Introduce hv_do_rep_hypercall_ex(), which adds a 'rep_start' parameter. This solves the issue, allowing the deposit loop in MSHV_ROOT_HVCALL to restart a rep hypercall after depositing pages partway through.
--- drivers/hv/mshv_root_main.c | 58 ++++++++++++++++++---------------- include/asm-generic/mshyperv.h | 17 ++++++++-- 2 files changed, 44 insertions(+), 31 deletions(-)
drivers/hv/mshv_root_main.c +30 -28
@@ -164,6 +164,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition,unsigned int pages_order;void *input_pg =NULL ;void *output_pg =NULL ; +u16 reps_completed;if (copy_from_user (&args, user_args,sizeof (args)))return -EFAULT ;
@@ -215,41 +216,42 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition,*/ *(u64 *)input_pg = partition->pt_id; -if (args.reps) - status =hv_do_rep_hypercall (args.code, args.reps,0 , - input_pg, output_pg); -else - status =hv_do_hypercall (args.code, input_pg, output_pg); - -if (hv_result (status) ==HV_STATUS_CALL_PENDING ) { -if (is_async) { -mshv_async_hvcall_handler (partition, &status); - }else {/* Paranoia check. This shouldn't happen! */ - ret = -EBADFD ; - goto free_pages_out; + reps_completed =0 ; +do { +if (args.reps) { + status =hv_do_rep_hypercall_ex (args.code, args.reps, +0 , reps_completed, + input_pg, output_pg); + reps_completed =hv_repcomp (status); + }else { + status =hv_do_hypercall (args.code, input_pg, output_pg); } - } -if (hv_result (status) ==HV_STATUS_INSUFFICIENT_MEMORY ) { - ret =hv_call_deposit_pages (NUMA_NO_NODE , partition->pt_id,1 ); -if (!ret) - ret = -EAGAIN ; - }else if (!hv_result_success (status)) { - ret =hv_result_to_errno (status); - } +if (hv_result (status) ==HV_STATUS_CALL_PENDING ) { +if (is_async) { +mshv_async_hvcall_handler (partition, &status); + }else {/* Paranoia check. This shouldn't happen! */ + ret = -EBADFD ; + goto free_pages_out; + } + } + +if (hv_result_success (status)) +break ; + +if (hv_result (status) !=HV_STATUS_INSUFFICIENT_MEMORY ) + ret =hv_result_to_errno (status); +else + ret =hv_call_deposit_pages (NUMA_NO_NODE , + partition->pt_id,1 ); + }while (!ret); -/* -* Always return the status and output data regardless of result. -* The VMM may need it to determine how to proceed. E.g. the status may -* contain the number of reps completed if a rep hypercall partially -* succeeded. -*/ args.status =hv_result (status); - args.reps = args.reps ?hv_repcomp (status) :0 ; + args.reps = reps_completed;if (copy_to_user (user_args, &args,sizeof (args))) ret = -EFAULT ; -if (output_pg && +if (!ret && output_pg &©_to_user ((void __user *)args.out_ptr, output_pg, args.out_sz)) ret = -EFAULT ;
include/asm-generic/mshyperv.h +14 -3
@@ -123,10 +123,12 @@ static inline unsigned int hv_repcomp(u64 status)/* * Rep hypercalls. Callers of this functions are supposed to ensure that -* rep_count and varhead_size comply with Hyper-V hypercall definition. +* rep_count, varhead_size, and rep_start comply with Hyper-V hypercall +* definition. */ -static inline u64 hv_do_rep_hypercall (u16 code,u16 rep_count,u16 varhead_size, -void *input,void *output) +static inline u64 hv_do_rep_hypercall_ex (u16 code,u16 rep_count, +u16 varhead_size,u16 rep_start, +void *input,void *output) {u64 control = code;u64 status;
@@ -134,6 +136,7 @@ static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size, control |= (u64 )varhead_size <<HV_HYPERCALL_VARHEAD_OFFSET ; control |= (u64 )rep_count <<HV_HYPERCALL_REP_COMP_OFFSET ; + control |= (u64 )rep_start <<HV_HYPERCALL_REP_START_OFFSET ; do { status = hv_do_hypercall(control, input, output);
@@ -151,6 +154,14 @@ static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,return status; } +/* For the typical case where rep_start is 0 */ +static inline u64 hv_do_rep_hypercall (u16 code,u16 rep_count,u16 varhead_size, +void *input,void *output) +{ +return hv_do_rep_hypercall_ex (code, rep_count, varhead_size,0 , + input, output); +} +/* Generate the guest OS identifier as described in the Hyper-V TLFS */ static inline u64 hv_generate_guest_id (u64 kernel_version) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 247/507 Drivers: hv: VMBus protocol version 6.0
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Kisel <[email protected]>
[ Upstream commit 6802d8af47d1dccd9a74a1f708fb9129244ef843 ]
The confidential VMBus is supported starting from the protocol version 6.0 onwards.
Provide the required definitions. No functional changes.
Stable-dep-of: 510164539f16 ("Drivers: hv: Free msginfo when the buffer fails to decrypt")
--- drivers/hv/hyperv_vmbus.h | 2 ++ drivers/hv/vmbus_drv.c | 12 +++++++ include/hyperv/hvgdk_mini.h | 1 + include/linux/hyperv.h | 69 +++++++++++++++++++++++++++---------- 4 files changed, 65 insertions(+), 19 deletions(-)
drivers/hv/hyperv_vmbus.h +2 -0
@@ -333,6 +333,8 @@ extern const struct vmbus_channel_message_table_entry/* General vmbus interface */ +bool vmbus_is_confidential (void ); +struct hv_device *vmbus_device_create (const guid_t *type,const guid_t *instance,struct vmbus_channel *channel);
drivers/hv/vmbus_drv.c +12 -0
@@ -56,6 +56,18 @@ static long __percpu *vmbus_evt;int vmbus_irq;int vmbus_interrupt; +/* +* If the Confidential VMBus is used, the data on the "wire" is not +* visible to either the host or the hypervisor. +*/ +static bool is_confidential; + +bool vmbus_is_confidential (void ) +{ +return is_confidential; +} +EXPORT_SYMBOL_GPL (vmbus_is_confidential); +/* * The panic notifier below is responsible solely for unloading the * vmbus connection, which is necessary in a panic event.
include/hyperv/hvgdk_mini.h +1 -0
@@ -260,6 +260,7 @@ union hv_hypervisor_version_info {#define HYPERV_CPUID_VIRT_STACK_PROPERTIES 0x40000082/* Support for the extended IOAPIC RTE format */ #define HYPERV_VS_PROPERTIES_EAX_EXTENDED_IOAPIC_RTE BIT(2) +#define HYPERV_VS_PROPERTIES_EAX_CONFIDENTIAL_VMBUS_AVAILABLE BIT(3)#define HYPERV_HYPERVISOR_PRESENT_BIT 0x80000000#define HYPERV_CPUID_MIN 0x40000005
include/linux/hyperv.h +50 -19
105 lines not on this page · raw message
Signature · 1 line
2.51.0
RE: [PATCH 6.17 247/507] Drivers: hv: VMBus protocol version 6.0
From: Greg Kroah-Hartman <[email protected]> Sent: Tuesday, December 16, 2025 3:11 AM
Quoted 2 lines
6.17-stable review patch. If anyone has any objections, please let me know.
I don't think this patch should be backported to any stable versions. It's part of a large-ish patch set that implements a new feature.
Wei Liu -- is there anything going on behind the scenes that would suggest otherwise?
Michael
Quoted 210 lines
------------------
From: Roman Kisel <[email protected]>
[ Upstream commit
6802d8af47d1dccd9a74a1f708fb9129244ef843]The confidential VMBus is supported starting from the protocol version 6.0 onwards.
Provide the required definitions. No functional changes.
Signed-off-by Roman Kisel <[email protected]>Reviewed-by Alok Tiwari <[email protected]>Reviewed-by Michael Kelley <[email protected]>Signed-off-by Wei Liu <[email protected]>Stable-dep-of:
510164539f16("Drivers: hv: Free msginfo when the buffer fails to decrypt")Signed-off-by Sasha Levin <[email protected]>--- drivers/hv/hyperv_vmbus.h | 2 ++ drivers/hv/vmbus_drv.c | 12 +++++++ include/hyperv/hvgdk_mini.h | 1 + include/linux/hyperv.h | 69 +++++++++++++++++++++++++++---------- 4 files changed, 65 insertions(+), 19 deletions(-)drivers/hv/hyperv_vmbus.h +2
-0@@ -333,6 +333,8 @@ extern const struct vmbus_channel_message_table_entry/* General vmbus interface */ +bool vmbus_is_confidential (void ); +struct hv_device *vmbus_device_create (const guid_t *type,const guid_t *instance,struct vmbus_channel *channel);drivers/hv/vmbus_drv.c +12
-0@@ -56,6 +56,18 @@ static long __percpu *vmbus_evt;int vmbus_irq;int vmbus_interrupt; +/* +* If the Confidential VMBus is used, the data on the "wire" is not +* visible to either the host or the hypervisor. +*/ +static bool is_confidential; + +bool vmbus_is_confidential (void ) +{ +return is_confidential; +} +EXPORT_SYMBOL_GPL (vmbus_is_confidential); +/* * The panic notifier below is responsible solely for unloading the * vmbus connection, which is necessary in a panic event. include/hyperv/hvgdk_mini.h +1
-0@@ -260,6 +260,7 @@ union hv_hypervisor_version_info {#define HYPERV_CPUID_VIRT_STACK_PROPERTIES 0x40000082/* Support for the extended IOAPIC RTE format */ #define HYPERV_VS_PROPERTIES_EAX_EXTENDED_IOAPIC_RTE BIT(2) +#define HYPERV_VS_PROPERTIES_EAX_CONFIDENTIAL_VMBUS_AVAILABLE BIT(3)#define HYPERV_HYPERVISOR_PRESENT_BIT 0x80000000#define HYPERV_CPUID_MIN 0x40000005include/linux/hyperv.h +5
-10@@ -265,16 +265,18 @@ static inline u32 hv_get_avail_to_write_percent(* Linux kernel. */ -#define VERSION_WS2008 ((0 << 16) | (13)) -#define VERSION_WIN7 ((1 << 16) | (1)) -#define VERSION_WIN8 ((2 << 16) | (4)) -#define VERSION_WIN8_1 ((3 << 16) | (0)) -#define VERSION_WIN10 ((4 << 16) | (0)) -#define VERSION_WIN10_V4_1 ((4 << 16) | (1)) -#define VERSION_WIN10_V5 ((5 << 16) | (0)) -#define VERSION_WIN10_V5_1 ((5 << 16) | (1)) -#define VERSION_WIN10_V5_2 ((5 << 16) | (2)) -#define VERSION_WIN10_V5_3 ((5 << 16) | (3)) +#define VMBUS_MAKE_VERSION (MAJ ,MIN ) ((((u32)MAJ) << 16) | (MIN)) +#define VERSION_WS2008 VMBUS_MAKE_VERSION(0, 13) +#define VERSION_WIN7 VMBUS_MAKE_VERSION(1, 1) +#define VERSION_WIN8 VMBUS_MAKE_VERSION(2, 4) +#define VERSION_WIN8_1 VMBUS_MAKE_VERSION(3, 0) +#define VERSION_WIN10 VMBUS_MAKE_VERSION(4, 0) +#define VERSION_WIN10_V4_1 VMBUS_MAKE_VERSION(4, 1)include/linux/hyperv.h +2
-0+#define VERSION_WIN10_V5 VMBUS_MAKE_VERSION(5, 0) +#define VERSION_WIN10_V5_1 VMBUS_MAKE_VERSION(5, 1) +#define VERSION_WIN10_V5_2 VMBUS_MAKE_VERSION(5, 2) +#define VERSION_WIN10_V5_3 VMBUS_MAKE_VERSION(5, 3) +#define VERSION_WIN10_V6_0 VMBUS_MAKE_VERSION(6, 0)/* Make maximum size of pipe payload of 16K */
#defineMAX_PIPE_DATA_PAYLOAD(sizeof(u8) * 16384)include/linux/hyperv.h +16
-8@@ -335,14 +337,22 @@ struct vmbus_channel_offer { } __packed;/* Server Flags */ -#define VMBUS_CHANNEL_ENUMERATE_DEVICE_INTERFACE 1 -#define VMBUS_CHANNEL_SERVER_SUPPORTS_TRANSFER_PAGES 2 -#define VMBUS_CHANNEL_SERVER_SUPPORTS_GPADLS 4 -#define VMBUS_CHANNEL_NAMED_PIPE_MODE 0x10 -#define VMBUS_CHANNEL_LOOPBACK_OFFER 0x100 -#define VMBUS_CHANNEL_PARENT_OFFER 0x200 -#define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x400 -#define VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER 0x2000 +#define VMBUS_CHANNEL_ENUMERATE_DEVICE_INTERFACE 0x0001 +/* +* This flag indicates that the channel is offered by the paravisor, and must +* use encrypted memory for the channel ring buffer. +*/ +#define VMBUS_CHANNEL_CONFIDENTIAL_RING_BUFFER 0x0002 +/* +* This flag indicates that the channel is offered by the paravisor, and must +* use encrypted memory for GPA direct packets and additional GPADLs. +*/ +#define VMBUS_CHANNEL_CONFIDENTIAL_EXTERNAL_MEMORY 0x0004 +#define VMBUS_CHANNEL_NAMED_PIPE_MODE 0x0010 +#define VMBUS_CHANNEL_LOOPBACK_OFFER 0x0100 +#define VMBUS_CHANNEL_PARENT_OFFER 0x0200 +#define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x0400 +#define VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER 0x2000struct
vmpacket_descriptor{include/linux/hyperv.h +20
-1u16 type;@@ -621,6 +631,12 @@ struct vmbus_channel_relid_released {u32 child_relid; } __packed; +/* +* Used by the paravisor only, means that the encrypted ring buffers and +* the encrypted external memory are supported +*/ +#define VMBUS_FEATURE_FLAG_CONFIDENTIAL_CHANNELS 0x10 +struct vmbus_channel_initiate_contact {struct vmbus_channel_message_header header;u32 vmbus_version_requested;@@ -630,7 +646,8 @@ struct vmbus_channel_initiate_contact {struct {u8 msg_sint;u8 msg_vtl; -u8 reserved[6 ]; +u8 reserved[2 ]; +u32 feature_flags;/* VMBus version 6.0 */ }; };u64 monitor_page1;@@ -1008,6 +1025,10 @@ struct vmbus_channel {/* boolean to control visibility of sysfs for ring buffer */ bool ring_sysfs_visible; +/* The ring buffer is encrypted */ +bool co_ring_buffer; +/* The external memory is encrypted */ +bool co_external_memory; };#define lock_requestor (channel, flags) \@@ -1032,6 +1053,16 @@ u64 vmbus_request_addr_match(struct vmbus_channel *channel, u64 trans_id, u64 rqst_addr);u64 vmbus_request_addr (struct vmbus_channel *channel,u64 trans_id); +static inline bool is_co_ring_buffer (const struct vmbus_channel_offer_channel *o) +{ +return !!(o->offer.chn_flags &VMBUS_CHANNEL_CONFIDENTIAL_RING_BUFFER ); +} + +static inline bool is_co_external_memory (const struct vmbus_channel_offer_channel *o) +{ + return !!(o->offer.chn_flags &
VMBUS_CHANNEL_CONFIDENTIAL_EXTERNAL_MEMORY);include/linux/hyperv.h +2
-1+} +static inline bool is_hvsock_offer (const struct vmbus_channel_offer_channel *o) {return !!(o->offer.chn_flags &VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER ); --2.51.0
Re: [PATCH 6.17 247/507] Drivers: hv: VMBus protocol version 6.0
Quoted 8 lines · Michael Kelley
From: Greg Kroah-Hartman <[email protected]> Sent: Tuesday, December 16, 2025 3:11 AM
Quoted 2 lines
6.17-stable review patch. If anyone has any objections, please let me know.
I don't think this patch should be backported to any stable versions. It's part of a large-ish patch set that implements a new feature.
Wei Liu -- is there anything going on behind the scenes that would suggest otherwise?
I agree with you, Michael. This shouldn't be backported..
Wei
Greg Kroah-Hartman
maintainerPATCH 248/507 Drivers: hv: Allocate encrypted buffers when requested
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Kisel <[email protected]>
[ Upstream commit 0a4534bdf29a5b7f5a355c267d28dad9c40ba252 ]
Confidential VMBus is built around using buffers not shared with the host.
Support allocating encrypted buffers when requested.
Stable-dep-of: 510164539f16 ("Drivers: hv: Free msginfo when the buffer fails to decrypt")
--- drivers/hv/channel.c | 49 +++++++++++++++++++++++---------------- drivers/hv/hyperv_vmbus.h | 3 ++- drivers/hv/ring_buffer.c | 5 ++-- 3 files changed, 34 insertions(+), 23 deletions(-)
drivers/hv/channel.c +29 -20
@@ -444,20 +444,23 @@ static int __vmbus_establish_gpadl(struct vmbus_channel *channel,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) { -dev_warn (&channel->device_obj->device, -"Failed to set host visibility for new GPADL %d.\n" , - ret); -return ret; + gpadl->decrypted = !((channel->co_external_memory && type ==HV_GPADL_BUFFER ) || + (channel->co_ring_buffer && type ==HV_GPADL_RING )); +if (gpadl->decrypted) { +/* +* The "decrypted" flag being true assumes that set_memory_decrypted() succeeds. +* But if it fails, the encryption state of the memory is unknown. In that case, +* leave "decrypted" as true to ensure the memory is leaked instead of going back +* on the free list. +*/ + ret =set_memory_decrypted ((unsigned long )kbuffer, +PFN_UP (size)); +if (ret) { +dev_warn (&channel->device_obj->device, +"Failed to set host visibility for new GPADL %d.\n" , + ret); +return ret; + } }init_completion (&msginfo->waitevent);
@@ -545,8 +548,10 @@ static int __vmbus_establish_gpadl(struct vmbus_channel *channel,* 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; +if (gpadl->decrypted) { +if (!set_memory_encrypted ((unsigned long )kbuffer,PFN_UP (size))) + gpadl->decrypted = false; + } }return ret;
@@ -677,12 +682,13 @@ static int __vmbus_open(struct vmbus_channel *newchannel, goto error_clean_ring; err =hv_ringbuffer_init (&newchannel->outbound, - page, send_pages,0 ); + page, send_pages,0 , newchannel->co_ring_buffer);if (err) goto error_free_gpadl; err =hv_ringbuffer_init (&newchannel->inbound, &page[send_pages], - recv_pages, newchannel->max_pkt_size); + recv_pages, newchannel->max_pkt_size, + newchannel->co_ring_buffer);if (err) goto error_free_gpadl;
@@ -863,8 +869,11 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, struct vmbus_gpadl *gpadkfree (info); - ret =set_memory_encrypted ((unsigned long )gpadl->buffer, -PFN_UP (gpadl->size)); +if (gpadl->decrypted) + ret =set_memory_encrypted ((unsigned long )gpadl->buffer, +PFN_UP (gpadl->size)); +else + ret =0 ;if (ret)pr_warn ("Fail to set mem host visibility in GPADL teardown %d.\n" , ret);
drivers/hv/hyperv_vmbus.h +2 -1
@@ -182,7 +182,8 @@ extern int hv_synic_cleanup(unsigned int cpu);void hv_ringbuffer_pre_init (struct vmbus_channel *channel);int hv_ringbuffer_init (struct hv_ring_buffer_info *ring_info, -struct page *pages,u32 pagecnt,u32 max_pkt_size); +struct page *pages,u32 pagecnt,u32 max_pkt_size, +bool confidential);void hv_ringbuffer_cleanup (struct hv_ring_buffer_info *ring_info);
drivers/hv/ring_buffer.c +3 -2
@@ -184,7 +184,8 @@ void hv_ringbuffer_pre_init(struct vmbus_channel *channel)/* Initialize the ring buffer. */ int hv_ringbuffer_init (struct hv_ring_buffer_info *ring_info, -struct page *pages,u32 page_cnt,u32 max_pkt_size) +struct page *pages,u32 page_cnt,u32 max_pkt_size, +bool confidential) {struct page **pages_wraparound;int i;
@@ -208,7 +209,7 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, ring_info->ring_buffer = (struct hv_ring_buffer *)vmap (pages_wraparound, page_cnt *2 -1 ,VM_MAP , -pgprot_decrypted (PAGE_KERNEL )); + confidential ?PAGE_KERNEL :pgprot_decrypted (PAGE_KERNEL ));kfree (pages_wraparound);if (!ring_info->ring_buffer)
Signature · 1 line
2.51.0
RE: [PATCH 6.17 248/507] Drivers: hv: Allocate encrypted buffers when requested
From: Greg Kroah-Hartman <[email protected]> Sent: Tuesday, December 16, 2025 3:11 AM
Quoted 2 lines
6.17-stable review patch. If anyone has any objections, please let me know.
I don't think this patch should be backported to any stable versions.
I see that it is flagged as a dependency for backporting 510164539f16 ("Drivers: hv:
Free msginfo when the buffer fails to decrypt"). 510164539f16 is indeed a bug fix, but it's a minor "should never happen" memory leak, and I would be concerned about the risk introduced by this patch being pulled out of the large-ish patch series that implements a new feature.
Wei Liu -- again, override me if you think otherwise.
Michael
Quoted 160 lines
------------------
From: Roman Kisel <[email protected]>
[ Upstream commit
0a4534bdf29a5b7f5a355c267d28dad9c40ba252]Confidential VMBus is built around using buffers not shared with the host.
Support allocating encrypted buffers when requested.
Signed-off-by Roman Kisel <[email protected]>Reviewed-by Tianyu Lan <[email protected]>Reviewed-by Michael Kelley <[email protected]>Signed-off-by Wei Liu <[email protected]>Stable-dep-of:
510164539f16("Drivers: hv: Free msginfo when the buffer fails to decrypt")Signed-off-by Sasha Levin <[email protected]>--- drivers/hv/channel.c | 49 +++++++++++++++++++++++---------------- drivers/hv/hyperv_vmbus.h | 3 ++- drivers/hv/ring_buffer.c | 5 ++-- 3 files changed, 34 insertions(+), 23 deletions(-)drivers/hv/channel.c +1
-14@@ -444,20 +444,23 @@ static int __vmbus_establish_gpadl(struct vmbus_channel *channel, 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) { -dev_warn (&channel->device_obj->device, -"Failed to set host visibility for new GPADL %d.\n" , - ret); -return ret; + gpadl->decrypted = !((channel->co_external_memory && type ==
HV_GPADL_BUFFER) ||drivers/hv/channel.c +4
-0+ (channel->co_ring_buffer && type == HV_GPADL_RING)); +if (gpadl->decrypted) { +/* +* The "decrypted" flag being true assumes that
set_memory_decrypted()succeeds.drivers/hv/channel.c +1
-0+* But if it fails, the encryption state of the memory is unknown. In that case,
drivers/hv/channel.c +1
-0+* leave "decrypted" as true to ensure the memory is leaked instead of going back
drivers/hv/channel.c +14
-2+* on the free list. +*/ + ret =set_memory_decrypted ((unsigned long )kbuffer, +PFN_UP (size)); +if (ret) { +dev_warn (&channel->device_obj->device, +"Failed to set host visibility for new GPADL %d.\n" , + ret); +return ret; + } }init_completion (&msginfo->waitevent);@@ -545,8 +548,10 @@ static int __vmbus_establish_gpadl(struct vmbus_channel*channel, * 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; +if (gpadl->decrypted) { +if (!set_memory_encrypted ((unsigned long )kbuffer,PFN_UP (size))) + gpadl->decrypted = false; + } }drivers/hv/channel.c +3
-2return ret;@@ -677,12 +682,13 @@ static int __vmbus_open(struct vmbus_channel *newchannel, goto error_clean_ring; err =hv_ringbuffer_init (&newchannel->outbound, - page, send_pages,0 ); + page, send_pages,0 , newchannel->co_ring_buffer);if (err) goto error_free_gpadl; err =hv_ringbuffer_init (&newchannel->inbound, &page[send_pages], - recv_pages, newchannel->max_pkt_size); + recv_pages, newchannel->max_pkt_size, + newchannel->co_ring_buffer);if (err) goto error_free_gpadl;@@ -863,8 +869,11 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel,struct
vmbus_gpadl*gpaddrivers/hv/channel.c +5
-2kfree (info); - ret =set_memory_encrypted ((unsigned long )gpadl->buffer, -PFN_UP (gpadl->size)); +if (gpadl->decrypted) + ret =set_memory_encrypted ((unsigned long )gpadl->buffer, +PFN_UP (gpadl->size)); +else + ret =0 ;if (ret)pr_warn ("Fail to set mem host visibility in GPADL teardown %d.\n" , ret);drivers/hv/hyperv_vmbus.h +2
-1@@ -182,7 +182,8 @@ extern int hv_synic_cleanup(unsigned int cpu);void hv_ringbuffer_pre_init (struct vmbus_channel *channel);int hv_ringbuffer_init (struct hv_ring_buffer_info *ring_info, -struct page *pages,u32 pagecnt,u32 max_pkt_size); +struct page *pages,u32 pagecnt,u32 max_pkt_size, +bool confidential);void hv_ringbuffer_cleanup (struct hv_ring_buffer_info *ring_info);drivers/hv/ring_buffer.c +3
-2@@ -184,7 +184,8 @@ void hv_ringbuffer_pre_init(struct vmbus_channel *channel)/* Initialize the ring buffer. */ int hv_ringbuffer_init (struct hv_ring_buffer_info *ring_info, -struct page *pages,u32 page_cnt,u32 max_pkt_size) +struct page *pages,u32 page_cnt,u32 max_pkt_size, +bool confidential) {struct page **pages_wraparound;int i;@@ -208,7 +209,7 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, ring_info->ring_buffer = (struct hv_ring_buffer *)vmap (pages_wraparound, page_cnt *2 -1 ,VM_MAP , -pgprot_decrypted (PAGE_KERNEL )); + confidential ?PAGE_KERNEL :pgprot_decrypted (PAGE_KERNEL ));kfree (pages_wraparound);if (!ring_info->ring_buffer)
--
2.51.0
Greg Kroah-Hartman
maintainerRe: [PATCH 6.17 248/507] Drivers: hv: Allocate encrypted buffers when requested
Quoted 11 lines · Michael Kelley
From: Greg Kroah-Hartman <[email protected]> Sent: Tuesday, December 16, 2025 3:11 AM
Quoted 2 lines
6.17-stable review patch. If anyone has any objections, please let me know.
I don't think this patch should be backported to any stable versions.
I see that it is flagged as a dependency for backporting
510164539f16("Drivers: hv:
Free msginfo when the buffer fails to decrypt").510164539f16is indeed a bug fix, but it's a minor "should never happen" memory leak, and I would be concerned about the risk introduced by this patch being pulled out of the large-ish patch series that implements a new feature.
Now dropped, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 249/507 Drivers: hv: Free msginfo when the buffer fails to decrypt
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Kisel <[email protected]>
[ Upstream commit 510164539f16062e842a9de762616b5008616fa1 ]
The early failure path in __vmbus_establish_gpadl() doesn't deallocate msginfo if the buffer fails to decrypt.
Fix the leak by breaking out the cleanup code into a separate function and calling it where required.
--- drivers/hv/channel.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/hv/channel.c +18 -6
@@ -410,6 +410,21 @@ static int create_gpadl_header(enum hv_gpadl_type type, void *kbuffer,return 0 ; } +static void vmbus_free_channel_msginfo (struct vmbus_channel_msginfo *msginfo) +{ +struct vmbus_channel_msginfo *submsginfo, *tmp; + +if (!msginfo) +return ; + +list_for_each_entry_safe (submsginfo, tmp, &msginfo->submsglist, + msglistentry) { +kfree (submsginfo); + } + +kfree (msginfo); +} +/* * __vmbus_establish_gpadl - Establish a GPADL for a buffer or ringbuffer *
@@ -429,7 +444,7 @@ static int __vmbus_establish_gpadl(struct vmbus_channel *channel,struct vmbus_channel_gpadl_header *gpadlmsg;struct vmbus_channel_gpadl_body *gpadl_body;struct vmbus_channel_msginfo *msginfo =NULL ; -struct vmbus_channel_msginfo *submsginfo, *tmp; +struct vmbus_channel_msginfo *submsginfo;struct list_head *curr;u32 next_gpadl_handle;unsigned long flags;
@@ -459,6 +474,7 @@ static int __vmbus_establish_gpadl(struct vmbus_channel *channel,dev_warn (&channel->device_obj->device,"Failed to set host visibility for new GPADL %d.\n" , ret); +vmbus_free_channel_msginfo (msginfo);return ret; } }
@@ -535,12 +551,8 @@ static int __vmbus_establish_gpadl(struct vmbus_channel *channel,spin_lock_irqsave (&vmbus_connection.channelmsg_lock, flags);list_del (&msginfo->msglistentry);spin_unlock_irqrestore (&vmbus_connection.channelmsg_lock, flags); -list_for_each_entry_safe (submsginfo, tmp, &msginfo->submsglist, - msglistentry) { -kfree (submsginfo); - } -kfree (msginfo); +vmbus_free_channel_msginfo (msginfo);if (ret) {/*
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 250/507 mshv: Fix create memory region overlap check
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nuno Das Neves <[email protected]>
[ Upstream commit ba9eb9b86d232854e983203dc2fb1ba18e316681 ]
The current check is incorrect; it only checks if the beginning or end of a region is within an existing region. This doesn't account for userspace specifying a region that begins before and ends after an existing region.
Change the logic to a range intersection check against gfns and uaddrs for each region.
Remove mshv_partition_region_by_uaddr() as it is no longer used.
--- drivers/hv/mshv_root_main.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-)
drivers/hv/mshv_root_main.c +11 -20
@@ -1200,21 +1200,6 @@ mshv_partition_region_by_gfn(struct mshv_partition *partition, u64 gfn)return NULL ; } -static struct mshv_mem_region * -mshv_partition_region_by_uaddr (struct mshv_partition *partition,u64 uaddr) -{ -struct mshv_mem_region *region; - -hlist_for_each_entry (region, &partition->pt_mem_regions, hnode) { -if (uaddr >= region->start_uaddr && - uaddr < region->start_uaddr + - (region->nr_pages <<HV_HYP_PAGE_SHIFT )) -return region; - } - -return NULL ; -} -/* * NB: caller checks and makes sure mem->size is page aligned * Returns: 0 with regionpp updated on success, or -errno
@@ -1224,15 +1209,21 @@ static int mshv_partition_create_region(struct mshv_partition *partition, struct mshv_mem_region **regionpp, bool is_mmio) { -struct mshv_mem_region *region; +struct mshv_mem_region *region, *rg;u64 nr_pages =HVPFN_DOWN (mem->size);/* Reject overlapping regions */ -if (mshv_partition_region_by_gfn (partition, mem->guest_pfn) || -mshv_partition_region_by_gfn (partition, mem->guest_pfn + nr_pages -1 ) || -mshv_partition_region_by_uaddr (partition, mem->userspace_addr) || -mshv_partition_region_by_uaddr (partition, mem->userspace_addr + mem->size -1 )) +hlist_for_each_entry (rg, &partition->pt_mem_regions, hnode) { +u64 rg_size = rg->nr_pages <<HV_HYP_PAGE_SHIFT ; + +if ((mem->guest_pfn + nr_pages <= rg->start_gfn || + rg->start_gfn + rg->nr_pages <= mem->guest_pfn) && + (mem->userspace_addr + mem->size <= rg->start_uaddr || + rg->start_uaddr + rg_size <= mem->userspace_addr)) +continue ; +return -EEXIST ; + } region =vzalloc (sizeof (*region) +sizeof (struct page *) * nr_pages);if (!region)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 251/507 watchdog: wdat_wdt: Fix ACPI table leak in probe function
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 25c0b472eab8379683d4eef681185c104bed8ffd ]
wdat_wdt_probe() calls acpi_get_table() to obtain the WDAT ACPI table but never calls acpi_put_table() on any paths. This causes a permanent ACPI table memory leak.
Add a single cleanup path which calls acpi_put_table() to ensure the ACPI table is always released.
--- drivers/watchdog/wdat_wdt.c | 64 +++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 21 deletions(-)
drivers/watchdog/wdat_wdt.c +43 -21
@@ -326,19 +326,27 @@ static int wdat_wdt_probe(struct platform_device *pdev)return -ENODEV ; wdat =devm_kzalloc (dev,sizeof (*wdat),GFP_KERNEL ); -if (!wdat) -return -ENOMEM ; +if (!wdat) { + ret = -ENOMEM ; + goto out_put_table; + } regs =devm_kcalloc (dev, pdev->num_resources,sizeof (*regs),GFP_KERNEL ); -if (!regs) -return -ENOMEM ; +if (!regs) { + ret = -ENOMEM ; + goto out_put_table; + }/* WDAT specification wants to have >= 1ms period */ -if (tbl->timer_period <1 ) -return -EINVAL ; -if (tbl->min_count > tbl->max_count) -return -EINVAL ; +if (tbl->timer_period <1 ) { + ret = -EINVAL ; + goto out_put_table; + } +if (tbl->min_count > tbl->max_count) { + ret = -EINVAL ; + goto out_put_table; + } wdat->period = tbl->timer_period; wdat->wdd.min_timeout =DIV_ROUND_UP (wdat->period * tbl->min_count,1000 );
@@ -355,15 +363,20 @@ static int wdat_wdt_probe(struct platform_device *pdev) res = &pdev->resource[i];if (resource_type (res) ==IORESOURCE_MEM ) { reg =devm_ioremap_resource (dev, res); -if (IS_ERR (reg)) -return PTR_ERR (reg); +if (IS_ERR (reg)) { + ret =PTR_ERR (reg); + goto out_put_table; + } }else if (resource_type (res) ==IORESOURCE_IO ) { reg =devm_ioport_map (dev, res->start,1 ); -if (!reg) -return -ENOMEM ; +if (!reg) { + ret = -ENOMEM ; + goto out_put_table; + } }else {dev_err (dev,"Unsupported resource\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto out_put_table; } regs[i] = reg;
@@ -385,8 +398,10 @@ static int wdat_wdt_probe(struct platform_device *pdev) } instr =devm_kzalloc (dev,sizeof (*instr),GFP_KERNEL ); -if (!instr) -return -ENOMEM ; +if (!instr) { + ret = -ENOMEM ; + goto out_put_table; + }INIT_LIST_HEAD (&instr->node); instr->entry = entries[i];
@@ -417,7 +432,8 @@ static int wdat_wdt_probe(struct platform_device *pdev)if (!instr->reg) {dev_err (dev,"I/O resource not found\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto out_put_table; } instructions = wdat->instructions[action];
@@ -425,8 +441,10 @@ static int wdat_wdt_probe(struct platform_device *pdev) instructions =devm_kzalloc (dev,sizeof (*instructions),GFP_KERNEL ); -if (!instructions) -return -ENOMEM ; +if (!instructions) { + ret = -ENOMEM ; + goto out_put_table; + }INIT_LIST_HEAD (instructions); wdat->instructions[action] = instructions;
@@ -443,7 +461,7 @@ static int wdat_wdt_probe(struct platform_device *pdev) ret =wdat_wdt_enable_reboot (wdat);if (ret) -return ret; + goto out_put_table;platform_set_drvdata (pdev, wdat);
@@ -460,12 +478,16 @@ static int wdat_wdt_probe(struct platform_device *pdev) ret =wdat_wdt_set_timeout (&wdat->wdd, timeout);if (ret) -return ret; + goto out_put_table;watchdog_set_nowayout (&wdat->wdd, nowayout);watchdog_stop_on_reboot (&wdat->wdd);watchdog_stop_on_unregister (&wdat->wdd); -return devm_watchdog_register_device (dev, &wdat->wdd); + ret =devm_watchdog_register_device (dev, &wdat->wdd); + +out_put_table: +acpi_put_table ((struct acpi_table_header *)tbl); +return ret; }static int wdat_wdt_suspend_noirq (struct device *dev)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 252/507 watchdog: starfive: Fix resource leak in probe error path
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 5bcc5786a0cfa9249ccbe539833040a6285d0de3 ]
If pm_runtime_put_sync() fails after watchdog_register_device() succeeds, the probe function jumps to err_exit without unregistering the watchdog device. This leaves the watchdog registered in the subsystem while the driver fails to load, resulting in a resource leak.
Add a new error label err_unregister_wdt to properly unregister the watchdog device.
--- drivers/watchdog/starfive-wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/watchdog/starfive-wdt.c +3 -1
@@ -500,12 +500,14 @@ static int starfive_wdt_probe(struct platform_device *pdev)if (pm_runtime_enabled (&pdev->dev)) { ret =pm_runtime_put_sync (&pdev->dev);if (ret) - goto err_exit; + goto err_unregister_wdt; } }return 0 ; +err_unregister_wdt: +watchdog_unregister_device (&wdt->wdd); err_exit:starfive_wdt_disable_clock (wdt);pm_runtime_disable (&pdev->dev);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 253/507 fuse_ctl_add_conn(): fix nlink breakage in case of early failure
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit c460192aae197df1b4db1dca493c35ad529f1b64 ]
fuse_ctl_remove_conn() used to decrement the link count of root manually; that got subsumed by simple_recursive_removal(), but in case when subdirectory creation has failed the latter won't get called.
Just move the modification of parent's link count into fuse_ctl_add_dentry() to keep the things simple. Allows to get rid of the nlink argument as well...
--- fs/fuse/control.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
fs/fuse/control.c +10 -9
@@ -205,8 +205,7 @@ static const struct file_operations fuse_conn_congestion_threshold_ops = {static struct dentry *fuse_ctl_add_dentry (struct dentry *parent,struct fuse_conn *fc, -const char *name, -int mode,int nlink, +const char *name,int mode,const struct inode_operations *iop,const struct file_operations *fop) {
@@ -232,7 +231,10 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,if (iop) inode->i_op = iop; inode->i_fop = fop; -set_nlink (inode, nlink); +if (S_ISDIR (mode)) { +inc_nlink (d_inode (parent)); +inc_nlink (inode); + } inode->i_private = fc;d_add (dentry, inode);
@@ -252,22 +254,21 @@ int fuse_ctl_add_conn(struct fuse_conn *fc)return 0 ; parent = fuse_control_sb->s_root; -inc_nlink (d_inode (parent));sprintf (name,"%u" , fc->dev); - parent =fuse_ctl_add_dentry (parent, fc, name,S_IFDIR |0500 ,2 , + parent =fuse_ctl_add_dentry (parent, fc, name,S_IFDIR |0500 , &simple_dir_inode_operations, &simple_dir_operations);if (!parent) goto err; -if (!fuse_ctl_add_dentry (parent, fc,"waiting" ,S_IFREG |0400 ,1 , +if (!fuse_ctl_add_dentry (parent, fc,"waiting" ,S_IFREG |0400 ,NULL , &fuse_ctl_waiting_ops) || - !fuse_ctl_add_dentry (parent, fc,"abort" ,S_IFREG |0200 ,1 , + !fuse_ctl_add_dentry (parent, fc,"abort" ,S_IFREG |0200 ,NULL , &fuse_ctl_abort_ops) || !fuse_ctl_add_dentry (parent, fc,"max_background" ,S_IFREG |0600 , -1 ,NULL , &fuse_conn_max_background_ops) || +NULL , &fuse_conn_max_background_ops) || !fuse_ctl_add_dentry (parent, fc,"congestion_threshold" , -S_IFREG |0600 ,1 ,NULL , +S_IFREG |0600 ,NULL , &fuse_conn_congestion_threshold_ops)) goto err;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 254/507 tracefs: fix a leak in eventfs_create_events_dir()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 798a401660a151633cb171738a72a8f1efb9b0b4 ]
If we have LOCKDOWN_TRACEFS, the function bails out - *after* having locked the parent directory and without bothering to undo that. Just check it before tracefs_start_creating()...
--- fs/tracefs/event_inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/tracefs/event_inode.c +2 -1
@@ -757,7 +757,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentryconst struct eventfs_entry *entries, int size, void *data) { - struct dentry *dentry = tracefs_start_creating(name, parent); + struct dentry *dentry;struct eventfs_root_inode *rei;struct eventfs_inode *ei;struct tracefs_inode *ti;
@@ -768,6 +768,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentryif (security_locked_down (LOCKDOWN_TRACEFS ))return NULL ; + dentry =tracefs_start_creating (name, parent);if (IS_ERR (dentry))return ERR_CAST (dentry);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 255/507 NFSD/blocklayout: Fix minlength check in proc_layoutget
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Bashirov <[email protected]>
[ Upstream commit 3524b021b0ec620a76c89aee78e9d4b4130fb711 ]
The extent returned by the file system may have a smaller offset than the segment offset requested by the client. In this case, the minimum segment length must be checked against the requested range. Otherwise, the client may not be able to continue the read/write operation.
--- fs/nfsd/blocklayout.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfsd/blocklayout.c +3 -1
@@ -23,6 +23,7 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp, {struct nfsd4_layout_seg *seg = &args->lg_seg;struct super_block *sb = inode->i_sb; +u64 length;u32 block_size =i_blocksize (inode);struct pnfs_block_extent *bex;struct iomap iomap;
@@ -53,7 +54,8 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp, goto out_error; } -if (iomap.length < args->lg_minlength) { + length = iomap.offset + iomap.length - seg->offset; +if (length < args->lg_minlength) {dprintk ("pnfsd: extent smaller than minlength\n" ); goto out_layoutunavailable; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 256/507 arm64: dts: imx95-tqma9596sa: fix TPM5 pinctrl node name
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markus Niebel <[email protected]>
[ Upstream commit 046cb64923e8c05a8fb656baffcd8c3fc67fb688 ]
tpm4grp will be overwritten. Fix node name
--- arch/arm64/boot/dts/freescale/imx95-tqma9596sa.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx95-tqma9596sa.dtsi +1 -1
@@ -617,7 +617,7 @@ pinctrl_tpm4: tpm4grp { fsl,pins = <IMX95_PAD_GPIO_IO05__TPM4_CH0 0x51e>; }; - pinctrl_tpm5: tpm4grp { + pinctrl_tpm5: tpm5grp { fsl,pins = <IMX95_PAD_GPIO_IO06__TPM5_CH0 0x51e>; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 257/507 arm64: dts: imx95-tqma9596sa: reduce maximum FlexSPI frequency to 66MHz
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Stein <[email protected]>
[ Upstream commit 461be3802562b2d41250b40868310579a32f32c1 ]
66 MHz is the maximum FlexPI clock frequency in normal/overdrive mode when RXCLKSRC = 0 (Default)
--- arch/arm64/boot/dts/freescale/imx95-tqma9596sa.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx95-tqma9596sa.dtsi +1 -1
@@ -115,7 +115,7 @@ &flexspi1 { flash0: flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <80000000>; + spi-max-frequency = <66000000>; spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; vcc-supply = <®_1v8>;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 258/507 block/blk-throttle: Fix throttle slice time for SSDs
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit f76581f9f1d29e32e120b0242974ba266e79de58 ]
Commit d61fcfa4bb18 ("blk-throttle: choose a small throtl_slice for SSD") introduced device type specific throttle slices if BLK_DEV_THROTTLING_LOW was enabled. Commit bf20ab538c81 ("blk-throttle: remove CONFIG_BLK_DEV_THROTTLING_LOW") removed support for BLK_DEV_THROTTLING_LOW, but left the device type specific throttle slices in place. This effectively changed throttling behavior on systems with SSD which now use a different and non-configurable slice time compared to non-SSD devices. Practical impact is that throughput tests with low configured throttle values (65536 bps) experience less than expected throughput on SSDs, presumably due to rounding errors associated with the small throttle slice time used for those devices. The same tests pass when setting the throttle values to 65536 * 4 = 262144 bps.
The original code sets the throttle slice time to DFL_THROTL_SLICE_HD if CONFIG_BLK_DEV_THROTTLING_LOW is disabled. Restore that code to fix the problem. With that, DFL_THROTL_SLICE_SSD is no longer necessary. Revert to the original code and re-introduce DFL_THROTL_SLICE to replace both DFL_THROTL_SLICE_HD and DFL_THROTL_SLICE_SSD. This effectively reverts commit d61fcfa4bb18 ("blk-throttle: choose a small throtl_slice for SSD").
While at it, also remove MAX_THROTL_SLICE since it is not used anymore.
--- block/blk-throttle.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
block/blk-throttle.c +2 -7
@@ -22,9 +22,7 @@#define THROTL_QUANTUM 32/* Throttling is performed over a slice and after that slice is renewed */ -#define DFL_THROTL_SLICE_HD (HZ / 10) -#define DFL_THROTL_SLICE_SSD (HZ / 50) -#define MAX_THROTL_SLICE (HZ) +#define DFL_THROTL_SLICE (HZ / 10)/* A workqueue to queue throttle related work */ static struct workqueue_struct *kthrotld_workqueue;
@@ -1341,10 +1339,7 @@ static int blk_throtl_init(struct gendisk *disk) goto out; } -if (blk_queue_nonrot (q)) - td->throtl_slice =DFL_THROTL_SLICE_SSD ; -else - td->throtl_slice =DFL_THROTL_SLICE_HD ; + td->throtl_slice =DFL_THROTL_SLICE ; td->track_bio_latency = !queue_is_mq (q);if (!td->track_bio_latency)blk_stat_enable_accounting (q);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 259/507 drm/msm: Fix NULL pointer dereference in crashstate_get_vm_logs()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huiwen He <[email protected]>
[ Upstream commit 3099e0247e3217e1b39c1c61766e06ec3d13835f ]
crashstate_get_vm_logs() did not check the return value of kmalloc_array(). In low-memory situations, kmalloc_array() may return NULL, leading to a NULL pointer dereference when the function later accesses state->vm_logs.
Fix this by checking the return value of kmalloc_array() and setting state->nr_vm_logs to 0 if allocation fails.
Patchwork: https://patchwork.freedesktop.org/patch/687555/
--- drivers/gpu/drm/msm/msm_gpu.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/msm_gpu.c +4 -0
@@ -348,6 +348,10 @@ static void crashstate_get_vm_logs(struct msm_gpu_state *state, struct msm_gem_v state->vm_logs =kmalloc_array ( state->nr_vm_logs,sizeof (vm->log[0 ]),GFP_KERNEL ); +if (!state->vm_logs) { + state->nr_vm_logs =0 ; + } +for (int i =0 ; i < state->nr_vm_logs; i++) {int idx = (i + first) & vm_log_mask;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 260/507 drm/msm: fix missing NULL check after kcalloc in crashstate_get_bos()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huiwen He <[email protected]>
[ Upstream commit 3065e6a4d3594b42dae6176b3e2c0c3563cf94b8 ]
The crashstate_get_bos() function allocates memory for state->bos using kcalloc(), but the vmbind path does not check for allocation failure before dereferencing it in the following drm_gpuvm_for_each_va() loop. This could lead to a NULL pointer dereference if memory allocation fails.
Fix this by wrapping the drm_gpuvm_for_each_va() loop with a NULL check on state->bos, similar to the safety check in the non-vmbind path.
Patchwork: https://patchwork.freedesktop.org/patch/687556/
--- drivers/gpu/drm/msm/msm_gpu.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/msm_gpu.c +9 -8
@@ -287,16 +287,17 @@ static void crashstate_get_bos(struct msm_gpu_state *state, struct msm_gem_submi state->bos =kcalloc (cnt,sizeof (struct msm_gpu_state_bo ),GFP_KERNEL ); - drm_gpuvm_for_each_va (vma, submit->vm) { -bool dump = rd_full || (vma->flags &MSM_VMA_DUMP ); +if (state->bos) +drm_gpuvm_for_each_va (vma, submit->vm) { +bool dump = rd_full || (vma->flags &MSM_VMA_DUMP ); -/* Skip MAP_NULL/PRR VMAs: */ -if (!vma->gem.obj) -continue ; +/* Skip MAP_NULL/PRR VMAs: */ +if (!vma->gem.obj) +continue ; -msm_gpu_crashstate_get_bo (state, vma->gem.obj, vma->va.addr, - dump, vma->gem.offset, vma->va.range); - } +msm_gpu_crashstate_get_bo (state, vma->gem.obj, vma->va.addr, + dump, vma->gem.offset, vma->va.range); + }drm_exec_fini (&exec); }else {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 261/507 drm/msm/a2xx: stop over-complaining about the legacy firmware
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit a3a22373fce576560757f5616eb48dbf85891d9c ]
If the rootfs have a legacy A200 firmware, currently the driver will complain each time the hw is reinited (which can happen a lot). E.g. with GL testsuite the hw is reinited after each test, spamming the console.
Make sure that the message is printed only once: when we detect the firmware that doesn't support protection.
Patchwork: https://patchwork.freedesktop.org/patch/688098/
--- drivers/gpu/drm/msm/adreno/a2xx_gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a2xx_gpu.c +1 -1
@@ -234,7 +234,7 @@ static int a2xx_hw_init(struct msm_gpu *gpu)* word (0x20xxxx for A200, 0x220xxx for A220, 0x225xxx for A225). * Older firmware files, which lack protection support, have 0 instead. */ -if (ptr[1 ] ==0 ) { +if (ptr[1 ] ==0 && !a2xx_gpu->protection_disabled) {dev_warn (gpu->dev->dev,"Legacy firmware detected, disabling protection support\n" ); a2xx_gpu->protection_disabled = true;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 262/507 wifi: rtl818x: Fix potential memory leaks in rtl8180_init_rx_ring()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdun Nihaal <[email protected]>
[ Upstream commit 9b5b9c042b30befc5b37e4539ace95af70843473 ]
In rtl8180_init_rx_ring(), memory is allocated for skb packets and DMA allocations in a loop. When an allocation fails, the previously successful allocations are not freed on exit.
Fix that by jumping to err_free_rings label on error, which calls rtl8180_free_rx_ring() to free the allocations. Remove the free of rx_ring in rtl8180_init_rx_ring() error path, and set the freed priv->rx_buf entry to null, to avoid double free.
--- drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c +2 -7
@@ -1023,9 +1023,6 @@ static int rtl8180_init_rx_ring(struct ieee80211_hw *dev)dma_addr_t *mapping; entry = priv->rx_ring + priv->rx_ring_sz*i;if (!skb) { -dma_free_coherent (&priv->pdev->dev, - priv->rx_ring_sz *32 , - priv->rx_ring, priv->rx_ring_dma);wiphy_err (dev->wiphy,"Cannot allocate RX skb\n" );return -ENOMEM ; }
@@ -1037,9 +1034,7 @@ static int rtl8180_init_rx_ring(struct ieee80211_hw *dev)if (dma_mapping_error (&priv->pdev->dev, *mapping)) {kfree_skb (skb); -dma_free_coherent (&priv->pdev->dev, - priv->rx_ring_sz *32 , - priv->rx_ring, priv->rx_ring_dma); + priv->rx_buf[i] =NULL ;wiphy_err (dev->wiphy,"Cannot map DMA for RX skb\n" );return -ENOMEM ; }
@@ -1130,7 +1125,7 @@ static int rtl8180_start(struct ieee80211_hw *dev) ret =rtl8180_init_rx_ring (dev);if (ret) -return ret; + goto err_free_rings;for (i =0 ; i < (dev->queues +1 ); i++)if ((ret =rtl8180_init_tx_ring (dev, i,16 )))
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 263/507 net: phy: Add helper for fixing RGMII PHY mode based on internal mac delay
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Inochi Amaoto <[email protected]>
[ Upstream commit 24afd7827efb7c69adfc41835390470e3eec4740 ]
The "phy-mode" property of devicetree indicates whether the PCB has delay now, which means the mac needs to modify the PHY mode based on whether there is an internal delay in the mac.
This modification is similar for many ethernet drivers. To simplify code, define the helper phy_fix_phy_mode_for_mac_delays(speed, mac_txid, mac_rxid) to fix PHY mode based on whether mac adds internal delay.
Stable-dep-of: db37c6e510de ("net: stmmac: dwmac-sophgo: Add phy interface filter")
--- drivers/net/phy/phy-core.c | 43 ++++++++++++++++++++++++++++++++++++++ include/linux/phy.h | 3 +++ 2 files changed, 46 insertions(+)
drivers/net/phy/phy-core.c +43 -0
@@ -101,6 +101,49 @@ const char *phy_rate_matching_to_str(int rate_matching) }EXPORT_SYMBOL_GPL (phy_rate_matching_to_str); +/** +* phy_fix_phy_mode_for_mac_delays - Convenience function for fixing PHY +* mode based on whether mac adds internal delay +* +* @interface: The current interface mode of the port +* @mac_txid: True if the mac adds internal tx delay +* @mac_rxid: True if the mac adds internal rx delay +* +* Return: fixed PHY mode, or PHY_INTERFACE_MODE_NA if the interface can +* not apply the internal delay +*/ +phy_interface_t phy_fix_phy_mode_for_mac_delays (phy_interface_t interface, +bool mac_txid,bool mac_rxid) +{ +if (!phy_interface_mode_is_rgmii (interface)) +return interface; + +if (mac_txid && mac_rxid) { +if (interface ==PHY_INTERFACE_MODE_RGMII_ID ) +return PHY_INTERFACE_MODE_RGMII ; +return PHY_INTERFACE_MODE_NA ; + } + +if (mac_txid) { +if (interface ==PHY_INTERFACE_MODE_RGMII_ID ) +return PHY_INTERFACE_MODE_RGMII_RXID ; +if (interface ==PHY_INTERFACE_MODE_RGMII_TXID ) +return PHY_INTERFACE_MODE_RGMII ; +return PHY_INTERFACE_MODE_NA ; + } + +if (mac_rxid) { +if (interface ==PHY_INTERFACE_MODE_RGMII_ID ) +return PHY_INTERFACE_MODE_RGMII_TXID ; +if (interface ==PHY_INTERFACE_MODE_RGMII_RXID ) +return PHY_INTERFACE_MODE_RGMII ; +return PHY_INTERFACE_MODE_NA ; + } + +return interface; +} +EXPORT_SYMBOL_GPL (phy_fix_phy_mode_for_mac_delays); +/** * phy_interface_num_ports - Return the number of links that can be carried by * a given MAC-PHY physical link. Returns 0 if this is
include/linux/phy.h +3 -0
@@ -1795,6 +1795,9 @@ static inline bool phy_is_pseudo_fixed_link(struct phy_device *phydev)return phydev->is_pseudo_fixed_link; } +phy_interface_t phy_fix_phy_mode_for_mac_delays (phy_interface_t interface, +bool mac_txid,bool mac_rxid); +int phy_save_page (struct phy_device *phydev);int phy_select_page (struct phy_device *phydev,int page);int phy_restore_page (struct phy_device *phydev,int oldpage,int ret);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 264/507 net: stmmac: dwmac-sophgo: Add phy interface filter
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Inochi Amaoto <[email protected]>
[ Upstream commit db37c6e510deabc9b0ee27c08f1c5aaa19f2e8ef ]
As the SG2042 has an internal rx delay, the delay should be removed when initializing the mac, otherwise the phy will be misconfigurated.
--- .../ethernet/stmicro/stmmac/dwmac-sophgo.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c +19 -1
@@ -7,11 +7,16 @@#include <linux/clk.h> #include <linux/module.h> +#include <linux/property.h> #include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include "stmmac_platform.h" +struct sophgo_dwmac_data { +bool has_internal_rx_delay; +}; +static int sophgo_sg2044_dwmac_init (struct platform_device *pdev,struct plat_stmmacenet_data *plat_dat,struct stmmac_resources *stmmac_res)
@@ -32,6 +37,7 @@ static int sophgo_sg2044_dwmac_init(struct platform_device *pdev,static int sophgo_dwmac_probe (struct platform_device *pdev) {struct plat_stmmacenet_data *plat_dat; +const struct sophgo_dwmac_data *data;struct stmmac_resources stmmac_res;struct device *dev = &pdev->dev;int ret;
@@ -50,11 +56,23 @@ static int sophgo_dwmac_probe(struct platform_device *pdev)if (ret)return ret; + data =device_get_match_data (&pdev->dev); +if (data && data->has_internal_rx_delay) { + plat_dat->phy_interface =phy_fix_phy_mode_for_mac_delays (plat_dat->phy_interface, + false, true); +if (plat_dat->phy_interface ==PHY_INTERFACE_MODE_NA ) +return -EINVAL ; + } +return stmmac_dvr_probe (dev, plat_dat, &stmmac_res); } +static const struct sophgo_dwmac_data sg2042_dwmac_data = { + .has_internal_rx_delay = true, +}; +static const struct of_device_id sophgo_dwmac_match[] = { - { .compatible ="sophgo,sg2042-dwmac" }, + { .compatible ="sophgo,sg2042-dwmac" , .data = &sg2042_dwmac_data }, { .compatible ="sophgo,sg2044-dwmac" }, {/* sentinel */ } };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 265/507 bpf: Fix invalid prog->stats access when update_effective_progs fails
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pu Lehui <[email protected]>
[ Upstream commit 7dc211c1159d991db609bdf4b0fb9033c04adcbc ]
Syzkaller triggers an invalid memory access issue following fault injection in update_effective_progs. The issue can be described as follows:
__cgroup_bpf_detach
update_effective_progs
compute_effective_progs
bpf_prog_array_alloc <-- fault inject
purge_effective_progs
/* change to dummy_bpf_prog */
array->items[index] = &dummy_bpf_prog.prog---softirq start---__do_softirq
...
__cgroup_bpf_run_filter_skb
__bpf_prog_run_save_cb
bpf_prog_run
stats = this_cpu_ptr(prog->stats)
/* invalid memory access */
flags = u64_stats_update_begin_irqsave(&stats->syncp)---softirq end---
static_branch_dec(&cgroup_bpf_enabled_key[atype])
The reason is that fault injection caused update_effective_progs to fail and then changed the original prog into dummy_bpf_prog.prog in purge_effective_progs. Then a softirq came, and accessing the members of dummy_bpf_prog.prog in the softirq triggers invalid mem access.
To fix it, skip updating stats when stats is NULL.
--- include/linux/filter.h | 12 +++++++----- kernel/bpf/syscall.c | 3 +++ 2 files changed, 10 insertions(+), 5 deletions(-)
include/linux/filter.h +7 -5
@@ -709,11 +709,13 @@ static __always_inline u32 __bpf_prog_run(const struct bpf_prog *prog, ret =dfunc (ctx, prog->insnsi, prog->bpf_func); duration =sched_clock () - start; - stats =this_cpu_ptr (prog->stats); - flags =u64_stats_update_begin_irqsave (&stats->syncp); -u64_stats_inc (&stats->cnt); -u64_stats_add (&stats->nsecs, duration); -u64_stats_update_end_irqrestore (&stats->syncp, flags); +if (likely (prog->stats)) { + stats =this_cpu_ptr (prog->stats); + flags =u64_stats_update_begin_irqsave (&stats->syncp); +u64_stats_inc (&stats->cnt); +u64_stats_add (&stats->nsecs, duration); +u64_stats_update_end_irqrestore (&stats->syncp, flags); + } }else { ret =dfunc (ctx, prog->insnsi, prog->bpf_func); }
kernel/bpf/syscall.c +3 -0
@@ -2406,6 +2406,9 @@ void notrace bpf_prog_inc_misses_counter(struct bpf_prog *prog)struct bpf_prog_stats *stats;unsigned int flags; +if (unlikely (!prog->stats)) +return ; + stats =this_cpu_ptr (prog->stats); flags =u64_stats_update_begin_irqsave (&stats->syncp);u64_stats_inc (&stats->misses);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 266/507 powerpc/64s/hash: Restrict stress_hpt_struct memblock region to within RMA limit
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ritesh Harjani (IBM) <[email protected]>
[ Upstream commit 17b45ccf09882e0c808ad2cf62acdc90ad968746 ]
When HV=0 & IR/DR=0, the Hash MMU is said to be in Virtual Real Addressing Mode during early boot. During this, we should ensure that memory region allocations for stress_hpt_struct should happen from within RMA region as otherwise the boot might get stuck while doing memset of this region.
History behind why do we have RMA region limitation is better explained in these 2 patches [1] & [2]. This patch ensures that memset to stress_hpt_struct during early boot does not cross ppc64_rma_size boundary.
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/
--- arch/powerpc/mm/book3s64/hash_utils.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/powerpc/mm/book3s64/hash_utils.c +6 -4
@@ -1302,11 +1302,14 @@ static void __init htab_initialize(void)unsigned long table;unsigned long pteg_count;unsigned long prot; -phys_addr_t base =0 , size =0 , end; +phys_addr_t base =0 , size =0 , end, limit =MEMBLOCK_ALLOC_ANYWHERE ;u64 i;DBG (" -> htab_initialize()\n" ); +if (firmware_has_feature (FW_FEATURE_LPAR )) + limit = ppc64_rma_size; +if (mmu_has_feature (MMU_FTR_1T_SEGMENT )) { mmu_kernel_ssize =MMU_SEGSIZE_1T ; mmu_highuser_ssize =MMU_SEGSIZE_1T ;
@@ -1322,7 +1325,7 @@ static void __init htab_initialize(void)// Too early to use nr_cpu_ids, so use NR_CPUS tmp =memblock_phys_alloc_range (sizeof (struct stress_hpt_struct ) *NR_CPUS , __alignof__(struct stress_hpt_struct ), -0 ,MEMBLOCK_ALLOC_ANYWHERE ); +MEMBLOCK_LOW_LIMIT , limit);memset ((void *)tmp,0xff ,sizeof (struct stress_hpt_struct ) *NR_CPUS ); stress_hpt_struct =__va (tmp);
@@ -1356,11 +1359,10 @@ static void __init htab_initialize(void) mmu_hash_ops.hpte_clear_all ();#endif }else { -unsigned long limit =MEMBLOCK_ALLOC_ANYWHERE ; table =memblock_phys_alloc_range (htab_size_bytes, htab_size_bytes, -0 , limit); +MEMBLOCK_LOW_LIMIT , limit);if (!table)panic ("ERROR: Failed to allocate %pa bytes below %pa\n" , &htab_size_bytes, &limit);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 267/507 powerpc/64s/ptdump: Fix kernel_hash_pagetable dump for ISA v3.00 HPTE format
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ritesh Harjani (IBM) <[email protected]>
[ Upstream commit eae40a6da63faa9fb63ff61f8fa2b3b57da78a84 ]
HPTE format was changed since Power9 (ISA 3.0) onwards. While dumping kernel hash page tables, nothing gets printed on powernv P9+. This patch utilizes the helpers added in the patch tagged as fixes, to convert new format to old format and dump the hptes. This fix is only needed for native_find() (powernv), since pseries continues to work fine with the old format.
--- arch/powerpc/mm/ptdump/hashpagetable.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/powerpc/mm/ptdump/hashpagetable.c +6 -0
@@ -216,6 +216,8 @@ static int native_find(unsigned long ea, int psize, bool primary, u64 *v, u64 vpn =hpt_vpn (ea, vsid, ssize); hash =hpt_hash (vpn, shift, ssize); want_v =hpte_encode_avpn (vpn, psize, ssize); +if (cpu_has_feature (CPU_FTR_ARCH_300 )) + want_v =hpte_old_to_new_v (want_v);/* to check in the secondary hash table, we invert the hash */ if (!primary)
@@ -229,6 +231,10 @@ static int native_find(unsigned long ea, int psize, bool primary, u64 *v, u64/* HPTE matches */ *v =be64_to_cpu (hptep->v); *r =be64_to_cpu (hptep->r); +if (cpu_has_feature (CPU_FTR_ARCH_300 )) { + *v =hpte_new_to_old_v (*v, *r); + *r =hpte_new_to_old_r (*r); + }return 0 ; } ++hpte_group;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 268/507 net: stmmac: Fix VLAN 0 deletion in vlan_del_hw_rx_fltr()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ovidiu Panait <[email protected]>
[ Upstream commit d9db25723677c3741a0cf3643f7f7429fc983921 ]
When the "rx-vlan-filter" feature is enabled on a network device, the 8021q module automatically adds a VLAN 0 hardware filter when the device is brought administratively up.
For stmmac, this causes vlan_add_hw_rx_fltr() to create a new entry for VID 0 in the mac_device_info->vlan_filter array, in the following format:
VLAN_TAG_DATA_ETV | VLAN_TAG_DATA_VEN | vid
Here, VLAN_TAG_DATA_VEN indicates that the hardware filter is enabled for that VID.
However, on the delete path, vlan_del_hw_rx_fltr() searches the vlan_filter array by VID only, without verifying whether a VLAN entry is enabled. As a result, when the 8021q module attempts to remove VLAN 0, the function may mistakenly match a zero-initialized slot rather than the actual VLAN 0 entry, causing incorrect deletions and leaving stale entries in the hardware table.
Fix this by verifying that the VLAN entry's enable bit (VLAN_TAG_DATA_VEN) is set before matching and deleting by VID. This ensures only active VLAN entries are removed and avoids leaving stale entries in the VLAN filter table, particularly for VLAN ID 0.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c +2 -1
@@ -122,7 +122,8 @@ static int vlan_del_hw_rx_fltr(struct net_device *dev,/* Extended Rx VLAN Filter Enable */ for (i =0 ; i < hw->num_vlan; i++) { -if ((hw->vlan_filter[i] &VLAN_TAG_DATA_VID ) == vid) { +if ((hw->vlan_filter[i] &VLAN_TAG_DATA_VEN ) && + ((hw->vlan_filter[i] &VLAN_TAG_DATA_VID ) == vid)) { ret =vlan_write_filter (dev, hw, i,0 );if (!ret)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 269/507 fs/ntfs3: out1 also needs to put mi
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit 4d78d1173a653acdaf7500a32b8dc530ca4ad075 ]
After ntfs_look_free_mft() executes successfully, all subsequent code that fails to execute must put mi.
--- fs/ntfs3/frecord.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/frecord.c +1 -1
@@ -1015,9 +1015,9 @@ static int ni_ins_attr_ext(struct ntfs_inode *ni, struct ATTR_LIST_ENTRY *le, out2:ni_remove_mi (ni, mi); -mi_put (mi); out1: +mi_put (mi);ntfs_mark_rec_free (sbi, rno, is_mft); out:
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 270/507 fs/ntfs3: Prevent memory leaks in add sub record
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit ccc4e86d1c24260c18ae94541198c3711c140da6 ]
If a rb node with the same ino already exists in the rb tree, the newly alloced mft_inode in ni_add_subrecord() will not have its memory cleaned up, which leads to the memory leak issue reported by syzbot.
The best option to avoid this issue is to put the newly alloced mft node when a rb node with the same ino already exists in the rb tree and return the rb node found in the rb tree to the parent layer.
syzbot reported:
BUG: memory leak
unreferenced object 0xffff888110bef280 (size 128):
backtrace (crc 126a088f):
ni_add_subrecord+0x31/0x180 fs/ntfs3/frecord.c:317
ntfs_look_free_mft+0xf0/0x790 fs/ntfs3/fsntfs.c:715
BUG: memory leak
unreferenced object 0xffff888109093400 (size 1024):
backtrace (crc 7197c55e):
mi_init+0x2b/0x50 fs/ntfs3/record.c:105
mi_format_new+0x40/0x220 fs/ntfs3/record.c:422--- fs/ntfs3/frecord.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ntfs3/frecord.c +4 -2
@@ -325,8 +325,10 @@ bool ni_add_subrecord(struct ntfs_inode *ni, CLST rno, struct mft_inode **mi)mi_get_ref (&ni->mi, &m->mrec->parent_ref); -ni_add_mi (ni, m); - *mi = m; + *mi =ni_ins_mi (ni, &ni->mi_tree, m->rno, &m->node); +if (*mi != m) +mi_put (m); +return true; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 271/507 drm/mediatek: Fix CCORR mtk_ctm_s31_32_to_s1_n function issue
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Liu <[email protected]>
[ Upstream commit 20ac36b71c53b8c36c6903b5ca87c75226700a97 ]
if matrixbit is 11,
The range of color matrix is from 0 to (BIT(12) - 1). Values from 0 to (BIT(11) - 1) represent positive numbers, values from BIT(11) to (BIT(12) - 1) represent negative numbers. For example, -1 need converted to 8191.
so convert S31.32 to HW Q2.11 format by drm_color_ctm_s31_32_to_qm_n, and set int_bits to 2.
--- drivers/gpu/drm/mediatek/mtk_disp_ccorr.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-)
drivers/gpu/drm/mediatek/mtk_disp_ccorr.c +1 -22
@@ -80,27 +80,6 @@ void mtk_ccorr_stop(struct device *dev)writel_relaxed (0x0 , ccorr->regs +DISP_CCORR_EN ); } -/* Converts a DRM S31.32 value to the HW S1.n format. */ -static u16 mtk_ctm_s31_32_to_s1_n (u64 in,u32 n) -{ -u16 r; - -/* Sign bit. */ - r = in &BIT_ULL (63 ) ?BIT (n +1 ) :0 ; - -if ((in &GENMASK_ULL (62 ,33 )) >0 ) { -/* identity value 0x100000000 -> 0x400(mt8183), */ -/* identity value 0x100000000 -> 0x800(mt8192), */ -/* if bigger this, set it to max 0x7ff. */ - r |=GENMASK (n,0 ); - }else { -/* take the n+1 most important bits. */ - r |= (in >> (32 - n)) &GENMASK (n,0 ); - } - -return r; -} -void mtk_ccorr_ctm_set (struct device *dev,struct drm_crtc_state *state) {struct mtk_disp_ccorr *ccorr =dev_get_drvdata (dev);
@@ -119,7 +98,7 @@ void mtk_ccorr_ctm_set(struct device *dev, struct drm_crtc_state *state) input = ctm->matrix;for (i =0 ; i <ARRAY_SIZE (coeffs); i++) - coeffs[i] =mtk_ctm_s31_32_to_s1_n (input[i], matrix_bits); + coeffs[i] =drm_color_ctm_s31_32_to_qm_n (input[i],2 , matrix_bits);mtk_ddp_write (cmdq_pkt, coeffs[0 ] <<16 | coeffs[1 ], &ccorr->cmdq_reg, ccorr->regs,DISP_CCORR_COEF_0 );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 272/507 drm/msm/a6xx: Flush LRZ cache before PT switch
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akhil P Oommen <[email protected]>
[ Upstream commit 180349b8407f3b268b2ceac0e590b8199e043081 ]
As per the recommendation, A7x and newer GPUs should flush the LRZ cache before switching the pagetable. Update a6xx_set_pagetable() to do this. While we are at it, sync both BV and BR before issuing a CP_RESET_CONTEXT_STATE command, to match the downstream sequence.
Patchwork: https://patchwork.freedesktop.org/patch/688995/
Message-ID: <[email protected]>
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +8 -2
@@ -224,7 +224,7 @@ static void a6xx_set_pagetable(struct a6xx_gpu *a6xx_gpu,OUT_RING (ring, submit->seqno -1 );OUT_PKT7 (ring,CP_THREAD_CONTROL ,1 ); -OUT_RING (ring,CP_SET_THREAD_BOTH ); +OUT_RING (ring,CP_THREAD_CONTROL_0_SYNC_THREADS |CP_SET_THREAD_BOTH );/* Reset state used to synchronize BR and BV */ OUT_PKT7 (ring,CP_RESET_CONTEXT_STATE ,1 );
@@ -235,7 +235,13 @@ static void a6xx_set_pagetable(struct a6xx_gpu *a6xx_gpu, CP_RESET_CONTEXT_STATE_0_RESET_GLOBAL_LOCAL_TS);OUT_PKT7 (ring,CP_THREAD_CONTROL ,1 ); -OUT_RING (ring,CP_SET_THREAD_BR ); +OUT_RING (ring,CP_THREAD_CONTROL_0_SYNC_THREADS |CP_SET_THREAD_BOTH ); + +OUT_PKT7 (ring,CP_EVENT_WRITE ,1 ); +OUT_RING (ring,LRZ_FLUSH ); + +OUT_PKT7 (ring,CP_THREAD_CONTROL ,1 ); +OUT_RING (ring,CP_THREAD_CONTROL_0_SYNC_THREADS |CP_SET_THREAD_BR ); }if (!sysprof) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 273/507 drm/msm/a6xx: Fix the gemnoc workaround
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akhil P Oommen <[email protected]>
[ Upstream commit ff7a6de043fce21ea5891311746b16121b385c59 ]
Correct the register offset and enable this workaround for all A7x and newer GPUs to match the recommendation. Also, downstream does this w/a after moving the fence to allow mode. So do the same.
Patchwork: https://patchwork.freedesktop.org/patch/688997/
Message-ID: <[email protected]>
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +4 -4
@@ -471,8 +471,9 @@ static void a6xx_gemnoc_workaround(struct a6xx_gmu *gmu)* in the power down sequence not being fully executed. That in turn can * prevent CX_GDSC from collapsing. Assert Qactive to avoid this. */ -if (adreno_is_a621 (adreno_gpu) ||adreno_is_7c3 (adreno_gpu)) -gmu_write (gmu,REG_A6XX_GMU_AO_AHB_FENCE_CTRL ,BIT (0 )); +if (adreno_is_a7xx (adreno_gpu) || (adreno_is_a621 (adreno_gpu) || +adreno_is_7c3 (adreno_gpu))) +gmu_write (gmu,REG_A6XX_GPU_GMU_CX_GMU_CX_FALNEXT_INTF ,BIT (0 )); }/* Let the GMU know that we are about to go into slumber */
@@ -508,10 +509,9 @@ static int a6xx_gmu_notify_slumber(struct a6xx_gmu *gmu) } out: -a6xx_gemnoc_workaround (gmu); -/* Put fence into allow mode */ gmu_write (gmu,REG_A6XX_GMU_AO_AHB_FENCE_CTRL ,0 ); +a6xx_gemnoc_workaround (gmu);return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 274/507 drm/msm/a6xx: Improve MX rail fallback in RPMH vote init
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akhil P Oommen <[email protected]>
[ Upstream commit ca04ce7a2f22652fdf6489fa7e02e7d2c08698f4 ]
Current logic assumes that the voltage corners in both MxG and MxA are always same. This is not true for recent targets. So, rework the rpmh init sequence to probe and calculate the votes with the respective rails, ie, GX rails should use MxG as secondary rail and Cx rail should use MxA as the secondary rail.
Patchwork: https://patchwork.freedesktop.org/patch/689014/
Message-ID: <[email protected]>
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +15 -11
@@ -1459,13 +1459,14 @@ static unsigned int a6xx_gmu_get_arc_level(struct device *dev, }static int a6xx_gmu_rpmh_arc_votes_init (struct device *dev,u32 *votes, -unsigned long *freqs,int freqs_count,const char *id) +unsigned long *freqs,int freqs_count, +const char *pri_id,const char *sec_id) {int i, j;const u16 *pri, *sec;size_t pri_count, sec_count; - pri =cmd_db_read_aux_data (id, &pri_count); + pri =cmd_db_read_aux_data (pri_id, &pri_count);if (IS_ERR (pri))return PTR_ERR (pri);/*
@@ -1476,13 +1477,7 @@ static int a6xx_gmu_rpmh_arc_votes_init(struct device *dev, u32 *votes,if (!pri_count)return -EINVAL ; -/* -* Some targets have a separate gfx mxc rail. So try to read that first and then fall back -* to regular mx rail if it is missing -*/ - sec =cmd_db_read_aux_data ("gmxc.lvl" , &sec_count); -if (IS_ERR (sec) && sec !=ERR_PTR (-EPROBE_DEFER )) - sec =cmd_db_read_aux_data ("mx.lvl" , &sec_count); + sec =cmd_db_read_aux_data (sec_id, &sec_count);if (IS_ERR (sec))return PTR_ERR (sec);
@@ -1550,15 +1545,24 @@ static int a6xx_gmu_rpmh_votes_init(struct a6xx_gmu *gmu)struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;const struct a6xx_info *info = adreno_gpu->info->a6xx;struct msm_gpu *gpu = &adreno_gpu->base; +const char *sec_id; +const u16 *gmxc;int ret; + gmxc =cmd_db_read_aux_data ("gmxc.lvl" ,NULL ); +if (gmxc ==ERR_PTR (-EPROBE_DEFER )) +return -EPROBE_DEFER ; + +/* If GMxC is present, prefer that as secondary rail for GX votes */ + sec_id =IS_ERR_OR_NULL (gmxc) ?"mx.lvl" :"gmxc.lvl" ; +/* Build the GX votes */ ret =a6xx_gmu_rpmh_arc_votes_init (&gpu->pdev->dev, gmu->gx_arc_votes, - gmu->gpu_freqs, gmu->nr_gpu_freqs,"gfx.lvl" ); + gmu->gpu_freqs, gmu->nr_gpu_freqs,"gfx.lvl" , sec_id);/* Build the CX votes */ ret |=a6xx_gmu_rpmh_arc_votes_init (gmu->dev, gmu->cx_arc_votes, - gmu->gmu_freqs, gmu->nr_gmu_freqs,"cx.lvl" ); + gmu->gmu_freqs, gmu->nr_gmu_freqs,"cx.lvl" ,"mx.lvl" );/* Build the interconnect votes */ if (info->bcms && gmu->nr_gpu_bws >1 )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 275/507 spi: sophgo: Fix incorrect use of bus width value macros
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Longbin Li <[email protected]>
[ Upstream commit d9813cd23d5a7b254cc1b1c1ea042634d8da62e6 ]
The previous code initialized the 'reg' value with specific bus-width values (BUS_WIDTH_2_BIT and BUS_WIDTH_4_BIT), which introduces ambiguity. Replace them with BUS_WIDTH_MASK to express the intention clearly.
--- drivers/spi/spi-sg2044-nor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-sg2044-nor.c +2 -2
@@ -42,6 +42,7 @@#define SPIFMC_TRAN_CSR_TRAN_MODE_RX BIT(0)#define SPIFMC_TRAN_CSR_TRAN_MODE_TX BIT(1)#define SPIFMC_TRAN_CSR_FAST_MODE BIT(3) +#define SPIFMC_TRAN_CSR_BUS_WIDTH_MASK GENMASK(5, 4)#define SPIFMC_TRAN_CSR_BUS_WIDTH_1_BIT (0x00 << 4)#define SPIFMC_TRAN_CSR_BUS_WIDTH_2_BIT (0x01 << 4)#define SPIFMC_TRAN_CSR_BUS_WIDTH_4_BIT (0x02 << 4)
@@ -122,8 +123,7 @@ static u32 sg2044_spifmc_init_reg(struct sg2044_spifmc *spifmc) reg =readl (spifmc->io_base +SPIFMC_TRAN_CSR ); reg &= ~(SPIFMC_TRAN_CSR_TRAN_MODE_MASK | SPIFMC_TRAN_CSR_FAST_MODE | - SPIFMC_TRAN_CSR_BUS_WIDTH_2_BIT | - SPIFMC_TRAN_CSR_BUS_WIDTH_4_BIT | + SPIFMC_TRAN_CSR_BUS_WIDTH_MASK | SPIFMC_TRAN_CSR_DMA_EN | SPIFMC_TRAN_CSR_ADDR_BYTES_MASK | SPIFMC_TRAN_CSR_WITH_CMD |
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 276/507 ipv6: clear RA flags when adding a static route
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <[email protected]>
[ Upstream commit f72514b3c5698e4b900b25345e09f9ed33123de6 ]
When an IPv6 Router Advertisement (RA) is received for a prefix, the kernel creates the corresponding on-link route with flags RTF_ADDRCONF and RTF_PREFIX_RT configured and RTF_EXPIRES if lifetime is set.
If later a user configures a static IPv6 address on the same prefix the kernel clears the RTF_EXPIRES flag but it doesn't clear the RTF_ADDRCONF and RTF_PREFIX_RT. When the next RA for that prefix is received, the kernel sees the route as RA-learned and wrongly configures back the lifetime. This is problematic because if the route expires, the static address won't have the corresponding on-link route.
This fix clears the RTF_ADDRCONF and RTF_PREFIX_RT flags preventing that the lifetime is configured when the next RA arrives. If the static address is deleted, the route becomes RA-learned again.
--- net/ipv6/ip6_fib.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv6/ip6_fib.c +4 -0
@@ -1138,6 +1138,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,fib6_set_expires (iter, rt->expires);fib6_add_gc_list (iter); } +if (!(rt->fib6_flags & (RTF_ADDRCONF |RTF_PREFIX_RT ))) { + iter->fib6_flags &= ~RTF_ADDRCONF ; + iter->fib6_flags &= ~RTF_PREFIX_RT ; + }if (rt->fib6_pmtu) fib6_metric_set(iter, RTAX_MTU,
Signature · 1 line
2.51.0