6.1.141-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 144/325 MIPS: Use arch specific syscall name match function
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bibo Mao <[email protected]>
[ Upstream commit 756276ce78d5624dc814f9d99f7d16c8fd51076e ]
On MIPS system, most of the syscall function name begin with prefix sys_. Some syscalls are special such as clone/fork, function name of these begin with __sys_. Since scratch registers need be saved in stack when these system calls happens.
With ftrace system call method, system call functions are declared with SYSCALL_DEFINEx, metadata of the system call symbol name begins with sys_. Here mips specific function arch_syscall_match_sym_name is used to compare function name between sys_call_table[] and metadata of syscall symbol.
--- arch/mips/include/asm/ftrace.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/mips/include/asm/ftrace.h +16 -0
@@ -87,4 +87,20 @@ struct dyn_arch_ftrace {#endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* __ASSEMBLY__ */ #endif /* CONFIG_FUNCTION_TRACER */ + +#ifdef CONFIG_FTRACE_SYSCALLS +#ifndef __ASSEMBLY__ +/* +* Some syscall entry functions on mips start with "__sys_" (fork and clone, +* for instance). We should also match the sys_ variant with those. +*/ +#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME +static inline bool arch_syscall_match_sym_name (const char *sym, +const char *name) +{ +return !strcmp (sym, name) || + (!strncmp (sym,"__sys_" ,6 ) && !strcmp (sym +6 , name +4 )); +} +#endif /* __ASSEMBLY__ */ +#endif /* CONFIG_FTRACE_SYSCALLS */ #endif /* _ASM_MIPS_FTRACE_H */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 145/325 genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 1f7df3a691740a7736bbc99dc4ed536120eb4746 ]
The IOMMU translation for MSI message addresses has been a 2-step process, separated in time:
1) iommu_dma_prepare_msi(): A cookie pointer containing the IOVA address is stored in the MSI descriptor when an MSI interrupt is allocated.
2) iommu_dma_compose_msi_msg(): this cookie pointer is used to compute a translated message address.
This has an inherent lifetime problem for the pointer stored in the cookie that must remain valid between the two steps. However, there is no locking at the irq layer that helps protect the lifetime. Today, this works under the assumption that the iommu domain is not changed while MSI interrupts being programmed. This is true for normal DMA API users within the kernel, as the iommu domain is attached before the driver is probed and cannot be changed while a driver is attached.
Classic VFIO type1 also prevented changing the iommu domain while VFIO was running as it does not support changing the "container" after starting up.
However, iommufd has improved this so that the iommu domain can be changed during VFIO operation. This potentially allows userspace to directly race VFIO_DEVICE_ATTACH_IOMMUFD_PT (which calls iommu_attach_group()) and VFIO_DEVICE_SET_IRQS (which calls into iommu_dma_compose_msi_msg()).
This potentially causes both the cookie pointer and the unlocked call to iommu_get_domain_for_dev() on the MSI translation path to become UAFs.
Fix the MSI cookie UAF by removing the cookie pointer. The translated IOVA address is already known during iommu_dma_prepare_msi() and cannot change. Thus, it can simply be stored as an integer in the MSI descriptor.
The other UAF related to iommu_get_domain_for_dev() will be addressed in patch "iommu: Make iommu_dma_prepare_msi() into a generic operation" by using the IOMMU group mutex.
--- drivers/iommu/dma-iommu.c | 28 +++++++++++++--------------- include/linux/msi.h | 33 ++++++++++++--------------------- 2 files changed, 25 insertions(+), 36 deletions(-)
drivers/iommu/dma-iommu.c +13 -15
@@ -1661,7 +1661,7 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr)static DEFINE_MUTEX (msi_prepare_lock);/* see below */ if (!domain || !domain->iova_cookie) { - desc->iommu_cookie =NULL ; +msi_desc_set_iommu_msi_iova (desc,0 ,0 );return 0 ; }
@@ -1673,11 +1673,12 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr)mutex_lock (&msi_prepare_lock); msi_page =iommu_dma_get_msi_page (dev, msi_addr, domain);mutex_unlock (&msi_prepare_lock); - -msi_desc_set_iommu_cookie (desc, msi_page); -if (!msi_page)return -ENOMEM ; + +msi_desc_set_iommu_msi_iova ( + desc, msi_page->iova, +ilog2 (cookie_msi_granule (domain->iova_cookie)));return 0 ; }
@@ -1688,18 +1689,15 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr)*/ void iommu_dma_compose_msi_msg (struct msi_desc *desc,struct msi_msg *msg) { -struct device *dev =msi_desc_to_dev (desc); -const struct iommu_domain *domain =iommu_get_domain_for_dev (dev); -const struct iommu_dma_msi_page *msi_page; +#ifdef CONFIG_IRQ_MSI_IOMMU +if (desc->iommu_msi_shift) { +u64 msi_iova = desc->iommu_msi_iova << desc->iommu_msi_shift; - msi_page =msi_desc_get_iommu_cookie (desc); - -if (!domain || !domain->iova_cookie ||WARN_ON (!msi_page)) -return ; - - msg->address_hi =upper_32_bits (msi_page->iova); - msg->address_lo &=cookie_msi_granule (domain->iova_cookie) -1 ; - msg->address_lo +=lower_32_bits (msi_page->iova); + msg->address_hi =upper_32_bits (msi_iova); + msg->address_lo =lower_32_bits (msi_iova) | + (msg->address_lo & ((1 << desc->iommu_msi_shift) -1 )); + } +#endif }static int iommu_dma_init (void )
include/linux/msi.h +12 -21
@@ -129,6 +129,10 @@ struct pci_msi_desc {* @dev: Pointer to the device which uses this descriptor * @msg: The last set MSI message cached for reuse * @affinity: Optional pointer to a cpu affinity mask for this descriptor +* @iommu_msi_iova: Optional shifted IOVA from the IOMMU to override the msi_addr. +* Only used if iommu_msi_shift != 0 +* @iommu_msi_shift: Indicates how many bits of the original address should be +* preserved when using iommu_msi_iova. * @sysfs_attr: Pointer to sysfs device attribute * * @write_msi_msg: Callback that may be called when the MSI message
@@ -146,7 +150,8 @@ struct msi_desc {struct msi_msg msg;struct irq_affinity_desc *affinity;#ifdef CONFIG_IRQ_MSI_IOMMU -const void *iommu_cookie; + u64 iommu_msi_iova : 58; + u64 iommu_msi_shift : 6;#endif #ifdef CONFIG_SYSFS struct device_attribute *sysfs_attrs;
@@ -214,28 +219,14 @@ struct msi_desc *msi_next_desc(struct device *dev, enum msi_desc_filter filter);#define msi_desc_to_dev (desc) ((desc)->dev) -#ifdef CONFIG_IRQ_MSI_IOMMU -static inline const void *msi_desc_get_iommu_cookie (struct msi_desc *desc) -{ -return desc->iommu_cookie; -} - -static inline void msi_desc_set_iommu_cookie (struct msi_desc *desc, -const void *iommu_cookie) -{ - desc->iommu_cookie = iommu_cookie; -} -#else -static inline const void *msi_desc_get_iommu_cookie (struct msi_desc *desc) +static inline void msi_desc_set_iommu_msi_iova (struct msi_desc *desc,u64 msi_iova, +unsigned int msi_shift) { -return NULL ; -} - -static inline void msi_desc_set_iommu_cookie (struct msi_desc *desc, -const void *iommu_cookie) -{ -} +#ifdef CONFIG_IRQ_MSI_IOMMU + desc->iommu_msi_iova = msi_iova >> msi_shift; + desc->iommu_msi_shift = msi_shift;#endif +}#ifdef CONFIG_PCI_MSI struct pci_dev *msi_desc_to_pci_dev (struct msi_desc *desc);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 146/325 MIPS: pm-cps: Use per-CPU variables as per-CPU, not per-core
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Burton <[email protected]>
[ Upstream commit 00a134fc2bb4a5f8fada58cf7ff4259149691d64 ]
The pm-cps code has up until now used per-CPU variables indexed by core, rather than CPU number, in order to share data amongst sibling CPUs (ie. VPs/threads in a core). This works fine for single cluster systems, but with multi-cluster systems a core number is no longer unique in the system, leading to sharing between CPUs that are not actually siblings.
Avoid this issue by using per-CPU variables as they are more generally used - ie. access them using CPU numbers rather than core numbers. Sharing between siblings is then accomplished by:
- Assigning the same pointer to entries for each sibling CPU for the nc_asm_enter & ready_count variables, which allow this by virtue of being per-CPU pointers.
- Indexing by the first CPU set in a CPUs cpu_sibling_map in the case of pm_barrier, for which we can't use the previous approach because the per-CPU variable is not a pointer.
--- arch/mips/kernel/pm-cps.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
arch/mips/kernel/pm-cps.c +17 -13
@@ -56,10 +56,7 @@ static DEFINE_PER_CPU_ALIGNED(u32*, ready_count);/* Indicates online CPUs coupled with the current CPU */ static DEFINE_PER_CPU_ALIGNED(cpumask_t, online_coupled); -/* -* Used to synchronize entry to deep idle states. Actually per-core rather -* than per-CPU. -*/ +/* Used to synchronize entry to deep idle states */ static DEFINE_PER_CPU_ALIGNED(atomic_t, pm_barrier);/* Saved CPU state across the CPS_PM_POWER_GATED state */
@@ -118,9 +115,10 @@ int cps_pm_enter_state(enum cps_pm_state state)cps_nc_entry_fn entry;struct core_boot_config *core_cfg;struct vpe_boot_config *vpe_cfg; +atomic_t *barrier;/* Check that there is an entry function for this state */ - entry =per_cpu (nc_asm_enter, core)[state]; + entry =per_cpu (nc_asm_enter, cpu)[state];if (!entry)return -EINVAL ;
@@ -156,7 +154,7 @@ int cps_pm_enter_state(enum cps_pm_state state)smp_mb__after_atomic ();/* Create a non-coherent mapping of the core ready_count */ - core_ready_count =per_cpu (ready_count, core); + core_ready_count =per_cpu (ready_count, cpu); nc_addr =kmap_noncoherent (virt_to_page (core_ready_count), (unsigned long )core_ready_count); nc_addr += ((unsigned long )core_ready_count & ~PAGE_MASK );
@@ -164,7 +162,8 @@ int cps_pm_enter_state(enum cps_pm_state state)/* Ensure ready_count is zero-initialised before the assembly runs */ WRITE_ONCE (*nc_core_ready_count,0 ); -coupled_barrier (&per_cpu (pm_barrier, core), online); + barrier = &per_cpu (pm_barrier,cpumask_first (&cpu_sibling_map[cpu])); +coupled_barrier (barrier, online);/* Run the generated entry code */ left =entry (online, nc_core_ready_count);
@@ -635,12 +634,14 @@ static void *cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)static int cps_pm_online_cpu (unsigned int cpu) { -enum cps_pm_state state; -unsigned core =cpu_core (&cpu_data[cpu]); +unsigned int sibling, core;void *entry_fn, *core_rc; +enum cps_pm_state state; + + core =cpu_core (&cpu_data[cpu]);for (state =CPS_PM_NC_WAIT ; state <CPS_PM_STATE_COUNT ; state++) { -if (per_cpu (nc_asm_enter, core)[state]) +if (per_cpu (nc_asm_enter, cpu)[state])continue ;if (!test_bit (state, state_support))continue ;
@@ -652,16 +653,19 @@ static int cps_pm_online_cpu(unsigned int cpu)clear_bit (state, state_support); } -per_cpu (nc_asm_enter, core)[state] = entry_fn; +for_each_cpu (sibling, &cpu_sibling_map[cpu]) +per_cpu (nc_asm_enter, sibling)[state] = entry_fn; } -if (!per_cpu (ready_count, core)) { +if (!per_cpu (ready_count, cpu)) { core_rc =kmalloc (sizeof (u32),GFP_KERNEL );if (!core_rc) {pr_err ("Failed allocate core %u ready_count\n" , core);return -ENOMEM ; } -per_cpu (ready_count, core) = core_rc; + +for_each_cpu (sibling, &cpu_sibling_map[cpu]) +per_cpu (ready_count, sibling) = core_rc; }return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 147/325 clocksource: mips-gic-timer: Enable counter when CPUs start
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Burton <[email protected]>
[ Upstream commit 3128b0a2e0cf6e07aa78e5f8cf7dd9cd59dc8174 ]
In multi-cluster MIPS I6500 systems there is a GIC in each cluster, each with its own counter. When a cluster powers up the counter will be stopped, with the COUNTSTOP bit set in the GIC_CONFIG register.
In single cluster systems, it has been fine to clear COUNTSTOP once in gic_clocksource_of_init() to start the counter. In multi-cluster systems, this will only have started the counter in the boot cluster, and any CPUs in other clusters will find their counter stopped which will break the GIC clock_event_device.
Resolve this by having CPUs clear the COUNTSTOP bit when they come online, using the existing gic_starting_cpu() CPU hotplug callback. This will allow CPUs in secondary clusters to ensure that the cluster's GIC counter is running as expected.
--- drivers/clocksource/mips-gic-timer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clocksource/mips-gic-timer.c +3 -3
@@ -114,6 +114,9 @@ static void gic_update_frequency(void *data)static int gic_starting_cpu (unsigned int cpu) { +/* Ensure the GIC counter is running */ +clear_gic_config (GIC_CONFIG_COUNTSTOP ); +gic_clockevent_cpu_init (cpu,this_cpu_ptr (&gic_clockevent_device));return 0 ; }
@@ -248,9 +251,6 @@ static int __init gic_clocksource_of_init(struct device_node *node)pr_warn ("Unable to register clock notifier\n" ); } -/* And finally start the counter */ -clear_gic_config (GIC_CONFIG_COUNTSTOP ); -/* * It's safe to use the MIPS GIC timer as a sched clock source only if * its ticks are stable, which is true on either the platforms with
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 148/325 scsi: mpt3sas: Send a diag reset if target reset fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shivasharan S <[email protected]>
[ Upstream commit 5612d6d51ed2634a033c95de2edec7449409cbb9 ]
When an IOCTL times out and driver issues a target reset, if firmware fails the task management elevate the recovery by issuing a diag reset to controller.
--- drivers/scsi/mpt3sas/mpt3sas_ctl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_ctl.c +10 -2
@@ -679,6 +679,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,size_t data_in_sz =0 ;long ret;u16 device_handle =MPT3SAS_INVALID_DEVICE_HANDLE ; +int tm_ret; issue_reset =0 ;
@@ -1120,18 +1121,25 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,if (pcie_device && (!ioc->tm_custom_handling) && (!(mpt3sas_scsih_is_pcie_scsi_device ( pcie_device->device_info)))) -mpt3sas_scsih_issue_locked_tm (ioc, + tm_ret =mpt3sas_scsih_issue_locked_tm (ioc,le16_to_cpu (mpi_request->FunctionDependent1),0 ,0 ,0 ,MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET ,0 ,0 , pcie_device->reset_timeout,MPI26_SCSITASKMGMT_MSGFLAGS_PROTOCOL_LVL_RST_PCIE );else -mpt3sas_scsih_issue_locked_tm (ioc, + tm_ret =mpt3sas_scsih_issue_locked_tm (ioc,le16_to_cpu (mpi_request->FunctionDependent1),0 ,0 ,0 ,MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET ,0 ,0 ,30 ,MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET ); + +if (tm_ret !=SUCCESS ) { +ioc_info (ioc, +"target reset failed, issue hard reset: handle (0x%04x)\n" , +le16_to_cpu (mpi_request->FunctionDependent1)); +mpt3sas_base_hard_reset_handler (ioc,FORCE_BIG_HAMMER ); + } }else mpt3sas_base_hard_reset_handler (ioc,FORCE_BIG_HAMMER ); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 149/325 wifi: rtw88: Fix rtw_init_vht_cap() for RTL8814AU
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <[email protected]>
[ Upstream commit 6be7544d19fcfcb729495e793bc6181f85bb8949 ]
Set the MCS maps and the highest rates according to the number of spatial streams the chip has. For RTL8814AU that is 3.
--- drivers/net/wireless/realtek/rtw88/main.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +9 -14
@@ -1552,8 +1552,9 @@ static void rtw_init_vht_cap(struct rtw_dev *rtwdev, struct ieee80211_sta_vht_cap *vht_cap) {struct rtw_efuse *efuse = &rtwdev->efuse; -u16 mcs_map; +u16 mcs_map =0 ;__le16 highest; +int i;if (efuse->hw_cap.ptcl !=EFUSE_HW_CAP_IGNORE && efuse->hw_cap.ptcl !=EFUSE_HW_CAP_PTCL_VHT )
@@ -1576,21 +1577,15 @@ static void rtw_init_vht_cap(struct rtw_dev *rtwdev,if (rtw_chip_has_rx_ldpc (rtwdev)) vht_cap->cap |=IEEE80211_VHT_CAP_RXLDPC ; - mcs_map =IEEE80211_VHT_MCS_SUPPORT_0_9 <<0 | -IEEE80211_VHT_MCS_NOT_SUPPORTED <<4 | -IEEE80211_VHT_MCS_NOT_SUPPORTED <<6 | -IEEE80211_VHT_MCS_NOT_SUPPORTED <<8 | -IEEE80211_VHT_MCS_NOT_SUPPORTED <<10 | -IEEE80211_VHT_MCS_NOT_SUPPORTED <<12 | -IEEE80211_VHT_MCS_NOT_SUPPORTED <<14 ; -if (efuse->hw_cap.nss >1 ) { - highest =cpu_to_le16 (780 ); - mcs_map |=IEEE80211_VHT_MCS_SUPPORT_0_9 <<2 ; - }else { - highest =cpu_to_le16 (390 ); - mcs_map |=IEEE80211_VHT_MCS_NOT_SUPPORTED <<2 ; +for (i =0 ; i <8 ; i++) { +if (i < efuse->hw_cap.nss) + mcs_map |=IEEE80211_VHT_MCS_SUPPORT_0_9 << (i *2 ); +else + mcs_map |=IEEE80211_VHT_MCS_NOT_SUPPORTED << (i *2 ); } + highest =cpu_to_le16 (390 * efuse->hw_cap.nss); + vht_cap->vht_mcs.rx_mcs_map =cpu_to_le16 (mcs_map); vht_cap->vht_mcs.tx_mcs_map =cpu_to_le16 (mcs_map); vht_cap->vht_mcs.rx_highest = highest;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 150/325 wifi: rtw88: Fix rtw_init_ht_cap() for RTL8814AU
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <[email protected]>
[ Upstream commit c7eea1ba05ca5b0dbf77a27cf2e1e6e2fb3c0043 ]
Set the RX mask and the highest RX rate according to the number of spatial streams the chip can receive. For RTL8814AU that is 3.
--- drivers/net/wireless/realtek/rtw88/main.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +6 -11
@@ -1516,6 +1516,7 @@ static void rtw_init_ht_cap(struct rtw_dev *rtwdev, {const struct rtw_chip_info *chip = rtwdev->chip;struct rtw_efuse *efuse = &rtwdev->efuse; +int i; ht_cap->ht_supported = true; ht_cap->cap =0 ;
@@ -1535,17 +1536,11 @@ static void rtw_init_ht_cap(struct rtw_dev *rtwdev, ht_cap->ampdu_factor =IEEE80211_HT_MAX_AMPDU_64K ; ht_cap->ampdu_density = chip->ampdu_density; ht_cap->mcs.tx_params =IEEE80211_HT_MCS_TX_DEFINED ; -if (efuse->hw_cap.nss >1 ) { - ht_cap->mcs.rx_mask[0 ] =0xFF ; - ht_cap->mcs.rx_mask[1 ] =0xFF ; - ht_cap->mcs.rx_mask[4 ] =0x01 ; - ht_cap->mcs.rx_highest =cpu_to_le16 (300 ); - }else { - ht_cap->mcs.rx_mask[0 ] =0xFF ; - ht_cap->mcs.rx_mask[1 ] =0x00 ; - ht_cap->mcs.rx_mask[4 ] =0x01 ; - ht_cap->mcs.rx_highest =cpu_to_le16 (150 ); - } + +for (i =0 ; i < efuse->hw_cap.nss; i++) + ht_cap->mcs.rx_mask[i] =0xFF ; + ht_cap->mcs.rx_mask[4 ] =0x01 ; + ht_cap->mcs.rx_highest =cpu_to_le16 (150 * efuse->hw_cap.nss); } static void rtw_init_vht_cap(struct rtw_dev *rtwdev,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 151/325 wifi: rtw88: Fix rtw_desc_to_mcsrate() to handle MCS16-31
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <[email protected]>
[ Upstream commit 86d04f8f991a0509e318fe886d5a1cf795736c7d ]
This function translates the rate number reported by the hardware into something mac80211 can understand. It was ignoring the 3SS and 4SS HT rates. Translate them too.
Also set *nss to 0 for the HT rates, just to make sure it's initialised.
--- drivers/net/wireless/realtek/rtw88/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/util.c +2 -1
@@ -101,7 +101,8 @@ void rtw_desc_to_mcsrate(u16 rate, u8 *mcs, u8 *nss) *nss =4 ; *mcs = rate -DESC_RATEVHT4SS_MCS0 ; }else if (rate >=DESC_RATEMCS0 && - rate <=DESC_RATEMCS15 ) { + rate <=DESC_RATEMCS31 ) { + *nss =0 ; *mcs = rate -DESC_RATEMCS0 ; } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 152/325 wifi: rtw89: fw: propagate error code from rtw89_h2c_tx()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ping-Ke Shih <[email protected]>
[ Upstream commit 56e1acaa0f80620b8e2c3410db35b4b975782b0a ]
The error code should be propagated to callers during downloading firmware header and body. Remove unnecessary assignment of -1.
--- drivers/net/wireless/realtek/rtw89/fw.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/wireless/realtek/rtw89/fw.c +0 -2
@@ -373,7 +373,6 @@ static int __rtw89_fw_download_hdr(struct rtw89_dev *rtwdev, const u8 *fw, u32 l ret =rtw89_h2c_tx (rtwdev, skb, false);if (ret) {rtw89_err (rtwdev,"failed to send h2c\n" ); - ret =-1 ; goto fail; }
@@ -434,7 +433,6 @@ static int __rtw89_fw_download_main(struct rtw89_dev *rtwdev, ret =rtw89_h2c_tx (rtwdev, skb, true);if (ret) {rtw89_err (rtwdev,"failed to send h2c\n" ); - ret =-1 ; goto fail; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 153/325 net: pktgen: fix access outside of user given buffer in pktgen_thread_write()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Seiderer <[email protected]>
[ Upstream commit 425e64440ad0a2f03bdaf04be0ae53dededbaa77 ]
Honour the user given buffer size for the strn_len() calls (otherwise strn_len() will access memory outside of the user given buffer).
--- net/core/pktgen.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/core/pktgen.c +4 -3
@@ -1877,8 +1877,8 @@ static ssize_t pktgen_thread_write(struct file *file, i = len;/* Read variable name */ - - len =strn_len (&user_buffer[i],sizeof (name) -1 ); + max =min (sizeof (name) -1 , count - i); + len =strn_len (&user_buffer[i], max);if (len <0 )return len;
@@ -1908,7 +1908,8 @@ static ssize_t pktgen_thread_write(struct file *file,if (!strcmp (name,"add_device" )) {char f[32 ];memset (f,0 ,32 ); - len =strn_len (&user_buffer[i],sizeof (f) -1 ); + max =min (sizeof (f) -1 , count - i); + len =strn_len (&user_buffer[i], max);if (len <0 ) { ret = len; goto out;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 154/325 EDAC/ie31200: work around false positive build warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit c29dfd661fe2f8d1b48c7f00590929c04b25bf40 ]
gcc-14 produces a bogus warning in some configurations:
drivers/edac/ie31200_edac.c: In function 'ie31200_probe1.isra':drivers/edac/ie31200_edac.c:412:26: error: 'dimm_info' is used uninitialized [-Werror=uninitialized]
412 | struct dimm_data dimm_info[IE31200_CHANNELS][IE31200_DIMMS_PER_CHANNEL];
| ^~~~~~~~~
drivers/edac/ie31200_edac.c:412:26: note: 'dimm_info' declared here
412 | struct dimm_data dimm_info[IE31200_CHANNELS][IE31200_DIMMS_PER_CHANNEL];
| ^~~~~~~~~I don't see any way the unintialized access could really happen here, but I can see why the compiler gets confused by the two loops.
Instead, rework the two nested loops to only read the addr_decode registers and then keep only one instance of the dimm info structure.
[Tony: Qiuxu pointed out that the "populate DIMM info" comment was left behind in the refactor and suggested moving it. I deleted the comment as unnecessry in front os a call to populate_dimm_info(). That seems pretty self-describing.]
--- drivers/edac/ie31200_edac.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/edac/ie31200_edac.c +13 -15
@@ -405,10 +405,9 @@ static int ie31200_probe1(struct pci_dev *pdev, int dev_idx)int i, j, ret;struct mem_ctl_info *mci =NULL ;struct edac_mc_layer layers[2 ]; -struct dimm_data dimm_info[IE31200_CHANNELS ][IE31200_DIMMS_PER_CHANNEL ];void __iomem *window;struct ie31200_priv *priv; -u32 addr_decode, mad_offset; +u32 addr_decode[IE31200_CHANNELS ], mad_offset;/* * Kaby Lake, Coffee Lake seem to work like Skylake. Please re-visit
@@ -466,19 +465,10 @@ static int ie31200_probe1(struct pci_dev *pdev, int dev_idx) mad_offset =IE31200_MAD_DIMM_0_OFFSET ; } -/* populate DIMM info */ for (i =0 ; i <IE31200_CHANNELS ; i++) { - addr_decode =readl (window + mad_offset + + addr_decode[i] =readl (window + mad_offset + (i *4 )); -edac_dbg (0 ,"addr_decode: 0x%x\n" , addr_decode); -for (j =0 ; j <IE31200_DIMMS_PER_CHANNEL ; j++) { -populate_dimm_info (&dimm_info[i][j], addr_decode, j, - skl); -edac_dbg (0 ,"size: 0x%x, rank: %d, width: %d\n" , - dimm_info[i][j].size, - dimm_info[i][j].dual_rank, - dimm_info[i][j].x16_width); - } +edac_dbg (0 ,"addr_decode: 0x%x\n" , addr_decode[i]); }/*
@@ -489,14 +479,22 @@ static int ie31200_probe1(struct pci_dev *pdev, int dev_idx)*/ for (i =0 ; i <IE31200_DIMMS_PER_CHANNEL ; i++) {for (j =0 ; j <IE31200_CHANNELS ; j++) { +struct dimm_data dimm_info;struct dimm_info *dimm;unsigned long nr_pages; - nr_pages =IE31200_PAGES (dimm_info[j][i].size, skl); +populate_dimm_info (&dimm_info, addr_decode[j], i, + skl); +edac_dbg (0 ,"size: 0x%x, rank: %d, width: %d\n" , + dimm_info.size, + dimm_info.dual_rank, + dimm_info.x16_width); + + nr_pages =IE31200_PAGES (dimm_info.size, skl);if (nr_pages ==0 )continue ; -if (dimm_info[j][i].dual_rank) { +if (dimm_info.dual_rank) { nr_pages = nr_pages /2 ; dimm =edac_get_dimm (mci, (i *2 ) +1 , j,0 ); dimm->nr_pages = nr_pages;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 155/325 i3c: master: svc: Flush FIFO before sending Dynamic Address Assignment(DAA)
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit a892ee4cf22a50e1d6988d0464a9a421f3e5db2f ]
Ensure the FIFO is empty before issuing the DAA command to prevent incorrect command data from being sent. Align with other data transfers, such as svc_i3c_master_start_xfer_locked(), which flushes the FIFO before sending a command.
--- drivers/i3c/master/svc-i3c-master.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/i3c/master/svc-i3c-master.c +2 -0
@@ -833,6 +833,8 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_master *master,u32 reg;int ret, i; +svc_i3c_master_flush_fifo (master); +while (true) {/* Enter/proceed with DAA */ writel(SVC_I3C_MCTRL_REQUEST_PROC_DAA |
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 156/325 serial: mctrl_gpio: split disable_ms into sync and no_sync APIs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Lothoré <[email protected]>
[ Upstream commit 1bd2aad57da95f7f2d2bb52f7ad15c0f4993a685 ]
The following splat has been observed on a SAMA5D27 platform using atmel_serial:
BUG: sleeping function called from invalid context at kernel/irq/manage.c:738 in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 27, name: kworker/u5:0 preempt_count: 1, expected: 0 INFO: lockdep is turned off. irq event stamp: 0 hardirqs last enabled at (0): [<00000000>] 0x0 hardirqs last disabled at (0): [<c01588f0>] copy_process+0x1c4c/0x7bec softirqs last enabled at (0): [<c0158944>] copy_process+0x1ca0/0x7bec softirqs last disabled at (0): [<00000000>] 0x0 CPU: 0 UID: 0 PID: 27 Comm: kworker/u5:0 Not tainted 6.13.0-rc7+ #74 Hardware name: Atmel SAMA5 Workqueue: hci0 hci_power_on [bluetooth] Call trace: unwind_backtrace from show_stack+0x18/0x1c show_stack from dump_stack_lvl+0x44/0x70 dump_stack_lvl from __might_resched+0x38c/0x598 __might_resched from disable_irq+0x1c/0x48 disable_irq from mctrl_gpio_disable_ms+0x74/0xc0 mctrl_gpio_disable_ms from atmel_disable_ms.part.0+0x80/0x1f4 atmel_disable_ms.part.0 from atmel_set_termios+0x764/0x11e8 atmel_set_termios from uart_change_line_settings+0x15c/0x994 uart_change_line_settings from uart_set_termios+0x2b0/0x668 uart_set_termios from tty_set_termios+0x600/0x8ec tty_set_termios from ttyport_set_flow_control+0x188/0x1e0 ttyport_set_flow_control from wilc_setup+0xd0/0x524 [hci_wilc] wilc_setup [hci_wilc] from hci_dev_open_sync+0x330/0x203c [bluetooth] hci_dev_open_sync [bluetooth] from hci_dev_do_open+0x40/0xb0 [bluetooth] hci_dev_do_open [bluetooth] from hci_power_on+0x12c/0x664 [bluetooth] hci_power_on [bluetooth] from process_one_work+0x998/0x1a38 process_one_work from worker_thread+0x6e0/0xfb4 worker_thread from kthread+0x3d4/0x484 kthread from ret_from_fork+0x14/0x28
This warning is emitted when trying to toggle, at the highest level, some flow control (with serdev_device_set_flow_control) in a device driver. At the lowest level, the atmel_serial driver is using serial_mctrl_gpio lib to enable/disable the corresponding IRQs accordingly. The warning emitted by CONFIG_DEBUG_ATOMIC_SLEEP is due to disable_irq (called in mctrl_gpio_disable_ms) being possibly called in some atomic context (some tty drivers perform modem lines configuration in regions protected by port lock).
Split mctrl_gpio_disable_ms into two differents APIs, a non-blocking one and a blocking one. Replace mctrl_gpio_disable_ms calls with the relevant version depending on whether the call is protected by some port lock.
--- Documentation/driver-api/serial/driver.rst | 2 +- drivers/tty/serial/8250/8250_port.c | 2 +- drivers/tty/serial/atmel_serial.c | 2 +- drivers/tty/serial/imx.c | 2 +- drivers/tty/serial/serial_mctrl_gpio.c | 34 +++++++++++++++++----- drivers/tty/serial/serial_mctrl_gpio.h | 17 +++++++++-- drivers/tty/serial/sh-sci.c | 2 +- drivers/tty/serial/stm32-usart.c | 2 +- 8 files changed, 47 insertions(+), 16 deletions(-)
Documentation/driver-api/serial/driver.rst +1 -1
@@ -100,4 +100,4 @@ Some helpers are provided in order to set/get modem control lines via GPIO. .. kernel-doc:: drivers/tty/serial/serial_mctrl_gpio.c :identifiers: mctrl_gpio_init mctrl_gpio_free mctrl_gpio_to_gpiod mctrl_gpio_set mctrl_gpio_get mctrl_gpio_enable_ms - mctrl_gpio_disable_ms + mctrl_gpio_disable_ms_sync mctrl_gpio_disable_ms_no_sync
drivers/tty/serial/8250/8250_port.c +1 -1
@@ -1694,7 +1694,7 @@ static void serial8250_disable_ms(struct uart_port *port)if (up->bugs &UART_BUG_NOMSR )return ; -mctrl_gpio_disable_ms (up->gpios); +mctrl_gpio_disable_ms_no_sync (up->gpios); up->ier &= ~UART_IER_MSI ;serial_port_out (port,UART_IER , up->ier);
drivers/tty/serial/atmel_serial.c +1 -1
@@ -692,7 +692,7 @@ static void atmel_disable_ms(struct uart_port *port) atmel_port->ms_irq_enabled = false; -mctrl_gpio_disable_ms (atmel_port->gpios); +mctrl_gpio_disable_ms_no_sync (atmel_port->gpios);if (!mctrl_gpio_to_gpiod (atmel_port->gpios,UART_GPIO_CTS )) idr |=ATMEL_US_CTSIC ;
drivers/tty/serial/imx.c +1 -1
@@ -1586,7 +1586,7 @@ static void imx_uart_shutdown(struct uart_port *port)imx_uart_dma_exit (sport); } -mctrl_gpio_disable_ms (sport->gpios); +mctrl_gpio_disable_ms_sync (sport->gpios);spin_lock_irqsave (&sport->port.lock, flags); ucr2 =imx_uart_readl (sport,UCR2 );
drivers/tty/serial/serial_mctrl_gpio.c +27 -7
@@ -322,11 +322,7 @@ void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios) }EXPORT_SYMBOL_GPL (mctrl_gpio_enable_ms); -/** -* mctrl_gpio_disable_ms - disable irqs and handling of changes to the ms lines -* @gpios: gpios to disable -*/ -void mctrl_gpio_disable_ms (struct mctrl_gpios *gpios) +static void mctrl_gpio_disable_ms (struct mctrl_gpios *gpios,bool sync) {enum mctrl_gpio_idx i;
@@ -342,10 +338,34 @@ void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios)if (!gpios->irq[i])continue ; -disable_irq (gpios->irq[i]); +if (sync) +disable_irq (gpios->irq[i]); +else +disable_irq_nosync (gpios->irq[i]); } } -EXPORT_SYMBOL_GPL (mctrl_gpio_disable_ms); + +/** +* mctrl_gpio_disable_ms_sync - disable irqs and handling of changes to the ms +* lines, and wait for any pending IRQ to be processed +* @gpios: gpios to disable +*/ +void mctrl_gpio_disable_ms_sync (struct mctrl_gpios *gpios) +{ +mctrl_gpio_disable_ms (gpios, true); +} +EXPORT_SYMBOL_GPL (mctrl_gpio_disable_ms_sync); + +/** +* mctrl_gpio_disable_ms_no_sync - disable irqs and handling of changes to the +* ms lines, and return immediately +* @gpios: gpios to disable +*/ +void mctrl_gpio_disable_ms_no_sync (struct mctrl_gpios *gpios) +{ +mctrl_gpio_disable_ms (gpios, false); +} +EXPORT_SYMBOL_GPL (mctrl_gpio_disable_ms_no_sync);void mctrl_gpio_enable_irq_wake (struct mctrl_gpios *gpios) {
drivers/tty/serial/serial_mctrl_gpio.h +14 -3
@@ -87,9 +87,16 @@ void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios);void mctrl_gpio_enable_ms (struct mctrl_gpios *gpios);/* -* Disable gpio interrupts to report status line changes. +* Disable gpio interrupts to report status line changes, and block until +* any corresponding IRQ is processed */ -void mctrl_gpio_disable_ms (struct mctrl_gpios *gpios); +void mctrl_gpio_disable_ms_sync (struct mctrl_gpios *gpios); + +/* +* Disable gpio interrupts to report status line changes, and return +* immediately +*/ +void mctrl_gpio_disable_ms_no_sync (struct mctrl_gpios *gpios);/* * Enable gpio wakeup interrupts to enable wake up source.
@@ -148,7 +155,11 @@ static inline void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios) { } -static inline void mctrl_gpio_disable_ms (struct mctrl_gpios *gpios) +static inline void mctrl_gpio_disable_ms_sync (struct mctrl_gpios *gpios) +{ +} + +static inline void mctrl_gpio_disable_ms_no_sync (struct mctrl_gpios *gpios) { }
drivers/tty/serial/sh-sci.c +1 -1
@@ -2182,7 +2182,7 @@ static void sci_shutdown(struct uart_port *port)dev_dbg (port->dev,"%s(%d)\n" , __func__, port->line); s->autorts = false; -mctrl_gpio_disable_ms (to_sci_port (port)->gpios); +mctrl_gpio_disable_ms_sync (to_sci_port (port)->gpios);spin_lock_irqsave (&port->lock, flags);sci_stop_rx (port);
drivers/tty/serial/stm32-usart.c +1 -1
@@ -850,7 +850,7 @@ static void stm32_usart_enable_ms(struct uart_port *port)static void stm32_usart_disable_ms (struct uart_port *port) { -mctrl_gpio_disable_ms (to_stm32_port (port)->gpios); +mctrl_gpio_disable_ms_sync (to_stm32_port (port)->gpios); }/* Transmit stop */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 157/325 RDMA/core: Fix best page size finding when it can cross SG entries
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Margolin <[email protected]>
[ Upstream commit 486055f5e09df959ad4e3aa4ee75b5c91ddeec2e ]
A single scatter-gather entry is limited by a 32 bits "length" field that is practically 4GB - PAGE_SIZE. This means that even when the memory is physically contiguous, we might need more than one entry to represent it. Additionally when using dmabuf, the sg_table might be originated outside the subsystem and optimized for other needs.
For instance an SGT of 16GB GPU continuous memory might look like this:
(a real life example)
dma_address 34401400000, length fffff000dma_address 345013ff000, length fffff000dma_address 346013fe000, length fffff000dma_address 347013fd000, length fffff000dma_address 348013fc000, length 4000
Since ib_umem_find_best_pgsz works within SG entries, in the above case we will result with the worst possible 4KB page size.
Fix this by taking into consideration only the alignment of addresses of real discontinuity points rather than treating SG entries as such, and adjust the page iterator to correctly handle cross SG entry pages.
There is currently an assumption that drivers do not ask for pages bigger than maximal DMA size supported by their devices.
--- drivers/infiniband/core/umem.c | 36 ++++++++++++++++++++++++--------- drivers/infiniband/core/verbs.c | 11 +++++----- 2 files changed, 32 insertions(+), 15 deletions(-)
drivers/infiniband/core/umem.c +26 -10
@@ -80,9 +80,12 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem, unsigned long pgsz_bitmap, unsigned long virt) { -struct scatterlist *sg; +unsigned long curr_len =0 ; +dma_addr_t curr_base = ~0 ;unsigned long va, pgoff; +struct scatterlist *sg;dma_addr_t mask; +dma_addr_t end;int i; umem->iova = va = virt;
@@ -107,17 +110,30 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem, pgoff = umem->address & ~PAGE_MASK ;for_each_sgtable_dma_sg (&umem->sgt_append.sgt, sg, i) { -/* Walk SGL and reduce max page size if VA/PA bits differ -* for any address. +/* If the current entry is physically contiguous with the previous +* one, no need to take its start addresses into consideration. */ - mask |= (sg_dma_address (sg) + pgoff) ^ va; +if (check_add_overflow (curr_base, curr_len, &end) || + end !=sg_dma_address (sg)) { + + curr_base =sg_dma_address (sg); + curr_len =0 ; + +/* Reduce max page size if VA/PA bits differ */ + mask |= (curr_base + pgoff) ^ va; + +/* The alignment of any VA matching a discontinuity point +* in the physical memory sets the maximum possible page +* size as this must be a starting point of a new page that +* needs to be aligned. +*/ +if (i !=0 ) + mask |= va; + } + + curr_len +=sg_dma_len (sg); va +=sg_dma_len (sg) - pgoff; -/* Except for the last entry, the ending iova alignment sets -* the maximum possible page size as the low bits of the iova -* must be zero when starting the next chunk. -*/ -if (i != (umem->sgt_append.sgt.nents -1 )) - mask |= va; + pgoff =0 ; }
drivers/infiniband/core/verbs.c +6 -5
@@ -2959,22 +2959,23 @@ EXPORT_SYMBOL(__rdma_block_iter_start);bool __rdma_block_iter_next (struct ib_block_iter *biter) {unsigned int block_offset; -unsigned int sg_delta; +unsigned int delta;if (!biter->__sg_nents || !biter->__sg)return false; biter->__dma_addr =sg_dma_address (biter->__sg) + biter->__sg_advance; block_offset = biter->__dma_addr & (BIT_ULL (biter->__pg_bit) -1 ); - sg_delta =BIT_ULL (biter->__pg_bit) - block_offset; + delta =BIT_ULL (biter->__pg_bit) - block_offset; -if (sg_dma_len (biter->__sg) - biter->__sg_advance > sg_delta) { - biter->__sg_advance += sg_delta; - }else { +while (biter->__sg_nents && biter->__sg && +sg_dma_len (biter->__sg) - biter->__sg_advance <= delta) { + delta -=sg_dma_len (biter->__sg) - biter->__sg_advance; biter->__sg_advance =0 ; biter->__sg =sg_next (biter->__sg); biter->__sg_nents--; } + biter->__sg_advance += delta;return true; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 158/325 pmdomain: imx: gpcv2: use proper helper for property detection
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahmad Fatoum <[email protected]>
[ Upstream commit 6568cb40e73163fa25e2779f7234b169b2e1a32e ]
Starting with commit c141ecc3cecd7 ("of: Warn when of_property_read_bool() is used on non-boolean properties"), probing the gpcv2 device on i.MX8M SoCs leads to warnings when LOCKDEP is enabled.
Fix this by checking property presence with of_property_present as intended.
--- drivers/soc/imx/gpcv2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/imx/gpcv2.c +1 -1
@@ -1347,7 +1347,7 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) }if (IS_ENABLED (CONFIG_LOCKDEP ) && -of_property_read_bool (domain->dev->of_node,"power-domains" )) +of_property_present (domain->dev->of_node,"power-domains" ))lockdep_set_subclass (&domain->genpd.mlock,1 ); ret = of_genpd_add_provider_simple(domain->dev->of_node,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 159/325 can: c_can: Use of_property_present() to test existence of DT property
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit ab1bc2290fd8311d49b87c29f1eb123fcb581bee ]
of_property_read_bool() should be used only on boolean properties.
--- drivers/net/can/c_can/c_can_platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/c_can/c_can_platform.c +1 -1
@@ -334,7 +334,7 @@ static int c_can_plat_probe(struct platform_device *pdev)/* Check if we need custom RAMINIT via syscon. Mostly for TI * platforms. Only supported with DT boot. */ -if (np &&of_property_read_bool (np,"syscon-raminit" )) { +if (np &&of_property_present (np,"syscon-raminit" )) {u32 id;struct c_can_raminit *raminit = &priv->raminit_sys;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 160/325 eth: mlx4: dont try to complete XDP frames in netpoll
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 8fdeafd66edaf420ea0063a1f13442fe3470fe70 ]
mlx4 doesn't support ndo_xdp_xmit / XDP_REDIRECT and wasn't using page pool until now, so it could run XDP completions in netpoll (NAPI budget == 0) just fine. Page pool has calling context requirements, make sure we don't try to call it from what is potentially HW IRQ context.
--- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx4/en_tx.c +2 -0
@@ -446,6 +446,8 @@ int mlx4_en_process_tx_cq(struct net_device *dev,if (unlikely (!priv->port_up))return 0 ; +if (unlikely (!napi_budget) && cq->type ==TX_XDP ) +return 0 ;netdev_txq_bql_complete_prefetchw (ring->tx_queue);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 161/325 PCI: Fix old_size lower bound in calculate_iosize() too
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
[ Upstream commit ff61f380de5652e723168341480cc7adf1dd6213 ]
Commit 903534fa7d30 ("PCI: Fix resource double counting on remove & rescan") fixed double counting of mem resources because of old_size being applied too early.
Fix a similar counting bug on the io resource side.
--- drivers/pci/setup-bus.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pci/setup-bus.c +2 -4
@@ -806,11 +806,9 @@ static resource_size_t calculate_iosize(resource_size_t size, size = (size &0xff ) + ((size & ~0xffUL ) <<2 );#endif size = size + size1; -if (size < old_size) - size = old_size; - size =ALIGN (max (size, add_size) + children_add_size, align); -return size; + size =max (size, add_size) + children_add_size; +return ALIGN (max (size, old_size), align); } static resource_size_t calculate_memsize(resource_size_t size,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 162/325 ACPI: HED: Always initialize before evged
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaofei Tan <[email protected]>
[ Upstream commit cccf6ee090c8c133072d5d5b52ae25f3bc907a16 ]
When the HED driver is built-in, it initializes after evged because they both are at the same initcall level, so the initialization ordering depends on the Makefile order. However, this prevents RAS records coming in between the evged driver initialization and the HED driver initialization from being handled.
If the number of such RAS records is above the APEI HEST error source number, the HEST resources may be exhausted, and that may affect subsequent RAS error reporting.
To fix this issue, change the initcall level of HED to subsys_initcall and prevent the driver from being built as a module by changing ACPI_HED in Kconfig from "tristate" to "bool".
--- drivers/acpi/Kconfig | 2 +- drivers/acpi/hed.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/acpi/Kconfig +1 -1
@@ -438,7 +438,7 @@ config ACPI_SBS the modules will be called sbs and sbshc. config ACPI_HED - tristate "Hardware Error Device" + bool "Hardware Error Device" help This driver supports the Hardware Error Device (PNP0C33), which is used to report some hardware errors notified via
drivers/acpi/hed.c +6 -1
@@ -72,7 +72,12 @@ static struct acpi_driver acpi_hed_driver = { .notify = acpi_hed_notify, }, }; -module_acpi_driver (acpi_hed_driver); + +static int __init acpi_hed_driver_init (void ) +{ +return acpi_bus_register_driver (&acpi_hed_driver); +} +subsys_initcall (acpi_hed_driver_init);MODULE_AUTHOR ("Huang Ying" );MODULE_DESCRIPTION ("ACPI Hardware Error Device Driver" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 163/325 vxlan: Join / leave MC group after remote changes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Machata <[email protected]>
[ Upstream commit d42d543368343c0449a4e433b5f02e063a86209c ]
When a vxlan netdevice is brought up, if its default remote is a multicast address, the device joins the indicated group.
Therefore when the multicast remote address changes, the device should leave the current group and subscribe to the new one. Similarly when the interface used for endpoint communication is changed in a situation when multicast remote is configured. This is currently not done.
Both vxlan_igmp_join() and vxlan_igmp_leave() can however fail. So it is possible that with such fix, the netdevice will end up in an inconsistent situation where the old group is not joined anymore, but joining the new group fails. Should we join the new group first, and leave the old one second, we might end up in the opposite situation, where both groups are joined. Undoing any of this during rollback is going to be similarly problematic.
One solution would be to just forbid the change when the netdevice is up. However in vnifilter mode, changing the group address is allowed, and these problems are simply ignored (see vxlan_vni_update_group()):
# ip link add name br up type bridge vlan_filtering 1 # ip link add vx1 up master br type vxlan external vnifilter local 192.0.2.1 dev lo dstport 4789 # bridge vni add dev vx1 vni 200 group 224.0.0.1 # tcpdump -i lo & # bridge vni add dev vx1 vni 200 group 224.0.0.2 18:55:46.523438 IP 0.0.0.0 > 224.0.0.22: igmp v3 report, 1 group record(s) 18:55:46.943447 IP 0.0.0.0 > 224.0.0.22: igmp v3 report, 1 group record(s) # bridge vni dev vni group/remote vx1 200 224.0.0.2
Having two different modes of operation for conceptually the same interface is silly, so in this patch, just do what the vnifilter code does and deal with the errors by crossing fingers real hard.
The vnifilter code leaves old before joining new, and in case of join / leave failures does not roll back the configuration changes that have already been applied, but bails out of joining if it could not leave. Do the same here: leave before join, apply changes unconditionally and do not attempt to join if we couldn't leave.
--- drivers/net/vxlan/vxlan_core.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/net/vxlan/vxlan_core.c +16 -2
@@ -4231,6 +4231,7 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], struct netlink_ext_ack *extack) {struct vxlan_dev *vxlan =netdev_priv (dev); +bool rem_ip_changed, change_igmp;struct net_device *lowerdev;struct vxlan_config conf;struct vxlan_rdst *dst;
@@ -4254,8 +4255,13 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],if (err)return err; + rem_ip_changed = !vxlan_addr_equal (&conf.remote_ip, &dst->remote_ip); + change_igmp = vxlan->dev->flags &IFF_UP && + (rem_ip_changed || + dst->remote_ifindex != conf.remote_ifindex); +/* handle default dst entry */ -if (!vxlan_addr_equal (&conf.remote_ip, &dst->remote_ip)) { +if (rem_ip_changed) {u32 hash_index =fdb_head_index (vxlan, all_zeros_mac, conf.vni);spin_lock_bh (&vxlan->hash_lock[hash_index]);
@@ -4299,6 +4305,9 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], } } +if (change_igmp &&vxlan_addr_multicast (&dst->remote_ip)) + err =vxlan_multicast_leave (vxlan); +if (conf.age_interval != vxlan->cfg.age_interval)mod_timer (&vxlan->age_timer, jiffies);
@@ -4306,7 +4315,12 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],if (lowerdev && lowerdev != dst->remote_dev) dst->remote_dev = lowerdev;vxlan_config_apply (dev, &conf, lowerdev, vxlan->net, true); -return 0 ; + +if (!err && change_igmp && +vxlan_addr_multicast (&dst->remote_ip)) + err =vxlan_multicast_join (vxlan); + +return err; }static void vxlan_dellink (struct net_device *dev,struct list_head *head)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 164/325 media: test-drivers: vivid: dont call schedule in loop
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit e4740118b752005cbed339aec9a1d1c43620e0b9 ]
Artem reported that the CPU load was 100% when capturing from vivid at low resolution with ffmpeg.
This was caused by:
while (time_is_after_jiffies(cur_jiffies + wait_jiffies) &&
!kthread_should_stop())
schedule();If there are no other processes running that can be scheduled, then this is basically a busy-loop.
Change it to wait_event_interruptible_timeout() which doesn't have that problem.
--- drivers/media/test-drivers/vivid/vivid-kthread-cap.c | 11 ++++++++--- drivers/media/test-drivers/vivid/vivid-kthread-out.c | 11 ++++++++--- .../media/test-drivers/vivid/vivid-kthread-touch.c | 11 ++++++++--- drivers/media/test-drivers/vivid/vivid-sdr-cap.c | 11 ++++++++--- 4 files changed, 32 insertions(+), 12 deletions(-)
drivers/media/test-drivers/vivid/vivid-kthread-cap.c +8 -3
@@ -894,9 +894,14 @@ static int vivid_thread_vid_cap(void *data) next_jiffies_since_start = jiffies_since_start; wait_jiffies = next_jiffies_since_start - jiffies_since_start; -while (time_is_after_jiffies (cur_jiffies + wait_jiffies) && - !kthread_should_stop ()) -schedule (); +if (!time_is_after_jiffies (cur_jiffies + wait_jiffies)) +continue ; + +wait_queue_head_t wait; + +init_waitqueue_head (&wait); +wait_event_interruptible_timeout (wait,kthread_should_stop (), + cur_jiffies + wait_jiffies - jiffies); }dprintk (dev,1 ,"Video Capture Thread End\n" );return 0 ;
drivers/media/test-drivers/vivid/vivid-kthread-out.c +8 -3
@@ -235,9 +235,14 @@ static int vivid_thread_vid_out(void *data) next_jiffies_since_start = jiffies_since_start; wait_jiffies = next_jiffies_since_start - jiffies_since_start; -while (time_is_after_jiffies (cur_jiffies + wait_jiffies) && - !kthread_should_stop ()) -schedule (); +if (!time_is_after_jiffies (cur_jiffies + wait_jiffies)) +continue ; + +wait_queue_head_t wait; + +init_waitqueue_head (&wait); +wait_event_interruptible_timeout (wait,kthread_should_stop (), + cur_jiffies + wait_jiffies - jiffies); }dprintk (dev,1 ,"Video Output Thread End\n" );return 0 ;
drivers/media/test-drivers/vivid/vivid-kthread-touch.c +8 -3
@@ -135,9 +135,14 @@ static int vivid_thread_touch_cap(void *data) next_jiffies_since_start = jiffies_since_start; wait_jiffies = next_jiffies_since_start - jiffies_since_start; -while (time_is_after_jiffies (cur_jiffies + wait_jiffies) && - !kthread_should_stop ()) -schedule (); +if (!time_is_after_jiffies (cur_jiffies + wait_jiffies)) +continue ; + +wait_queue_head_t wait; + +init_waitqueue_head (&wait); +wait_event_interruptible_timeout (wait,kthread_should_stop (), + cur_jiffies + wait_jiffies - jiffies); }dprintk (dev,1 ,"Touch Capture Thread End\n" );return 0 ;
drivers/media/test-drivers/vivid/vivid-sdr-cap.c +8 -3
@@ -206,9 +206,14 @@ static int vivid_thread_sdr_cap(void *data) next_jiffies_since_start = jiffies_since_start; wait_jiffies = next_jiffies_since_start - jiffies_since_start; -while (time_is_after_jiffies (cur_jiffies + wait_jiffies) && - !kthread_should_stop ()) -schedule (); +if (!time_is_after_jiffies (cur_jiffies + wait_jiffies)) +continue ; + +wait_queue_head_t wait; + +init_waitqueue_head (&wait); +wait_event_interruptible_timeout (wait,kthread_should_stop (), + cur_jiffies + wait_jiffies - jiffies); }dprintk (dev,1 ,"SDR Capture Thread End\n" );return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 165/325 net/mlx5: Modify LSB bitmask in temperature event to include only the first bit
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shahar Shitrit <[email protected]>
[ Upstream commit 633f16d7e07c129a36b882c05379e01ce5bdb542 ]
In the sensor_count field of the MTEWE register, bits 1-62 are supported only for unmanaged switches, not for NICs, and bit 63 is reserved for internal use.
To prevent confusing output that may include set bits that are not relevant to NIC sensors, we update the bitmask to retain only the first bit, which corresponds to the sensor ASIC.
--- drivers/net/ethernet/mellanox/mlx5/core/events.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/events.c +4 -0
@@ -163,6 +163,10 @@ static int temp_warn(struct notifier_block *nb, unsigned long type, void *data)u64 value_msb; value_lsb =be64_to_cpu (eqe->data.temp_warning.sensor_warning_lsb); +/* bit 1-63 are not supported for NICs, +* hence read only bit 0 (asic) from lsb. +*/ + value_lsb &=0x1 ; value_msb =be64_to_cpu (eqe->data.temp_warning.sensor_warning_msb); mlx5_core_warn(events->dev,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 166/325 net/mlx5: Apply rate-limiting to high temperature warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shahar Shitrit <[email protected]>
[ Upstream commit 9dd3d5d258aceb37bdf09c8b91fa448f58ea81f0 ]
Wrap the high temperature warning in a temperature event with a call to net_ratelimit() to prevent flooding the kernel log with repeated warning messages when temperature exceeds the threshold multiple times within a short duration.
--- drivers/net/ethernet/mellanox/mlx5/core/events.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/events.c +4 -3
@@ -169,9 +169,10 @@ static int temp_warn(struct notifier_block *nb, unsigned long type, void *data) value_lsb &=0x1 ; value_msb =be64_to_cpu (eqe->data.temp_warning.sensor_warning_msb); -mlx5_core_warn (events->dev, -"High temperature on sensors with bit set %llx %llx" , - value_msb, value_lsb); +if (net_ratelimit ()) +mlx5_core_warn (events->dev, +"High temperature on sensors with bit set %llx %llx" , + value_msb, value_lsb);return NOTIFY_OK ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 167/325 ASoC: ops: Enforce platform maximum on initial value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Povišer <[email protected]>
[ Upstream commit 783db6851c1821d8b983ffb12b99c279ff64f2ee ]
Lower the volume if it is violating the platform maximum at its initial value (i.e. at the time of the 'snd_soc_limit_volume' call).
--- sound/soc/soc-ops.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
sound/soc/soc-ops.c +28 -1
@@ -638,6 +638,33 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol, }EXPORT_SYMBOL_GPL (snd_soc_get_volsw_range); +static int snd_soc_clip_to_platform_max (struct snd_kcontrol *kctl) +{ +struct soc_mixer_control *mc = (struct soc_mixer_control *)kctl->private_value; +struct snd_ctl_elem_value uctl; +int ret; + +if (!mc->platform_max) +return 0 ; + + ret = kctl->get (kctl, &uctl); +if (ret <0 ) +return ret; + +if (uctl.value.integer.value[0 ] > mc->platform_max) + uctl.value.integer.value[0 ] = mc->platform_max; + +if (snd_soc_volsw_is_stereo (mc) && + uctl.value.integer.value[1 ] > mc->platform_max) + uctl.value.integer.value[1 ] = mc->platform_max; + + ret = kctl->put (kctl, &uctl); +if (ret <0 ) +return ret; + +return 0 ; +} +/** * snd_soc_limit_volume - Set new limit to an existing volume control. *
@@ -662,7 +689,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card,struct soc_mixer_control *mc = (struct soc_mixer_control *)kctl->private_value;if (max <= mc->max - mc->min) { mc->platform_max = max; - ret =0 ; + ret =snd_soc_clip_to_platform_max (kctl); } }return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 168/325 ASoC: tas2764: Add reg defaults for TAS2764_INT_CLK_CFG
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hector Martin <[email protected]>
[ Upstream commit d64c4c3d1c578f98d70db1c5e2535b47adce9d07 ]
--- sound/soc/codecs/tas2764.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/tas2764.c +1 -0
@@ -636,6 +636,7 @@ static const struct reg_default tas2764_reg_defaults[] = { { TAS2764_TDM_CFG2, 0x0a }, { TAS2764_TDM_CFG3, 0x10 }, { TAS2764_TDM_CFG5, 0x42 }, + { TAS2764_INT_CLK_CFG, 0x19 }, }; static const struct regmap_range_cfg tas2764_regmap_ranges[] = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 169/325 ASoC: tas2764: Mark SW_RESET as volatile
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hector Martin <[email protected]>
[ Upstream commit f37f1748564ac51d32f7588bd7bfc99913ccab8e ]
Since the bit is self-clearing.
--- sound/soc/codecs/tas2764.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/tas2764.c +1 -0
@@ -654,6 +654,7 @@ static const struct regmap_range_cfg tas2764_regmap_ranges[] = {static bool tas2764_volatile_register (struct device *dev,unsigned int reg) {switch (reg) { +case TAS2764_SW_RST : case TAS2764_INT_LTCH0 ... TAS2764_INT_LTCH4:case TAS2764_INT_CLK_CFG :return true;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 170/325 ASoC: tas2764: Power up/down amp on mute ops
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hector Martin <[email protected]>
[ Upstream commit 1c3b5f37409682184669457a5bdf761268eafbe5 ]
The ASoC convention is that clocks are removed after codec mute, and power up/down is more about top level power management. For these chips, the "mute" state still expects a TDM clock, and yanking the clock in this state will trigger clock errors. So, do the full shutdown<->mute<->active transition on the mute operation, so the amp is in software shutdown by the time the clocks are removed.
This fixes TDM clock errors when streams are stopped.
--- sound/soc/codecs/tas2764.c | 51 ++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 30 deletions(-)
sound/soc/codecs/tas2764.c +21 -30
@@ -182,33 +182,6 @@ static SOC_ENUM_SINGLE_DECL(static const struct snd_kcontrol_new tas2764_asi1_mux =SOC_DAPM_ENUM ("ASI1 Source" , tas2764_ASI1_src_enum); -static int tas2764_dac_event (struct snd_soc_dapm_widget *w, -struct snd_kcontrol *kcontrol,int event) -{ -struct snd_soc_component *component =snd_soc_dapm_to_component (w->dapm); -struct tas2764_priv *tas2764 =snd_soc_component_get_drvdata (component); -int ret; - -switch (event) { -case SND_SOC_DAPM_POST_PMU : - tas2764->dac_powered = true; - ret =tas2764_update_pwr_ctrl (tas2764); -break ; -case SND_SOC_DAPM_PRE_PMD : - tas2764->dac_powered = false; - ret =tas2764_update_pwr_ctrl (tas2764); -break ; -default : -dev_err (tas2764->dev,"Unsupported event\n" ); -return -EINVAL ; - } - -if (ret <0 ) -return ret; - -return 0 ; -} -static const struct snd_kcontrol_new isense_switch =SOC_DAPM_SINGLE ("Switch" ,TAS2764_PWR_CTRL ,TAS2764_ISENSE_POWER_EN ,1 ,1 ); static const struct snd_kcontrol_new vsense_switch =
@@ -221,8 +194,7 @@ static const struct snd_soc_dapm_widget tas2764_dapm_widgets[] = { 1, &isense_switch),SND_SOC_DAPM_SWITCH ("VSENSE" ,TAS2764_PWR_CTRL ,TAS2764_VSENSE_POWER_EN ,1 , &vsense_switch), -SND_SOC_DAPM_DAC_E ("DAC" ,NULL ,SND_SOC_NOPM ,0 ,0 , tas2764_dac_event, -SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_PRE_PMD ), +SND_SOC_DAPM_DAC ("DAC" ,NULL ,SND_SOC_NOPM ,0 ,0 ),SND_SOC_DAPM_OUTPUT ("OUT" ),SND_SOC_DAPM_SIGGEN ("VMON" ),SND_SOC_DAPM_SIGGEN ("IMON" )
@@ -243,9 +215,28 @@ static int tas2764_mute(struct snd_soc_dai *dai, int mute, int direction) {struct tas2764_priv *tas2764 =snd_soc_component_get_drvdata (dai->component); +int ret; + +if (!mute) { + tas2764->dac_powered = true; + ret =tas2764_update_pwr_ctrl (tas2764); +if (ret) +return ret; + } tas2764->unmuted = !mute; -return tas2764_update_pwr_ctrl (tas2764); + ret =tas2764_update_pwr_ctrl (tas2764); +if (ret) +return ret; + +if (mute) { + tas2764->dac_powered = false; + ret =tas2764_update_pwr_ctrl (tas2764); +if (ret) +return ret; + } + +return 0 ; }static int tas2764_set_bitwidth (struct tas2764_priv *tas2764,int bitwidth)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 171/325 ASoC: soc-dai: check return value at snd_soc_dai_set_tdm_slot()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuninori Morimoto <[email protected]>
[ Upstream commit 7f1186a8d738661b941b298fd6d1d5725ed71428 ]
snd_soc_dai_set_tdm_slot() calls .xlate_tdm_slot_mask() or snd_soc_xlate_tdm_slot_mask(), but didn't check its return value. Let's check it.
This patch might break existing driver. In such case, let's makes each func to void instead of int.
--- sound/soc/soc-dai.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
sound/soc/soc-dai.c +5 -3
@@ -270,10 +270,11 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,if (dai->driver->ops && dai->driver->ops->xlate_tdm_slot_mask) - dai->driver->ops->xlate_tdm_slot_mask (slots, - &tx_mask, &rx_mask); + ret = dai->driver->ops->xlate_tdm_slot_mask (slots, &tx_mask, &rx_mask);else -snd_soc_xlate_tdm_slot_mask (slots, &tx_mask, &rx_mask); + ret =snd_soc_xlate_tdm_slot_mask (slots, &tx_mask, &rx_mask); +if (ret) + goto err; dai->tx_mask = tx_mask; dai->rx_mask = rx_mask;
@@ -282,6 +283,7 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, dai->driver->ops->set_tdm_slot) ret = dai->driver->ops->set_tdm_slot (dai, tx_mask, rx_mask, slots, slot_width); +err:return soc_dai_ret (dai, ret); }EXPORT_SYMBOL_GPL (snd_soc_dai_set_tdm_slot);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 172/325 pinctrl: devicetree: do not goto err when probing hogs in pinctrl_dt_to_map
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Valentin Caron <[email protected]>
[ Upstream commit c98868e816209e568c9d72023ba0bc1e4d96e611 ]
Cross case in pinctrl framework make impossible to an hogged pin and another, not hogged, used within the same device-tree node. For example with this simplified device-tree :
&pinctrl {
pinctrl_pin_1: pinctrl-pin-1 {
pins = "dummy-pinctrl-pin";
};
};
&rtc {
pinctrl-names = "default"
pinctrl-0 = <&pinctrl_pin_1 &rtc_pin_1> rtc_pin_1: rtc-pin-1 {
pins = "dummy-rtc-pin";
};};
"pinctrl_pin_1" configuration is never set. This produces this path in the code:
really_probe()
pinctrl_bind_pins()
| devm_pinctrl_get()
| pinctrl_get()
| create_pinctrl()
| pinctrl_dt_to_map()
| // Hog pin create an abort for all pins of the node
| ret = dt_to_map_one_config()
| | /* Do not defer probing of hogs (circular loop) */
| | if (np_pctldev == p->dev->of_node)
| | return -ENODEV;
| if (ret)
| goto err
|
call_driver_probe()
stm32_rtc_probe()
pinctrl_enable()
pinctrl_claim_hogs()
create_pinctrl()
for_each_maps(maps_node, i, map)
// Not hog pin is skipped
if (pctldev && strcmp(dev_name(pctldev->dev),
map->ctrl_dev_name))
continue;At the first call of create_pinctrl() the hogged pin produces an abort to avoid a defer of hogged pins. All other pin configurations are trashed.
At the second call, create_pinctrl is now called with pctldev parameter to get hogs, but in this context only hogs are set. And other pins are skipped.
To handle this, do not produce an abort in the first call of create_pinctrl(). Classic pin configuration will be set in pinctrl_bind_pins() context. And the hogged pin configuration will be set in pinctrl_claim_hogs() context.
--- drivers/pinctrl/devicetree.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/pinctrl/devicetree.c +8 -2
@@ -143,10 +143,14 @@ static int dt_to_map_one_config(struct pinctrl *p, pctldev =get_pinctrl_dev_from_of_node (np_pctldev);if (pctldev)break ; -/* Do not defer probing of hogs (circular loop) */ +/* +* Do not defer probing of hogs (circular loop) +* +* Return 1 to let the caller catch the case. +*/ if (np_pctldev == p->dev->of_node) {of_node_put (np_pctldev); -return -ENODEV ; +return 1 ; } }of_node_put (np_pctldev);
@@ -265,6 +269,8 @@ int pinctrl_dt_to_map(struct pinctrl *p, struct pinctrl_dev *pctldev) ret =dt_to_map_one_config (p, pctldev, statename, np_config);of_node_put (np_config); +if (ret ==1 ) +continue ;if (ret <0 ) goto err; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 173/325 smack: recognize ipv4 CIPSO w/o categories
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Andreev <[email protected]>
[ Upstream commit a158a937d864d0034fea14913c1f09c6d5f574b8 ]
If SMACK label has CIPSO representation w/o categories, e.g.:
| # cat /smack/cipso2 | foo 10 | @ 250/2 | ...
then SMACK does not recognize such CIPSO in input ipv4 packets and substitues '*' label instead. Audit records may look like
| lsm=SMACK fn=smack_socket_sock_rcv_skb action=denied
| subject="*" object="_" requested=w pid=0 comm="swapper/1" ...
This happens in two steps:
1) security/smack/smackfs.c`smk_set_cipso does not clear NETLBL_SECATTR_MLS_CAT
from (struct smack_known *)skp->smk_netlabel.flags on assigning CIPSO w/o categories:
| rcu_assign_pointer(skp->smk_netlabel.attr.mls.cat, ncats.attr.mls.cat); | skp->smk_netlabel.attr.mls.lvl = ncats.attr.mls.lvl;
2) security/smack/smack_lsm.c`smack_from_secattr
can not match skp->smk_netlabel with input packet's struct netlbl_lsm_secattr *sap
because sap->flags have not NETLBL_SECATTR_MLS_CAT (what is correct) but skp->smk_netlabel.flags have (what is incorrect):
| if ((sap->flags & NETLBL_SECATTR_MLS_CAT) == 0) {
| if ((skp->smk_netlabel.flags &
| NETLBL_SECATTR_MLS_CAT) == 0)
| found = 1;
| break;
| }This commit sets/clears NETLBL_SECATTR_MLS_CAT in skp->smk_netlabel.flags according to the presense of CIPSO categories. The update of smk_netlabel is not atomic, so input packets processing still may be incorrect during short time while update proceeds.
--- security/smack/smackfs.c | 4 ++++ 1 file changed, 4 insertions(+)
security/smack/smackfs.c +4 -0
@@ -922,6 +922,10 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,if (rc >=0 ) { old_cat = skp->smk_netlabel.attr.mls.cat;rcu_assign_pointer (skp->smk_netlabel.attr.mls.cat, ncats.attr.mls.cat); +if (ncats.attr.mls.cat) + skp->smk_netlabel.flags |=NETLBL_SECATTR_MLS_CAT ; +else + skp->smk_netlabel.flags &= ~(u32 )NETLBL_SECATTR_MLS_CAT ; skp->smk_netlabel.attr.mls.lvl = ncats.attr.mls.lvl;synchronize_rcu ();netlbl_catmap_free (old_cat);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 174/325 kunit: tool: Use qboot on QEMU x86_64
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brendan Jackman <[email protected]>
[ Upstream commit 08fafac4c9f289a9d9a22d838921e4b3eb22c664 ]
As noted in [0], SeaBIOS (QEMU default) makes a mess of the terminal, qboot does not.
It turns out this is actually useful with kunit.py, since the user is exposed to this issue if they set --raw_output=all.
qboot is also faster than SeaBIOS, but it's is marginal for this usecase.
[0] https://lore.kernel.org/all/CA+i-1C0wYb-gZ8Mwh3WSVpbk-LF-Uo+njVbASJPe1WXDURoV7A@mail.gmail.com/
Both SeaBIOS and qboot are x86-specific.
--- tools/testing/kunit/qemu_configs/x86_64.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/kunit/qemu_configs/x86_64.py +3 -1
@@ -7,4 +7,6 @@ CONFIG_SERIAL_8250_CONSOLE=y''', qemu_arch='x86_64', kernel_path='arch/x86/boot/bzImage', kernel_command_line='console=ttyS0', - extra_qemu_params=[]) + # qboot is faster than SeaBIOS and doesn't mess up + # the terminal. + extra_qemu_params=['-bios', 'qboot.rom'])
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 175/325 net/mlx4_core: Avoid impossible mlx4_db_alloc() order value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 4a6f18f28627e121bd1f74b5fcc9f945d6dbeb1e ]
GCC can see that the value range for "order" is capped, but this leads it to consider that it might be negative, leading to a false positive warning (with GCC 15 with -Warray-bounds -fdiagnostics-details):
../drivers/net/ethernet/mellanox/mlx4/alloc.c:691:47: error: array subscript -1 is below array bounds of 'long unsigned int *[2]' [-Werror=array-bounds=]
691 | i = find_first_bit(pgdir->bits[o], MLX4_DB_PER_PAGE >> o);
| ~~~~~~~~~~~^~~
'mlx4_alloc_db_from_pgdir': events 1-2
691 | i = find_first_bit(pgdir->bits[o], MLX4_DB_PER_PAGE >> o); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | | | | (2) out of array bounds here
| (1) when the condition is evaluated to true In file included from ../drivers/net/ethernet/mellanox/mlx4/mlx4.h:53,
from ../drivers/net/ethernet/mellanox/mlx4/alloc.c:42:../include/linux/mlx4/device.h:664:33: note: while referencing 'bits'
664 | unsigned long *bits[2];
| ^~~~
Switch the argument to unsigned int, which removes the compiler needing to consider negative values.
--- drivers/net/ethernet/mellanox/mlx4/alloc.c | 6 +++--- include/linux/mlx4/device.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx4/alloc.c +3 -3
@@ -682,9 +682,9 @@ static struct mlx4_db_pgdir *mlx4_alloc_db_pgdir(struct device *dma_device) }static int mlx4_alloc_db_from_pgdir (struct mlx4_db_pgdir *pgdir, -struct mlx4_db *db,int order) +struct mlx4_db *db,unsigned int order) { -int o; +unsigned int o;int i;for (o = order; o <=1 ; ++o) {
@@ -712,7 +712,7 @@ static int mlx4_alloc_db_from_pgdir(struct mlx4_db_pgdir *pgdir,return 0 ; } -int mlx4_db_alloc (struct mlx4_dev *dev,struct mlx4_db *db,int order) +int mlx4_db_alloc (struct mlx4_dev *dev,struct mlx4_db *db,unsigned int order) {struct mlx4_priv *priv =mlx4_priv (dev);struct mlx4_db_pgdir *pgdir;
include/linux/mlx4/device.h +1 -1
@@ -1115,7 +1115,7 @@ int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,int mlx4_buf_write_mtt (struct mlx4_dev *dev,struct mlx4_mtt *mtt,struct mlx4_buf *buf); -int mlx4_db_alloc (struct mlx4_dev *dev,struct mlx4_db *db,int order); +int mlx4_db_alloc (struct mlx4_dev *dev,struct mlx4_db *db,unsigned int order);void mlx4_db_free (struct mlx4_dev *dev,struct mlx4_db *db); int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 176/325 clk: qcom: clk-alpha-pll: Do not use random stack value for recalc rate
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 7a243e1b814a02ab40793026ef64223155d86395 ]
If regmap_read() fails, random stack value was used in calculating new frequency in recalc_rate() callbacks. Such failure is really not expected as these are all MMIO reads, however code should be here correct and bail out. This also avoids possible warning on uninitialized value.
--- drivers/clk/qcom/clk-alpha-pll.c | 52 ++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 16 deletions(-)
drivers/clk/qcom/clk-alpha-pll.c +36 -16
@@ -561,14 +561,19 @@ clk_alpha_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)struct clk_alpha_pll *pll =to_clk_alpha_pll (hw);u32 alpha_width =pll_alpha_width (pll); -regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l); +if (regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l)) +return 0 ; + +if (regmap_read (pll->clkr.regmap,PLL_USER_CTL (pll), &ctl)) +return 0 ; -regmap_read (pll->clkr.regmap,PLL_USER_CTL (pll), &ctl);if (ctl &PLL_ALPHA_EN ) { -regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL (pll), &low); +if (regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL (pll), &low)) +return 0 ;if (alpha_width >32 ) { -regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL_U (pll), - &high); +if (regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL_U (pll), + &high)) +return 0 ; a = (u64 )high <<32 | low; }else { a = low &GENMASK (alpha_width -1 ,0 );
@@ -760,8 +765,11 @@ alpha_pll_huayra_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)struct clk_alpha_pll *pll =to_clk_alpha_pll (hw);u32 l, alpha =0 , ctl, alpha_m, alpha_n; -regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l); -regmap_read (pll->clkr.regmap,PLL_USER_CTL (pll), &ctl); +if (regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l)) +return 0 ; + +if (regmap_read (pll->clkr.regmap,PLL_USER_CTL (pll), &ctl)) +return 0 ;if (ctl &PLL_ALPHA_EN ) {regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL (pll), &alpha);
@@ -955,8 +963,11 @@ clk_trion_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)struct clk_alpha_pll *pll =to_clk_alpha_pll (hw);u32 l, frac, alpha_width =pll_alpha_width (pll); -regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l); -regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL (pll), &frac); +if (regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l)) +return 0 ; + +if (regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL (pll), &frac)) +return 0 ;return alpha_pll_calc_rate (parent_rate, l, frac, alpha_width); }
@@ -1014,7 +1025,8 @@ clk_alpha_pll_postdiv_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)struct clk_alpha_pll_postdiv *pll =to_clk_alpha_pll_postdiv (hw);u32 ctl; -regmap_read (pll->clkr.regmap,PLL_USER_CTL (pll), &ctl); +if (regmap_read (pll->clkr.regmap,PLL_USER_CTL (pll), &ctl)) +return 0 ; ctl >>=PLL_POST_DIV_SHIFT ; ctl &=PLL_POST_DIV_MASK (pll);
@@ -1230,8 +1242,11 @@ static unsigned long alpha_pll_fabia_recalc_rate(struct clk_hw *hw,struct clk_alpha_pll *pll =to_clk_alpha_pll (hw);u32 l, frac, alpha_width =pll_alpha_width (pll); -regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l); -regmap_read (pll->clkr.regmap,PLL_FRAC (pll), &frac); +if (regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l)) +return 0 ; + +if (regmap_read (pll->clkr.regmap,PLL_FRAC (pll), &frac)) +return 0 ;return alpha_pll_calc_rate (parent_rate, l, frac, alpha_width); }
@@ -1381,7 +1396,8 @@ clk_trion_pll_postdiv_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)struct regmap *regmap = pll->clkr.regmap;u32 i, div =1 , val; -regmap_read (regmap,PLL_USER_CTL (pll), &val); +if (regmap_read (regmap,PLL_USER_CTL (pll), &val)) +return 0 ; val >>= pll->post_div_shift; val &=PLL_POST_DIV_MASK (pll);
@@ -2254,9 +2270,12 @@ static unsigned long alpha_pll_lucid_evo_recalc_rate(struct clk_hw *hw,struct regmap *regmap = pll->clkr.regmap;u32 l, frac; -regmap_read (regmap,PLL_L_VAL (pll), &l); +if (regmap_read (regmap,PLL_L_VAL (pll), &l)) +return 0 ; l &=LUCID_EVO_PLL_L_VAL_MASK ; -regmap_read (regmap,PLL_ALPHA_VAL (pll), &frac); + +if (regmap_read (regmap,PLL_ALPHA_VAL (pll), &frac)) +return 0 ;return alpha_pll_calc_rate (parent_rate, l, frac,pll_alpha_width (pll)); }
@@ -2331,7 +2350,8 @@ static unsigned long clk_rivian_evo_pll_recalc_rate(struct clk_hw *hw,struct clk_alpha_pll *pll =to_clk_alpha_pll (hw);u32 l; -regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l); +if (regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l)) +return 0 ;return parent_rate * l; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 177/325 serial: sh-sci: Update the suspend/resume support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
[ Upstream commit 22a6984c5b5df8eab864d7f3e8b94d5a554d31ab ]
The Renesas RZ/G3S supports a power saving mode where power to most of the SoC components is turned off. When returning from this power saving mode, SoC components need to be re-configured.
The SCIFs on the Renesas RZ/G3S need to be re-configured as well when returning from this power saving mode. The sh-sci code already configures the SCIF clocks, power domain and registers by calling uart_resume_port() in sci_resume(). On suspend path the SCIF UART ports are suspended accordingly (by calling uart_suspend_port() in sci_suspend()). The only missing setting is the reset signal. For this assert/de-assert the reset signal on driver suspend/resume.
In case the no_console_suspend is specified by the user, the registers need to be saved on suspend path and restore on resume path. To do this the sci_console_save()/sci_console_restore() functions were added. There is no need to cache/restore the status or FIFO registers. Only the control registers. The registers that will be saved/restored on suspend/resume are specified by the struct sci_suspend_regs data structure.
--- drivers/tty/serial/sh-sci.c | 71 +++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 2 deletions(-)
drivers/tty/serial/sh-sci.c +69 -2
@@ -105,6 +105,15 @@ struct plat_sci_reg {u8 offset, size; }; +struct sci_suspend_regs { +u16 scsmr; +u16 scscr; +u16 scfcr; +u16 scsptr; +u8 scbrr; +u8 semr; +}; +struct sci_port_params {const struct plat_sci_reg regs[SCIx_NR_REGS];unsigned int fifosize;
@@ -135,6 +144,8 @@ struct sci_port {struct dma_chan *chan_tx;struct dma_chan *chan_rx; +struct reset_control *rstc; +#ifdef CONFIG_SERIAL_SH_SCI_DMA struct dma_chan *chan_tx_saved;struct dma_chan *chan_rx_saved;
@@ -154,6 +165,7 @@ struct sci_port {int rx_trigger;struct timer_list rx_fifo_timer;int rx_fifo_timeout; +struct sci_suspend_regs suspend_regs;u16 hscif_tot;bool has_rtscts;
@@ -3252,6 +3264,7 @@ static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev, } sp = &sci_ports[id]; + sp->rstc = rstc; *dev_id = id; p->type =SCI_OF_TYPE (data);
@@ -3400,13 +3413,57 @@ static int sci_probe(struct platform_device *dev)return 0 ; } +static void sci_console_save (struct sci_port *s) +{ +struct sci_suspend_regs *regs = &s->suspend_regs; +struct uart_port *port = &s->port; + +if (sci_getreg (port,SCSMR )->size) + regs->scsmr =sci_serial_in (port,SCSMR ); +if (sci_getreg (port,SCSCR )->size) + regs->scscr =sci_serial_in (port,SCSCR ); +if (sci_getreg (port,SCFCR )->size) + regs->scfcr =sci_serial_in (port,SCFCR ); +if (sci_getreg (port,SCSPTR )->size) + regs->scsptr =sci_serial_in (port,SCSPTR ); +if (sci_getreg (port,SCBRR )->size) + regs->scbrr =sci_serial_in (port,SCBRR ); +if (sci_getreg (port,SEMR )->size) + regs->semr =sci_serial_in (port,SEMR ); +} + +static void sci_console_restore (struct sci_port *s) +{ +struct sci_suspend_regs *regs = &s->suspend_regs; +struct uart_port *port = &s->port; + +if (sci_getreg (port,SCSMR )->size) +sci_serial_out (port,SCSMR , regs->scsmr); +if (sci_getreg (port,SCSCR )->size) +sci_serial_out (port,SCSCR , regs->scscr); +if (sci_getreg (port,SCFCR )->size) +sci_serial_out (port,SCFCR , regs->scfcr); +if (sci_getreg (port,SCSPTR )->size) +sci_serial_out (port,SCSPTR , regs->scsptr); +if (sci_getreg (port,SCBRR )->size) +sci_serial_out (port,SCBRR , regs->scbrr); +if (sci_getreg (port,SEMR )->size) +sci_serial_out (port,SEMR , regs->semr); +} +static __maybe_unused int sci_suspend (struct device *dev) {struct sci_port *sport =dev_get_drvdata (dev); -if (sport) +if (sport) {uart_suspend_port (&sci_uart_driver, &sport->port); +if (!console_suspend_enabled &&uart_console (&sport->port)) +sci_console_save (sport); +else +return reset_control_assert (sport->rstc); + } +return 0 ; }
@@ -3414,8 +3471,18 @@ static __maybe_unused int sci_resume(struct device *dev) {struct sci_port *sport =dev_get_drvdata (dev); -if (sport) +if (sport) { +if (!console_suspend_enabled &&uart_console (&sport->port)) { +sci_console_restore (sport); + }else { +int ret =reset_control_deassert (sport->rstc); + +if (ret) +return ret; + } +uart_resume_port (&sci_uart_driver, &sport->port); + }return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 178/325 phy: core: dont require set_mode() callback for phy_get_mode() to work
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit d58c04e305afbaa9dda7969151f06c4efe2c98b0 ]
As reported by Damon Ding, the phy_get_mode() call doesn't work as expected unless the PHY driver has a .set_mode() call. This prompts PHY drivers to have empty stubs for .set_mode() for the sake of being able to get the mode.
Make .set_mode() callback truly optional and update PHY's mode even if it there is none.
--- drivers/phy/phy-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/phy/phy-core.c +4 -3
@@ -398,13 +398,14 @@ EXPORT_SYMBOL_GPL(phy_power_off);int phy_set_mode_ext (struct phy *phy,enum phy_mode mode,int submode) { -int ret; +int ret =0 ; -if (!phy || !phy->ops->set_mode) +if (!phy)return 0 ;mutex_lock (&phy->mutex); - ret = phy->ops->set_mode (phy, mode, submode); +if (phy->ops->set_mode) + ret = phy->ops->set_mode (phy, mode, submode);if (!ret) phy->attrs.mode = mode;mutex_unlock (&phy->mutex);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 179/325 drm/amdgpu: reset psp->cmd to NULL after releasing the buffer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiang Liu <[email protected]>
[ Upstream commit e92f3f94cad24154fd3baae30c6dfb918492278d ]
Reset psp->cmd to NULL after releasing the buffer in function psp_sw_fini().
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -3
@@ -484,7 +484,6 @@ static int psp_sw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;struct psp_context *psp = &adev->psp; -struct psp_gfx_cmd_resp *cmd = psp->cmd;psp_memory_training_fini (psp);if (psp->sos_fw) {
@@ -511,8 +510,8 @@ static int psp_sw_fini(void *handle) adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7))psp_sysfs_fini (adev); -kfree (cmd); - cmd =NULL ; +kfree (psp->cmd); + psp->cmd =NULL ;psp_free_shared_bufs (psp);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 180/325 drm/amd/display: Initial psr_version with correct setting
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Chung <[email protected]>
[ Upstream commit d8c782cac5007e68e7484d420168f12d3490def6 ]
[Why & How]
The initial setting for psr_version is not correct while create a virtual link.
The default psr_version should be DC_PSR_VERSION_UNSUPPORTED.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -0
@@ -267,6 +267,7 @@ static bool create_links( link->link_id.type =OBJECT_TYPE_CONNECTOR ; link->link_id.id =CONNECTOR_ID_VIRTUAL ; link->link_id.enum_id =ENUM_ID_1 ; + link->psr_settings.psr_version =DC_PSR_VERSION_UNSUPPORTED ; link->link_enc =kzalloc (sizeof (*link->link_enc),GFP_KERNEL );if (!link->link_enc) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 181/325 drm/amdgpu: enlarge the VBIOS binary size limit
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiwu Zhang <[email protected]>
[ Upstream commit 667b96134c9e206aebe40985650bf478935cbe04 ]
Some chips have a larger VBIOS file so raise the size limit to support the flashing tool.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -1
@@ -43,7 +43,7 @@#include "amdgpu_securedisplay.h" #include "amdgpu_atomfirmware.h" -#define AMD_VBIOS_FILE_MAX_SIZE_B (1024*1024*3) +#define AMD_VBIOS_FILE_MAX_SIZE_B (1024*1024*16)static int psp_sysfs_init (struct amdgpu_device *adev);static void psp_sysfs_fini (struct amdgpu_device *adev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 182/325 drm/amd/display/dm: drop hw_support check in amdgpu_dm_i2c_xfer()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 33da70bd1e115d7d73f45fb1c09f5ecc448f3f13 ]
DC supports SW i2c as well. Drop the check.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -7281,7 +7281,7 @@ static int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap,int i;int result = -EIO ; -if (!ddc_service->ddc_pin || !ddc_service->ddc_pin->hw_info.hw_supported) +if (!ddc_service->ddc_pin)return result; cmd.payloads =kcalloc (num,sizeof (struct i2c_payload ),GFP_KERNEL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 183/325 net/mlx5: Extend Ethtool loopback selftest to support non-linear SKB
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Lazar <[email protected]>
[ Upstream commit 95b9606b15bb3ce1198d28d2393dd0e1f0a5f3e9 ]
Current loopback test validation ignores non-linear SKB case in the SKB access, which can lead to failures in scenarios such as when HW GRO is enabled.
Linearize the SKB so both cases will be handled.
--- drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c +3 -0
@@ -165,6 +165,9 @@ mlx5e_test_loopback_validate(struct sk_buff *skb,struct udphdr *udph;struct iphdr *iph; +if (skb_linearize (skb)) + goto out; +/* We are only going to peek, no need to clone the SKB */ if (MLX5E_TEST_PKT_SIZE -ETH_HLEN >skb_headlen (skb)) goto out;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 184/325 net/mlx5e: set the tx_queue_len for pfifo_fast
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Tu <[email protected]>
[ Upstream commit a38cc5706fb9f7dc4ee3a443f61de13ce1e410ed ]
By default, the mq netdev creates a pfifo_fast qdisc. On a system with 16 core, the pfifo_fast with 3 bands consumes 16 * 3 * 8 (size of pointer) * 1024 (default tx queue len) = 393KB. The patch sets the tx qlen to representor default value, 128 (1<<MLX5E_REP_PARAMS_DEF_LOG_SQ_SIZE), which consumes 16 * 3 * 8 * 128 = 49KB, saving 344KB for each representor at ECPF.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +2 -0
@@ -726,6 +726,8 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev, netdev->ethtool_ops = &mlx5e_rep_ethtool_ops; netdev->watchdog_timeo =15 *HZ ; +if (mlx5_core_is_ecpf (mdev)) + netdev->tx_queue_len =1 <<MLX5E_REP_PARAMS_DEF_LOG_SQ_SIZE ;#if IS_ENABLED (CONFIG_MLX5_CLS_ACT ) netdev->hw_features |=NETIF_F_HW_TC ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 185/325 net/mlx5e: reduce rep rxq depth to 256 for ECPF
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Tu <[email protected]>
[ Upstream commit b9cc8f9d700867aaa77aedddfea85e53d5e5d584 ]
By experiments, a single queue representor netdev consumes kernel memory around 2.8MB, and 1.8MB out of the 2.8MB is due to page pool for the RXQ. Scaling to a thousand representors consumes 2.8GB, which becomes a memory pressure issue for embedded devices such as BlueField-2 16GB / BlueField-3 32GB memory.
Since representor netdevs mostly handles miss traffic, and ideally, most of the traffic will be offloaded, reduce the default non-uplink rep netdev's RXQ default depth from 1024 to 256 if mdev is ecpf eswitch manager. This saves around 1MB of memory per regular RQ, (1024 - 256) * 2KB, allocated from page pool.
With rxq depth of 256, the netlink page pool tool reports $./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
--dump page-pool-get
{'id': 277,
'ifindex': 9,
'inflight': 128,
'inflight-mem': 786432,
'napi-id': 775}]
This is due to mtu 1500 + headroom consumes half pages, so 256 rxq entries consumes around 128 pages (thus create a page pool with size 128), shown above at inflight.
Note that each netdev has multiple types of RQs, including Regular RQ, XSK, PTP, Drop, Trap RQ. Since non-uplink representor only supports regular rq, this patch only changes the regular RQ's default depth.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +3 -0
@@ -61,6 +61,7 @@#define MLX5E_REP_PARAMS_DEF_LOG_SQ_SIZE \ max(0x7, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)#define MLX5E_REP_PARAMS_DEF_NUM_CHANNELS 1 +#define MLX5E_REP_PARAMS_DEF_LOG_RQ_SIZE 0x8static const char mlx5e_rep_driver_name[] ="mlx5e_rep" ;
@@ -705,6 +706,8 @@ static void mlx5e_build_rep_params(struct net_device *netdev)/* RQ */ mlx5e_build_rq_params (mdev, params); +if (!mlx5e_is_uplink_rep (priv) &&mlx5_core_is_ecpf (mdev)) + params->log_rq_mtu_frames =MLX5E_REP_PARAMS_DEF_LOG_RQ_SIZE ;/* CQ moderation params */ params->rx_dim_enabled =MLX5_CAP_GEN (mdev, cq_moderation);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 186/325 wifi: mac80211: dont unconditionally call drv_mgd_complete_tx()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 1798271b3604b902d45033ec569f2bf77e94ecc2 ]
We might not have called drv_mgd_prepare_tx(), so only call drv_mgd_complete_tx() under the same conditions.
--- net/mac80211/mlme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/mlme.c +2 -1
@@ -2896,7 +2896,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,if (tx)ieee80211_flush_queues (local, sdata, false); -drv_mgd_complete_tx (sdata->local, sdata, &info); +if (tx || frame_buf) +drv_mgd_complete_tx (sdata->local, sdata, &info);/* clear AP addr only after building the needed mgmt frames */ eth_zero_addr (sdata->deflink.u.mgd.bssid);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 187/325 wifi: mac80211: remove misplaced drv_mgd_complete_tx() call
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit f4995cdc4d02d0abc8e9fcccad5c71ce676c1e3f ]
In the original commit 15fae3410f1d ("mac80211: notify driver on mgd TX completion") I evidently made a mistake and placed the call in the "associated" if, rather than the "assoc_data". Later I noticed the missing call and placed it in commit c042600c17d8 ("wifi: mac80211: adding missing drv_mgd_complete_tx() call"), but didn't remove the wrong one. Remove it now.
--- net/mac80211/mlme.c | 1 - 1 file changed, 1 deletion(-)
net/mac80211/mlme.c +0 -1
@@ -7312,7 +7312,6 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,ieee80211_report_disconnect (sdata, frame_buf,sizeof (frame_buf), true, req->reason_code, false); -drv_mgd_complete_tx (sdata->local, sdata, &info);return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 188/325 arch/powerpc/perf: Check the instruction type before creating sample with perf_mem_data_src
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Athira Rajeev <[email protected]>
[ Upstream commit 2ffb26afa64261139e608bf087a0c1fe24d76d4d ]
perf mem report aborts as below sometimes (during some corner case) in powerpc:
# ./perf mem report 1>out *** stack smashing detected ***: terminated Aborted (core dumped)
The backtrace is as below:
__pthread_kill_implementation ()
raise ()
abort ()
__libc_message
__fortify_fail
__stack_chk_fail
hist_entry.lvl_snprintf
__sort__hpp_entry
__hist_entry__snprintf
hists.fprintf
cmd_report
cmd_mem
Snippet of code which triggers the issue
from tools/perf/util/sort.c
static int hist_entry__lvl_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
char out[64]; perf_mem__lvl_scnprintf(out, sizeof(out), he->mem_info);
return repsep_snprintf(bf, size, "%-*s", width, out);}
The value of "out" is filled from perf_mem_data_src value. Debugging this further showed that for some corner cases, the value of "data_src" was pointing to wrong value. This resulted in bigger size of string and causing stack check fail.
The perf mem data source values are captured in the sample via isa207_get_mem_data_src function. The initial check is to fetch the type of sampled instruction. If the type of instruction is not valid (not a load/store instruction), the function returns.
Since 'commit e16fd7f2cb1a ("perf: Use sample_flags for data_src")', data_src field is not initialized by the perf_sample_data_init() function. If the PMU driver doesn't set the data_src value to zero if type is not valid, this will result in uninitailised value for data_src. The uninitailised value of data_src resulted in stack check fail followed by abort for "perf mem report".
When requesting for data source information in the sample, the instruction type is expected to be load or store instruction. In ISA v3.0, due to hardware limitation, there are corner cases where the instruction type other than load or store is observed. In ISA v3.0 and before values "0" and "7" are considered reserved. In ISA v3.1, value "7" has been used to indicate "larx/stcx". Drop the sample if instruction type has reserved values for this field with a ISA version check. Initialize data_src to zero in isa207_get_mem_data_src if the instruction type is not load/store.
--- arch/powerpc/perf/core-book3s.c | 20 ++++++++++++++++++++ arch/powerpc/perf/isa207-common.c | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-)
arch/powerpc/perf/core-book3s.c +20 -0
@@ -2229,6 +2229,10 @@ static struct pmu power_pmu = {#define PERF_SAMPLE_ADDR_TYPE (PERF_SAMPLE_ADDR | \ PERF_SAMPLE_PHYS_ADDR | \ PERF_SAMPLE_DATA_PAGE_SIZE) + +#define SIER_TYPE_SHIFT 15 +#define SIER_TYPE_MASK (0x7ull << SIER_TYPE_SHIFT) +/* * A counter has overflowed; update its count and record * things if requested. Note that interrupts are hard-disabled
@@ -2297,6 +2301,22 @@ static void record_and_restart(struct perf_event *event, unsigned long val, is_kernel_addr(mfspr(SPRN_SIAR))) record =0 ; +/* +* SIER[46-48] presents instruction type of the sampled instruction. +* In ISA v3.0 and before values "0" and "7" are considered reserved. +* In ISA v3.1, value "7" has been used to indicate "larx/stcx". +* Drop the sample if "type" has reserved values for this field with a +* ISA version check. +*/ +if (event->attr.sample_type &PERF_SAMPLE_DATA_SRC && + ppmu->get_mem_data_src) { + val = (regs->dar &SIER_TYPE_MASK ) >>SIER_TYPE_SHIFT ; +if (val ==0 || (val ==7 && !cpu_has_feature (CPU_FTR_ARCH_31 ))) { + record =0 ; +atomic64_inc (&event->lost_samples); + } + } +/* * Finally record data if requested. */
arch/powerpc/perf/isa207-common.c +3 -1
@@ -321,8 +321,10 @@ void isa207_get_mem_data_src(union perf_mem_data_src *dsrc, u32 flags, sier =mfspr (SPRN_SIER ); val = (sier &ISA207_SIER_TYPE_MASK ) >>ISA207_SIER_TYPE_SHIFT ; -if (val !=1 && val !=2 && !(val ==7 &&cpu_has_feature (CPU_FTR_ARCH_31 ))) +if (val !=1 && val !=2 && !(val ==7 &&cpu_has_feature (CPU_FTR_ARCH_31 ))) { + dsrc->val =0 ;return ; + } idx = (sier &ISA207_SIER_LDST_MASK ) >>ISA207_SIER_LDST_SHIFT ; sub_idx = (sier &ISA207_SIER_DATA_SRC_MASK ) >>ISA207_SIER_DATA_SRC_SHIFT ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 189/325 ip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure().
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 5a1ccffd30a08f5a2428cd5fbb3ab03e8eb6c66d ]
The following patch will not set skb->sk from VRF path.
Let's fetch net from fib_rule->fr_net instead of sock_net(skb->sk) in fib[46]_rule_configure().
--- net/ipv4/fib_rules.c | 4 ++-- net/ipv6/fib6_rules.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
net/ipv4/fib_rules.c +2 -2
@@ -222,9 +222,9 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,struct nlattr **tb, struct netlink_ext_ack *extack) { - struct net *net = sock_net(skb->sk); + struct fib4_rule *rule4 = (struct fib4_rule *)rule; +struct net *net = rule->fr_net;int err = -EINVAL ; -struct fib4_rule *rule4 = (struct fib4_rule *) rule;if (!inet_validate_dscp (frh->tos)) { NL_SET_ERR_MSG(extack,
net/ipv6/fib6_rules.c +2 -2
@@ -350,9 +350,9 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,struct nlattr **tb, struct netlink_ext_ack *extack) { + struct fib6_rule *rule6 = (struct fib6_rule *)rule; +struct net *net = rule->fr_net;int err = -EINVAL ; -struct net *net =sock_net (skb->sk); -struct fib6_rule *rule6 = (struct fib6_rule *) rule;if (!inet_validate_dscp (frh->tos)) { NL_SET_ERR_MSG(extack,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 190/325 r8152: add vendor/device ID pair for Dell Alienware AW1022z
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksander Jan Bajkowski <[email protected]>
[ Upstream commit 848b09d53d923b4caee5491f57a5c5b22d81febc ]
The Dell AW1022z is an RTL8156B based 2.5G Ethernet controller.
Add the vendor and product ID values to the driver. This makes Ethernet work with the adapter.
--- drivers/net/usb/r8152.c | 1 + include/linux/usb/r8152.h | 1 + 2 files changed, 2 insertions(+)
drivers/net/usb/r8152.c +1 -0
@@ -9880,6 +9880,7 @@ static const struct usb_device_id rtl8152_table[] = { { USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff) }, { USB_DEVICE(VENDOR_ID_TPLINK, 0x0601) }, { USB_DEVICE(VENDOR_ID_DLINK, 0xb301) }, + { USB_DEVICE(VENDOR_ID_DELL, 0xb097) }, { USB_DEVICE(VENDOR_ID_ASUS, 0x1976) }, {} };
include/linux/usb/r8152.h +1 -0
@@ -30,6 +30,7 @@#define VENDOR_ID_NVIDIA 0x0955#define VENDOR_ID_TPLINK 0x2357#define VENDOR_ID_DLINK 0x2001 +#define VENDOR_ID_DELL 0x413c#define VENDOR_ID_ASUS 0x0b05#if IS_REACHABLE (CONFIG_USB_RTL8152 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 191/325 wifi: rtw88: Fix download_firmware_validate() for RTL8814AU
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <[email protected]>
[ Upstream commit 9e8243025cc06abc975c876dffda052073207ab3 ]
After the firmware is uploaded, download_firmware_validate() checks some bits in REG_MCUFW_CTRL to see if everything went okay. The RTL8814AU power on sequence sets bits 13 and 12 to 2, which this function does not expect, so it thinks the firmware upload failed.
Make download_firmware_validate() ignore bits 13 and 12.
--- drivers/net/wireless/realtek/rtw88/reg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/reg.h +2 -1
@@ -107,6 +107,7 @@#define BIT_SHIFT_ROM_PGE 16#define BIT_FW_INIT_RDY BIT(15)#define BIT_FW_DW_RDY BIT(14) +#define BIT_CPU_CLK_SEL (BIT(12) | BIT(13))#define BIT_RPWM_TOGGLE BIT(7)#define BIT_RAM_DL_SEL BIT(7)/* legacy only */ #define BIT_DMEM_CHKSUM_OK BIT(6)
@@ -124,7 +125,7 @@ BIT_CHECK_SUM_OK)#define FW_READY_LEGACY (BIT_MCUFWDL_RDY | BIT_FWDL_CHK_RPT | \ BIT_WINTINI_RDY | BIT_RAM_DL_SEL) -#define FW_READY_MASK 0xffff +#define FW_READY_MASK (0xffff & ~BIT_CPU_CLK_SEL)#define REG_MCU_TST_CFG 0x84#define VAL_FW_TRIGGER 0x1
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 192/325 clk: qcom: camcc-sm8250: Use clk_rcg2_shared_ops for some RCGs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jordan Crouse <[email protected]>
[ Upstream commit 52b10b591f83dc6d9a1d6c2dc89433470a787ecd ]
Update some RCGs on the sm8250 camera clock controller to use clk_rcg2_shared_ops. The shared_ops ensure the RCGs get parked to the XO during clock disable to prevent the clocks from locking up when the GDSC is enabled. These mirror similar fixes for other controllers such as commit e5c359f70e4b ("clk: qcom: camcc: Update the clock ops for the SC7180").
--- drivers/clk/qcom/camcc-sm8250.c | 56 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-)
drivers/clk/qcom/camcc-sm8250.c +28 -28
@@ -411,7 +411,7 @@ static struct clk_rcg2 cam_cc_bps_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -433,7 +433,7 @@ static struct clk_rcg2 cam_cc_camnoc_axi_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -454,7 +454,7 @@ static struct clk_rcg2 cam_cc_cci_0_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -469,7 +469,7 @@ static struct clk_rcg2 cam_cc_cci_1_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -490,7 +490,7 @@ static struct clk_rcg2 cam_cc_cphy_rx_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -511,7 +511,7 @@ static struct clk_rcg2 cam_cc_csi0phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -526,7 +526,7 @@ static struct clk_rcg2 cam_cc_csi1phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -556,7 +556,7 @@ static struct clk_rcg2 cam_cc_csi3phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -571,7 +571,7 @@ static struct clk_rcg2 cam_cc_csi4phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -586,7 +586,7 @@ static struct clk_rcg2 cam_cc_csi5phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -611,7 +611,7 @@ static struct clk_rcg2 cam_cc_fast_ahb_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -634,7 +634,7 @@ static struct clk_rcg2 cam_cc_fd_core_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -649,7 +649,7 @@ static struct clk_rcg2 cam_cc_icp_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -673,7 +673,7 @@ static struct clk_rcg2 cam_cc_ife_0_clk_src = { .parent_data = cam_cc_parent_data_2, .num_parents = ARRAY_SIZE(cam_cc_parent_data_2), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -710,7 +710,7 @@ static struct clk_rcg2 cam_cc_ife_0_csid_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -734,7 +734,7 @@ static struct clk_rcg2 cam_cc_ife_1_clk_src = { .parent_data = cam_cc_parent_data_3, .num_parents = ARRAY_SIZE(cam_cc_parent_data_3), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -749,7 +749,7 @@ static struct clk_rcg2 cam_cc_ife_1_csid_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -771,7 +771,7 @@ static struct clk_rcg2 cam_cc_ife_lite_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -786,7 +786,7 @@ static struct clk_rcg2 cam_cc_ife_lite_csid_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -810,7 +810,7 @@ static struct clk_rcg2 cam_cc_ipe_0_clk_src = { .parent_data = cam_cc_parent_data_4, .num_parents = ARRAY_SIZE(cam_cc_parent_data_4), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -825,7 +825,7 @@ static struct clk_rcg2 cam_cc_jpeg_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -847,7 +847,7 @@ static struct clk_rcg2 cam_cc_mclk0_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -862,7 +862,7 @@ static struct clk_rcg2 cam_cc_mclk1_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -877,7 +877,7 @@ static struct clk_rcg2 cam_cc_mclk2_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -892,7 +892,7 @@ static struct clk_rcg2 cam_cc_mclk3_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -907,7 +907,7 @@ static struct clk_rcg2 cam_cc_mclk4_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -922,7 +922,7 @@ static struct clk_rcg2 cam_cc_mclk5_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -993,7 +993,7 @@ static struct clk_rcg2 cam_cc_slow_ahb_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 193/325 hwmon: (xgene-hwmon) use appropriate type for the latency value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Vatoropin <[email protected]>
[ Upstream commit 8df0f002827e18632dcd986f7546c1abf1953a6f ]
The expression PCC_NUM_RETRIES * pcc_chan->latency is currently being evaluated using 32-bit arithmetic.
Since a value of type 'u64' is used to store the eventual result, and this result is later sent to the function usecs_to_jiffies with input parameter unsigned int, the current data type is too wide to store the value of ctx->usecs_lat.
Change the data type of "usecs_lat" to a more suitable (narrower) type.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/hwmon/xgene-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/xgene-hwmon.c +1 -1
@@ -111,7 +111,7 @@ struct xgene_hwmon_dev {phys_addr_t comm_base_addr;void *pcc_comm_addr; -u64 usecs_lat; +unsigned int usecs_lat; };/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 194/325 media: qcom: camss: csid: Only add TPG v4l2 ctrl if TPG hardware is available
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Depeng Shao <[email protected]>
[ Upstream commit 2f1361f862a68063f37362f1beb400e78e289581 ]
There is no CSID TPG on some SoCs, so the v4l2 ctrl in CSID driver shouldn't be registered. Checking the supported TPG modes to indicate if the TPG hardware exists or not and only registering v4l2 ctrl for CSID only when the TPG hardware is present.
--- .../media/platform/qcom/camss/camss-csid.c | 60 +++++++++++-------- 1 file changed, 35 insertions(+), 25 deletions(-)
drivers/media/platform/qcom/camss/camss-csid.c +35 -25
@@ -239,11 +239,13 @@ static int csid_set_stream(struct v4l2_subdev *sd, int enable)int ret;if (enable) { - ret =v4l2_ctrl_handler_setup (&csid->ctrls); -if (ret <0 ) { -dev_err (csid->camss->dev, -"could not sync v4l2 controls: %d\n" , ret); -return ret; +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED ) { + ret =v4l2_ctrl_handler_setup (&csid->ctrls); +if (ret <0 ) { +dev_err (csid->camss->dev, +"could not sync v4l2 controls: %d\n" , ret); +return ret; + } } if (!csid->testgen.enabled &&
@@ -318,7 +320,8 @@ static void csid_try_format(struct csid_device *csid,break ;case MSM_CSID_PAD_SRC : -if (csid->testgen_mode->cur.val ==0 ) { +if (csid->testgen.nmodes ==CSID_PAYLOAD_MODE_DISABLED || + csid->testgen_mode->cur.val ==0 ) {/* Test generator is disabled, */ /* keep pad formats in sync */ u32 code = fmt->code;
@@ -368,7 +371,8 @@ static int csid_enum_mbus_code(struct v4l2_subdev *sd, code->code = csid->formats[code->index].code; }else { -if (csid->testgen_mode->cur.val ==0 ) { +if (csid->testgen.nmodes ==CSID_PAYLOAD_MODE_DISABLED || + csid->testgen_mode->cur.val ==0 ) {struct v4l2_mbus_framefmt *sink_fmt; sink_fmt = __csid_get_format(csid, sd_state,
@@ -750,7 +754,8 @@ static int csid_link_setup(struct media_entity *entity,/* If test generator is enabled */ /* do not allow a link from CSIPHY to CSID */ -if (csid->testgen_mode->cur.val !=0 ) +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED && + csid->testgen_mode->cur.val !=0 )return -EBUSY ; sd =media_entity_to_v4l2_subdev (remote->entity);
@@ -843,24 +848,27 @@ int msm_csid_register_entity(struct csid_device *csid, MSM_CSID_NAME, csid->id);v4l2_set_subdevdata (sd, csid); - ret =v4l2_ctrl_handler_init (&csid->ctrls,1 ); -if (ret <0 ) { -dev_err (dev,"Failed to init ctrl handler: %d\n" , ret); -return ret; - } +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED ) { + ret =v4l2_ctrl_handler_init (&csid->ctrls,1 ); +if (ret <0 ) { +dev_err (dev,"Failed to init ctrl handler: %d\n" , ret); +return ret; + } - csid->testgen_mode =v4l2_ctrl_new_std_menu_items (&csid->ctrls, - &csid_ctrl_ops,V4L2_CID_TEST_PATTERN , - csid->testgen.nmodes,0 ,0 , - csid->testgen.modes); + csid->testgen_mode = +v4l2_ctrl_new_std_menu_items (&csid->ctrls, + &csid_ctrl_ops,V4L2_CID_TEST_PATTERN , + csid->testgen.nmodes,0 ,0 , + csid->testgen.modes); -if (csid->ctrls.error) { -dev_err (dev,"Failed to init ctrl: %d\n" , csid->ctrls.error); - ret = csid->ctrls.error; - goto free_ctrl; - } +if (csid->ctrls.error) { +dev_err (dev,"Failed to init ctrl: %d\n" , csid->ctrls.error); + ret = csid->ctrls.error; + goto free_ctrl; + } - csid->subdev.ctrl_handler = &csid->ctrls; + csid->subdev.ctrl_handler = &csid->ctrls; + } ret =csid_init_formats (sd,NULL );if (ret <0 ) {
@@ -891,7 +899,8 @@ int msm_csid_register_entity(struct csid_device *csid, media_cleanup:media_entity_cleanup (&sd->entity); free_ctrl: -v4l2_ctrl_handler_free (&csid->ctrls); +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED ) +v4l2_ctrl_handler_free (&csid->ctrls);return ret; }
@@ -904,5 +913,6 @@ void msm_csid_unregister_entity(struct csid_device *csid) {v4l2_device_unregister_subdev (&csid->subdev);media_entity_cleanup (&csid->subdev.entity); -v4l2_ctrl_handler_free (&csid->ctrls); +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED ) +v4l2_ctrl_handler_free (&csid->ctrls); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 195/325 vxlan: Annotate FDB data races
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit f6205f8215f12a96518ac9469ff76294ae7bd612 ]
The 'used' and 'updated' fields in the FDB entry structure can be accessed concurrently by multiple threads, leading to reports such as [1]. Can be reproduced using [2].
Suppress these reports by annotating these accesses using READ_ONCE() / WRITE_ONCE().
[1]
BUG: KCSAN: data-race in vxlan_xmit / vxlan_xmit
write to 0xffff942604d263a8 of 8 bytes by task 286 on cpu 0:
vxlan_xmit+0xb29/0x2380 dev_hard_start_xmit+0x84/0x2f0 __dev_queue_xmit+0x45a/0x1650 packet_xmit+0x100/0x150 packet_sendmsg+0x2114/0x2ac0 __sys_sendto+0x318/0x330 __x64_sys_sendto+0x76/0x90 x64_sys_call+0x14e8/0x1c00 do_syscall_64+0x9e/0x1a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
read to 0xffff942604d263a8 of 8 bytes by task 287 on cpu 2:
vxlan_xmit+0xadf/0x2380 dev_hard_start_xmit+0x84/0x2f0 __dev_queue_xmit+0x45a/0x1650 packet_xmit+0x100/0x150 packet_sendmsg+0x2114/0x2ac0 __sys_sendto+0x318/0x330 __x64_sys_sendto+0x76/0x90 x64_sys_call+0x14e8/0x1c00 do_syscall_64+0x9e/0x1a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
value changed: 0x00000000fffbac6e -> 0x00000000fffbac6f
Reported by Kernel Concurrency Sanitizer on:
CPU: 2 UID: 0 PID: 287 Comm: mausezahn Not tainted 6.13.0-rc7-01544-gb4b270f11a02 #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/01/2014
[2]
#!/bin/bash
set +H
echo whitelist > /sys/kernel/debug/kcsan
echo !vxlan_xmit > /sys/kernel/debug/kcsan
ip link add name vx0 up type vxlan id 10010 dstport 4789 local 192.0.2.1 bridge fdb add 00:11:22:33:44:55 dev vx0 self static dst 198.51.100.1 taskset -c 0 mausezahn vx0 -a own -b 00:11:22:33:44:55 -c 0 -q & taskset -c 2 mausezahn vx0 -a own -b 00:11:22:33:44:55 -c 0 -q &
--- drivers/net/vxlan/vxlan_core.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/vxlan/vxlan_core.c +9 -9
@@ -274,9 +274,9 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan, be32_to_cpu(fdb->vni))) goto nla_put_failure; - ci.ndm_used =jiffies_to_clock_t (now - fdb->used); + ci.ndm_used =jiffies_to_clock_t (now -READ_ONCE (fdb->used)); ci.ndm_confirmed =0 ; - ci.ndm_updated =jiffies_to_clock_t (now - fdb->updated); + ci.ndm_updated =jiffies_to_clock_t (now -READ_ONCE (fdb->updated)); ci.ndm_refcnt =0 ;if (nla_put (skb,NDA_CACHEINFO ,sizeof (ci), &ci))
@@ -482,8 +482,8 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,struct vxlan_fdb *f; f =__vxlan_find_mac (vxlan, mac, vni); -if (f && f->used != jiffies) - f->used = jiffies; +if (f &&READ_ONCE (f->used) != jiffies) +WRITE_ONCE (f->used, jiffies);return f; }
@@ -1057,12 +1057,12 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan, !(f->flags & NTF_VXLAN_ADDED_BY_USER)) {if (f->state != state) { f->state = state; - f->updated = jiffies; +WRITE_ONCE (f->updated, jiffies); notify =1 ; }if (f->flags != fdb_flags) { f->flags = fdb_flags; - f->updated = jiffies; +WRITE_ONCE (f->updated, jiffies); notify =1 ; } }
@@ -1096,7 +1096,7 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan, }if (ndm_flags &NTF_USE ) - f->used = jiffies; +WRITE_ONCE (f->used, jiffies);if (notify) {if (rd ==NULL )
@@ -1525,7 +1525,7 @@ static bool vxlan_snoop(struct net_device *dev, src_mac, &rdst->remote_ip.sa, &src_ip->sa); rdst->remote_ip = *src_ip; - f->updated = jiffies; +WRITE_ONCE (f->updated, jiffies);vxlan_fdb_notify (vxlan, f, rdst,RTM_NEWNEIGH , true,NULL ); }else {u32 hash_index =fdb_head_index (vxlan, src_mac, vni);
@@ -2936,7 +2936,7 @@ static void vxlan_cleanup(struct timer_list *t)if (f->flags &NTF_EXT_LEARNED )continue ; - timeout = f->used + vxlan->cfg.age_interval *HZ ; + timeout =READ_ONCE (f->used) + vxlan->cfg.age_interval *HZ ;if (time_before_eq (timeout, jiffies)) { netdev_dbg(vxlan->dev, "garbage collect %pM\n",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 196/325 r8169: dont scan PHY addresses > 0
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiner Kallweit <[email protected]>
[ Upstream commit faac69a4ae5abb49e62c79c66b51bb905c9aa5ec ]
The PHY address is a dummy, because r8169 PHY access registers don't support a PHY address. Therefore scan address 0 only.
--- drivers/net/ethernet/realtek/r8169_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/realtek/r8169_main.c +1 -0
@@ -5156,6 +5156,7 @@ static int r8169_mdio_register(struct rtl8169_private *tp) new_bus->priv = tp; new_bus->parent = &pdev->dev; new_bus->irq[0 ] =PHY_MAC_INTERRUPT ; + new_bus->phy_mask =GENMASK (31 ,1 );snprintf (new_bus->id,MII_BUS_ID_SIZE ,"r8169-%x-%x" ,pci_domain_nr (pdev->bus),pci_dev_id (pdev));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 197/325 rcu: handle quiescent states for PREEMPT_RCU=n, PREEMPT_COUNT=y
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ankur Arora <[email protected]>
[ Upstream commit 83b28cfe796464ebbde1cf7916c126da6d572685 ]
With PREEMPT_RCU=n, cond_resched() provides urgently needed quiescent states for read-side critical sections via rcu_all_qs(). One reason why this was needed: lacking preempt-count, the tick handler has no way of knowing whether it is executing in a read-side critical section or not.
With (PREEMPT_LAZY=y, PREEMPT_DYNAMIC=n), we get (PREEMPT_COUNT=y, PREEMPT_RCU=n). In this configuration cond_resched() is a stub and does not provide quiescent states via rcu_all_qs(). (PREEMPT_RCU=y provides this information via rcu_read_unlock() and its nesting counter.)
So, use the availability of preempt_count() to report quiescent states in rcu_flavor_sched_clock_irq().
--- kernel/rcu/tree_plugin.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
kernel/rcu/tree_plugin.h +7 -4
@@ -963,13 +963,16 @@ static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp)*/ static void rcu_flavor_sched_clock_irq (int user) { -if (user ||rcu_is_cpu_rrupt_from_idle ()) { +if (user ||rcu_is_cpu_rrupt_from_idle () || + (IS_ENABLED (CONFIG_PREEMPT_COUNT ) && + (preempt_count () ==HARDIRQ_OFFSET ))) {/* * Get here if this CPU took its interrupt from user -* mode or from the idle loop, and if this is not a -* nested interrupt. In this case, the CPU is in -* a quiescent state, so note it. +* mode, from the idle loop without this being a nested +* interrupt, or while not holding the task preempt count +* (with PREEMPT_COUNT=y). In this case, the CPU is in a +* quiescent state, so note it. * * No memory barrier is required here because rcu_qs() * references only CPU-local variables that other CPUs
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 198/325 rcu: handle unstable rdp in rcu_read_unlock_strict()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ankur Arora <[email protected]>
[ Upstream commit fcf0e25ad4c8d14d2faab4d9a17040f31efce205 ]
rcu_read_unlock_strict() can be called with preemption enabled which can make for an unstable rdp and a racy norm value.
Fix this by dropping the preempt-count in __rcu_read_unlock() after the call to rcu_read_unlock_strict(), adjusting the preempt-count check appropriately.
--- include/linux/rcupdate.h | 2 +- kernel/rcu/tree_plugin.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-)
include/linux/rcupdate.h +1 -1
@@ -97,9 +97,9 @@ static inline void __rcu_read_lock(void)static inline void __rcu_read_unlock (void ) { -preempt_enable ();if (IS_ENABLED (CONFIG_RCU_STRICT_GRACE_PERIOD ))rcu_read_unlock_strict (); +preempt_enable (); }static inline int rcu_preempt_depth (void )
kernel/rcu/tree_plugin.h +10 -1
@@ -821,8 +821,17 @@ void rcu_read_unlock_strict(void) {struct rcu_data *rdp; -if (irqs_disabled () ||preempt_count () || !rcu_state.gp_kthread) +if (irqs_disabled () ||in_atomic_preempt_off () || !rcu_state.gp_kthread)return ; + +/* +* rcu_report_qs_rdp() can only be invoked with a stable rdp and +* from the local CPU. +* +* The in_atomic_preempt_off() check ensures that we come here holding +* the last preempt_count (which will get dropped once we return to +* __rcu_read_unlock(). +*/ rdp =this_cpu_ptr (&rcu_data); rdp->cpu_no_qs.b.norm = false;rcu_report_qs_rdp (rdp);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 199/325 rcu: fix header guard for rcu_all_qs()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ankur Arora <[email protected]>
[ Upstream commit ad6b5b73ff565e88aca7a7d1286788d80c97ba71 ]
rcu_all_qs() is defined for !CONFIG_PREEMPT_RCU but the declaration is conditioned on CONFIG_PREEMPTION.
With CONFIG_PREEMPT_LAZY, CONFIG_PREEMPTION=y does not imply CONFIG_PREEMPT_RCU=y.
Decouple the two.
--- include/linux/rcutree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcutree.h +1 -1
@@ -105,7 +105,7 @@ extern int rcu_scheduler_active;void rcu_end_inkernel_boot (void );bool rcu_inkernel_boot_has_ended (void );bool rcu_is_watching (void ); -#ifndef CONFIG_PREEMPTION +#ifndef CONFIG_PREEMPT_RCU void rcu_all_qs (void );#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 200/325 perf: Avoid the read if the count is already updated
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra (Intel) <[email protected]>
[ Upstream commit 8ce939a0fa194939cc1f92dbd8bc1a7806e7d40a ]
The event may have been updated in the PMU-specific implementation, e.g., Intel PEBS counters snapshotting. The common code should not read and overwrite the value.
The PERF_SAMPLE_READ in the data->sample_type can be used to detect whether the PMU-specific value is available. If yes, avoid the pmu->read() in the common code. Add a new flag, skip_read, to track the case.
Factor out a perf_pmu_read() to clean up the code.
--- include/linux/perf_event.h | 8 +++++++- kernel/events/core.c | 33 ++++++++++++++++----------------- kernel/events/ring_buffer.c | 1 + 3 files changed, 24 insertions(+), 18 deletions(-)
include/linux/perf_event.h +7 -1
@@ -935,7 +935,13 @@ struct perf_output_handle {struct perf_buffer *rb;unsigned long wakeup;unsigned long size; -u64 aux_flags; +union { +u64 flags;/* perf_output*() */ +u64 aux_flags;/* perf_aux_output*() */ +struct { +u64 skip_read :1 ; + }; + };union {void *addr;unsigned long head;
kernel/events/core.c +16 -17
@@ -1180,6 +1180,12 @@ static void perf_event_ctx_deactivate(struct perf_event_context *ctx)list_del_init (&ctx->active_ctx_list); } +static inline void perf_pmu_read (struct perf_event *event) +{ +if (event->state ==PERF_EVENT_STATE_ACTIVE ) + event->pmu->read (event); +} +static void get_ctx (struct perf_event_context *ctx) {refcount_inc (&ctx->refcount);
@@ -3389,8 +3395,7 @@ static void __perf_event_sync_stat(struct perf_event *event,* we know the event must be on the current CPU, therefore we * don't need to use it. */ -if (event->state ==PERF_EVENT_STATE_ACTIVE ) - event->pmu->read (event); +perf_pmu_read (event);perf_event_update_time (event);
@@ -4444,15 +4449,8 @@ static void __perf_event_read(void *info) pmu->read (event); -for_each_sibling_event (sub, event) { -if (sub->state ==PERF_EVENT_STATE_ACTIVE ) { -/* -* Use sibling's PMU rather than @event's since -* sibling could be on different (eg: software) PMU. -*/ - sub->pmu->read (sub); - } - } +for_each_sibling_event (sub, event) +perf_pmu_read (sub); data->ret = pmu->commit_txn (pmu);
@@ -7101,9 +7099,8 @@ static void perf_output_read_group(struct perf_output_handle *handle,if (read_format &PERF_FORMAT_TOTAL_TIME_RUNNING ) values[n++] = running; -if ((leader != event) && - (leader->state ==PERF_EVENT_STATE_ACTIVE )) - leader->pmu->read (leader); +if ((leader != event) && !handle->skip_read) +perf_pmu_read (leader); values[n++] =perf_event_count (leader);if (read_format &PERF_FORMAT_ID )
@@ -7116,9 +7113,8 @@ static void perf_output_read_group(struct perf_output_handle *handle,for_each_sibling_event (sub, leader) { n =0 ; -if ((sub != event) && - (sub->state ==PERF_EVENT_STATE_ACTIVE )) - sub->pmu->read (sub); +if ((sub != event) && !handle->skip_read) +perf_pmu_read (sub); values[n++] =perf_event_count (sub);if (read_format &PERF_FORMAT_ID )
@@ -7173,6 +7169,9 @@ void perf_output_sample(struct perf_output_handle *handle, {u64 sample_type = data->type; +if (data->sample_flags &PERF_SAMPLE_READ ) + handle->skip_read =1 ; +perf_output_put (handle, *header);if (sample_type &PERF_SAMPLE_IDENTIFIER )
kernel/events/ring_buffer.c +1 -0
@@ -181,6 +181,7 @@ __perf_output_begin(struct perf_output_handle *handle, handle->rb = rb; handle->event = event; + handle->flags =0 ; have_lost =local_read (&rb->lost);if (unlikely (have_lost)) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 201/325 ice: count combined queues using Rx/Tx count
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Swiatkowski <[email protected]>
[ Upstream commit c3a392bdd31adc474f1009ee85c13fdd01fe800d ]
Previous implementation assumes that there is 1:1 matching between vectors and queues. It isn't always true.
Get minimum value from Rx/Tx queues to determine combined queues number.
--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +1 -2
@@ -3373,8 +3373,7 @@ static u32 ice_get_combined_cnt(struct ice_vsi *vsi)ice_for_each_q_vector (vsi, q_idx) {struct ice_q_vector *q_vector = vsi->q_vectors[q_idx]; -if (q_vector->rx.rx_ring && q_vector->tx.tx_ring) - combined++; + combined +=min (q_vector->num_ring_tx, q_vector->num_ring_rx); }return combined;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 202/325 net/mana: fix warning in the writer of client oob
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Taranov <[email protected]>
[ Upstream commit 5ec7e1c86c441c46a374577bccd9488abea30037 ]
Do not warn on missing pad_data when oob is in sgl.
--- drivers/net/ethernet/microsoft/mana/gdma_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/microsoft/mana/gdma_main.c +1 -1
@@ -995,7 +995,7 @@ static u32 mana_gd_write_client_oob(const struct gdma_wqe_request *wqe_req, header->inline_oob_size_div4 = client_oob_size /sizeof (u32);if (oob_in_sgl) { -WARN_ON_ONCE (!pad_data || wqe_req->num_sge <2 ); +WARN_ON_ONCE (wqe_req->num_sge <2 ); header->client_oob_in_sgl =1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 203/325 scsi: lpfc: Handle duplicate D_IDs in ndlp search-by D_ID routine
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Tee <[email protected]>
[ Upstream commit 56c3d809b7b450379162d0b8a70bbe71ab8db706 ]
After a port swap between separate fabrics, there may be multiple nodes in the vport's fc_nodes list with the same fabric well known address. Duplication is temporary and eventually resolves itself after dev_loss_tmo expires, but nameserver queries may still occur before dev_loss_tmo. This possibly results in returning stale fabric ndlp objects. Fix by adding an nlp_state check to ensure the ndlp search routine returns the correct newer allocated ndlp fabric object.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +12 -5
@@ -5619,6 +5619,7 @@ static struct lpfc_nodelist * __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) {struct lpfc_nodelist *ndlp; +struct lpfc_nodelist *np =NULL ;uint32_t data1;list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) {
@@ -5633,14 +5634,20 @@ __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) ndlp, ndlp->nlp_DID, ndlp->nlp_flag, data1, ndlp->nlp_rpi, ndlp->active_rrqs_xri_bitmap); -return ndlp; + +/* Check for new or potentially stale node */ +if (ndlp->nlp_state !=NLP_STE_UNUSED_NODE ) +return ndlp; + np = ndlp; } } -/* FIND node did <did> NOT FOUND */ -lpfc_printf_vlog (vport,KERN_INFO ,LOG_NODE , -"0932 FIND node did x%x NOT FOUND.\n" , did); -return NULL ; +if (!np) +/* FIND node did <did> NOT FOUND */ +lpfc_printf_vlog (vport,KERN_INFO ,LOG_NODE , +"0932 FIND node did x%x NOT FOUND.\n" , did); + +return np; } struct lpfc_nodelist *
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 204/325 scsi: lpfc: Free phba irq in lpfc_sli4_enable_msi() when pci_irq_vector() fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Tee <[email protected]>
[ Upstream commit f0842902b383982d1f72c490996aa8fc29a7aa0d ]
Fix smatch warning regarding missed calls to free_irq(). Free the phba IRQ in the failed pci_irq_vector cases.
lpfc_init.c: lpfc_sli4_enable_msi() warn: 'phba->pcidev->irq' from
request_irq() not released.
--- drivers/scsi/lpfc/lpfc_init.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/lpfc/lpfc_init.c +2 -0
@@ -13204,6 +13204,7 @@ lpfc_sli4_enable_msi(struct lpfc_hba *phba) eqhdl =lpfc_get_eq_hdl (0 ); rc =pci_irq_vector (phba->pcidev,0 );if (rc <0 ) { +free_irq (phba->pcidev->irq, phba);pci_free_irq_vectors (phba->pcidev);lpfc_printf_log (phba,KERN_WARNING ,LOG_INIT ,"0496 MSI pci_irq_vec failed (%d)\n" , rc);
@@ -13284,6 +13285,7 @@ lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) eqhdl =lpfc_get_eq_hdl (0 ); retval =pci_irq_vector (phba->pcidev,0 );if (retval <0 ) { +free_irq (phba->pcidev->irq, phba);lpfc_printf_log (phba,KERN_WARNING ,LOG_INIT ,"0502 INTR pci_irq_vec failed (%d)\n" , retval);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 205/325 scsi: st: Restore some drive settings after reset
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Mäkisara <[email protected]>
[ Upstream commit 7081dc75df79696d8322d01821c28e53416c932c ]
Some of the allowed operations put the tape into a known position to continue operation assuming only the tape position has changed. But reset sets partition, density and block size to drive default values. These should be restored to the values before reset.
Normally the current block size and density are stored by the drive. If the settings have been changed, the changed values have to be saved by the driver across reset.
--- drivers/scsi/st.c | 24 +++++++++++++++++++++--- drivers/scsi/st.h | 2 ++ 2 files changed, 23 insertions(+), 3 deletions(-)
drivers/scsi/st.c +21 -3
@@ -950,7 +950,6 @@ static void reset_state(struct scsi_tape *STp) STp->partition =find_partition (STp);if (STp->partition <0 ) STp->partition =0 ; - STp->new_partition = STp->partition; } }
@@ -2919,14 +2918,17 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lonif (cmd_in ==MTSETDENSITY ) { (STp->buffer)->b_data[4 ] = arg; STp->density_changed =1 ;/* At least we tried ;-) */ + STp->changed_density = arg; }else if (cmd_in ==SET_DENS_AND_BLK ) (STp->buffer)->b_data[4 ] = arg >>24 ;else (STp->buffer)->b_data[4 ] = STp->density;if (cmd_in ==MTSETBLK || cmd_in ==SET_DENS_AND_BLK ) { ltmp = arg &MT_ST_BLKSIZE_MASK ; -if (cmd_in ==MTSETBLK ) +if (cmd_in ==MTSETBLK ) { STp->blksize_changed =1 ;/* At least we tried ;-) */ + STp->changed_blksize = arg; + } }else ltmp = STp->block_size; (STp->buffer)->b_data[9 ] = (ltmp >>16 );
@@ -3627,9 +3629,25 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) retval = (-EIO ); goto out; } -reset_state (STp); +reset_state (STp);/* Clears pos_unknown */ /* remove this when the midlevel properly clears was_reset */ STp->device->was_reset =0 ; + +/* Fix the device settings after reset, ignore errors */ +if (mtc.mt_op ==MTREW || mtc.mt_op ==MTSEEK || + mtc.mt_op ==MTEOM ) { +if (STp->can_partitions) { +/* STp->new_partition contains the +* latest partition set +*/ + STp->partition =0 ; +switch_partition (STp); + } +if (STp->density_changed) +st_int_ioctl (STp,MTSETDENSITY , STp->changed_density); +if (STp->blksize_changed) +st_int_ioctl (STp,MTSETBLK , STp->changed_blksize); + } } if (mtc.mt_op != MTNOP && mtc.mt_op != MTSETBLK &&
drivers/scsi/st.h +2 -0
@@ -165,12 +165,14 @@ struct scsi_tape {unsigned char compression_changed;unsigned char drv_buffer;unsigned char density; +unsigned char changed_density;unsigned char door_locked;unsigned char autorew_dev;/* auto-rewind device */ unsigned char rew_at_close;/* rewind necessary at close */ unsigned char inited;unsigned char cleaning_req;/* cleaning requested? */ int block_size; +int changed_blksize;int min_block;int max_block;int recover_count;/* From tape opening */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 206/325 HID: usbkbd: Fix the bit shift number for LED_KANA
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: junan <[email protected]>
[ Upstream commit d73a4bfa2881a6859b384b75a414c33d4898b055 ]
Since "LED_KANA" was defined as "0x04", the shift number should be "4".
--- drivers/hid/usbhid/usbkbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/usbhid/usbkbd.c +1 -1
@@ -160,7 +160,7 @@ static int usb_kbd_event(struct input_dev *dev, unsigned int type,return -1 ;spin_lock_irqsave (&kbd->leds_lock, flags); - kbd->newleds = (!!test_bit (LED_KANA , dev->led) <<3 ) | (!!test_bit (LED_COMPOSE , dev->led) <<3 ) | + kbd->newleds = (!!test_bit (LED_KANA , dev->led) <<4 ) | (!!test_bit (LED_COMPOSE , dev->led) <<3 ) | (!!test_bit (LED_SCROLLL , dev->led) <<2 ) | (!!test_bit (LED_CAPSL , dev->led) <<1 ) | (!!test_bit (LED_NUML , dev->led));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 207/325 ASoC: codecs: pcm3168a: Allow for 24-bit in provider mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 7d92a38d67e5d937b64b20aa4fd14451ee1772f3 ]
As per codec device specification, 24-bit is allowed in provider mode. Update the code to reflect that.
--- sound/soc/codecs/pcm3168a.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/pcm3168a.c +3 -3
@@ -494,9 +494,9 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream, }break ;case 24 : -if (provider_mode || (format ==SND_SOC_DAIFMT_DSP_A ) || - (format ==SND_SOC_DAIFMT_DSP_B )) { -dev_err (component->dev,"24-bit slots not supported in provider mode, or consumer mode using DSP\n" ); +if (!provider_mode && ((format ==SND_SOC_DAIFMT_DSP_A ) || + (format ==SND_SOC_DAIFMT_DSP_B ))) { +dev_err (component->dev,"24-bit slots not supported in consumer mode using DSP\n" );return -EINVAL ; }break ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 208/325 drm/ast: Find VBIOS mode from regular display size
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
[ Upstream commit c81202906b5cd56db403e95db3d29c9dfc8c74c1 ]
The ast driver looks up supplied display modes from an internal list of display modes supported by the VBIOS.
Do not use the crtc_-prefixed display values from struct drm_display_mode for looking up the VBIOS mode. The fields contain raw values that the driver programs to hardware. They are affected by display settings like double-scan or interlace.
Instead use the regular vdisplay and hdisplay fields for lookup. As the programmed values can now differ from the values used for lookup, set struct drm_display_mode.crtc_vdisplay and .crtc_hdisplay from the VBIOS mode.
--- drivers/gpu/drm/ast/ast_mode.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +6 -4
@@ -103,7 +103,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format,return false; } -switch (mode->crtc_hdisplay) { +switch (mode->hdisplay) {case 640 : vbios_mode->enh_table = &res_640x480[refresh_rate_index];break ;
@@ -117,7 +117,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, vbios_mode->enh_table = &res_1152x864[refresh_rate_index];break ;case 1280 : -if (mode->crtc_vdisplay ==800 ) +if (mode->vdisplay ==800 ) vbios_mode->enh_table = &res_1280x800[refresh_rate_index];else vbios_mode->enh_table = &res_1280x1024[refresh_rate_index];
@@ -129,7 +129,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, vbios_mode->enh_table = &res_1440x900[refresh_rate_index];break ;case 1600 : -if (mode->crtc_vdisplay ==900 ) +if (mode->vdisplay ==900 ) vbios_mode->enh_table = &res_1600x900[refresh_rate_index];else vbios_mode->enh_table = &res_1600x1200[refresh_rate_index];
@@ -138,7 +138,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, vbios_mode->enh_table = &res_1680x1050[refresh_rate_index];break ;case 1920 : -if (mode->crtc_vdisplay ==1080 ) +if (mode->vdisplay ==1080 ) vbios_mode->enh_table = &res_1920x1080[refresh_rate_index];else vbios_mode->enh_table = &res_1920x1200[refresh_rate_index];
@@ -182,6 +182,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, hborder = (vbios_mode->enh_table->flags & HBorder) ?8 :0 ; vborder = (vbios_mode->enh_table->flags & VBorder) ?8 :0 ; + adjusted_mode->crtc_hdisplay = vbios_mode->enh_table->hde; adjusted_mode->crtc_htotal = vbios_mode->enh_table->ht; adjusted_mode->crtc_hblank_start = vbios_mode->enh_table->hde + hborder; adjusted_mode->crtc_hblank_end = vbios_mode->enh_table->ht - hborder;
@@ -191,6 +192,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, vbios_mode->enh_table->hfp + vbios_mode->enh_table->hsync); + adjusted_mode->crtc_vdisplay = vbios_mode->enh_table->vde; adjusted_mode->crtc_vtotal = vbios_mode->enh_table->vt; adjusted_mode->crtc_vblank_start = vbios_mode->enh_table->vde + vborder; adjusted_mode->crtc_vblank_end = vbios_mode->enh_table->vt - vborder;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 209/325 bpftool: Fix readlink usage in get_fd_type
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viktor Malik <[email protected]>
[ Upstream commit 0053f7d39d491b6138d7c526876d13885cbb65f1 ]
The readlink(path, buf, sizeof(buf)) call reads at most sizeof(buf) bytes and *does not* append null-terminator to buf. With respect to that, fix two pieces in get_fd_type:
1. Change the truncation check to contain sizeof(buf) rather than sizeof(path).
2. Append null-terminator to buf.
Reported by Coverity.
--- tools/bpf/bpftool/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/bpf/bpftool/common.c +2 -1
@@ -384,10 +384,11 @@ int get_fd_type(int fd)p_err ("can't read link type: %s" ,strerror (errno));return -1 ; } -if (n ==sizeof (path)) { +if (n ==sizeof (buf)) {p_err ("can't read link type: path too long!" );return -1 ; } + buf[n] ='\0' ;if (strstr (buf,"bpf-map" ))return BPF_OBJ_MAP ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 210/325 perf/amd/ibs: Fix perf_ibs_op.cnt_mask for CurCnt
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ravi Bangoria <[email protected]>
[ Upstream commit 46dcf85566170d4528b842bf83ffc350d71771fa ]
IBS Op uses two counters: MaxCnt and CurCnt. MaxCnt is programmed with the desired sample period. IBS hw generates sample when CurCnt reaches to MaxCnt. The size of these counter used to be 20 bits but later they were extended to 27 bits. The 7 bit extension is indicated by CPUID Fn8000_001B_EAX[6 / OpCntExt].
perf_ibs->cnt_mask variable contains bit masks for MaxCnt and CurCnt. But IBS driver does not set upper 7 bits of CurCnt in cnt_mask even when OpCntExt CPUID bit is set. Fix this.
IBS driver uses cnt_mask[CurCnt] bits only while disabling an event. Fortunately, CurCnt bits are not read from MSR while re-enabling the event, instead MaxCnt is programmed with desired period and CurCnt is set to 0. Hence, we did not see any issues so far.
--- arch/x86/events/amd/ibs.c | 3 ++- arch/x86/include/asm/perf_event.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/events/amd/ibs.c +2 -1
@@ -1216,7 +1216,8 @@ static __init int perf_ibs_op_init(void)if (ibs_caps &IBS_CAPS_OPCNTEXT ) { perf_ibs_op.max_period |=IBS_OP_MAX_CNT_EXT_MASK ; perf_ibs_op.config_mask |=IBS_OP_MAX_CNT_EXT_MASK ; - perf_ibs_op.cnt_mask |=IBS_OP_MAX_CNT_EXT_MASK ; + perf_ibs_op.cnt_mask |= (IBS_OP_MAX_CNT_EXT_MASK | +IBS_OP_CUR_CNT_EXT_MASK ); }if (ibs_caps &IBS_CAPS_ZEN4 )
arch/x86/include/asm/perf_event.h +1 -0
@@ -456,6 +456,7 @@ struct pebs_xmm {*/ #define IBS_OP_CUR_CNT (0xFFF80ULL<<32)#define IBS_OP_CUR_CNT_RAND (0x0007FULL<<32) +#define IBS_OP_CUR_CNT_EXT_MASK (0x7FULL<<52)#define IBS_OP_CNT_CTL (1ULL<<19)#define IBS_OP_VAL (1ULL<<18)#define IBS_OP_ENABLE (1ULL<<17)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 211/325 wifi: rtl8xxxu: retry firmware download on error
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Soeren Moch <[email protected]>
[ Upstream commit 3d3e28feca7ac8c6cf2a390dbbe1f97e3feb7f36 ]
Occasionally there is an EPROTO error during firmware download. This error is converted to EAGAIN in the download function. But nobody tries again and so device probe fails.
Implement download retry to fix this.
This error was observed (and fix tested) on a tbs2910 board [1] with an embedded RTL8188EU (0bda:8179) device behind a USB hub.
[1] arch/arm/boot/dts/nxp/imx/imx6q-tbs2910.dts
--- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +12 -5
@@ -798,9 +798,10 @@ rtl8xxxu_writeN(struct rtl8xxxu_priv *priv, u16 addr, u8 *buf, u16 len)return len; write_error: -dev_info (&udev->dev, -"%s: Failed to write block at addr: %04x size: %04x\n" , - __func__, addr, blocksize); +if (rtl8xxxu_debug &RTL8XXXU_DEBUG_REG_WRITE ) +dev_info (&udev->dev, +"%s: Failed to write block at addr: %04x size: %04x\n" , + __func__, addr, blocksize);return -EAGAIN ; }
@@ -3920,8 +3921,14 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)*/ rtl8xxxu_write16 (priv,REG_TRXFF_BNDY +2 , fops->trxff_boundary); - ret =rtl8xxxu_download_firmware (priv); -dev_dbg (dev,"%s: download_firmware %i\n" , __func__, ret); +for (int retry =5 ; retry >=0 ; retry--) { + ret =rtl8xxxu_download_firmware (priv); +dev_dbg (dev,"%s: download_firmware %i\n" , __func__, ret); +if (ret != -EAGAIN ) +break ; +if (retry) +dev_dbg (dev,"%s: retry firmware download\n" , __func__); + }if (ret) goto exit; ret =rtl8xxxu_start_firmware (priv);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 212/325 wifi: rtw88: Dont use static local variable in rtw8822b_set_tx_power_index_by_rate
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <[email protected]>
[ Upstream commit 00451eb3bec763f708e7e58326468c1e575e5a66 ]
Some users want to plug two identical USB devices at the same time. This static variable could theoretically cause them to use incorrect TX power values.
Move the variable to the caller and pass a pointer to it to rtw8822b_set_tx_power_index_by_rate().
--- drivers/net/wireless/realtek/rtw88/rtw8822b.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/realtek/rtw88/rtw8822b.c +8 -6
@@ -957,11 +957,11 @@ static void rtw8822b_query_rx_desc(struct rtw_dev *rtwdev, u8 *rx_desc, }static void -rtw8822b_set_tx_power_index_by_rate (struct rtw_dev *rtwdev,u8 path,u8 rs) +rtw8822b_set_tx_power_index_by_rate (struct rtw_dev *rtwdev,u8 path, +u8 rs,u32 *phy_pwr_idx) {struct rtw_hal *hal = &rtwdev->hal;static const u32 offset_txagc[2 ] = {0x1d00 ,0x1d80 }; -static u32 phy_pwr_idx;u8 rate, rate_idx, pwr_index, shift;int j;
@@ -969,12 +969,12 @@ rtw8822b_set_tx_power_index_by_rate(struct rtw_dev *rtwdev, u8 path, u8 rs) rate = rtw_rate_section[rs][j]; pwr_index = hal->tx_pwr_tbl[path][rate]; shift = rate &0x3 ; - phy_pwr_idx |= ((u32 )pwr_index << (shift *8 )); + *phy_pwr_idx |= ((u32 )pwr_index << (shift *8 ));if (shift ==0x3 ) { rate_idx = rate &0xfc ;rtw_write32 (rtwdev, offset_txagc[path] + rate_idx, - phy_pwr_idx); - phy_pwr_idx =0 ; + *phy_pwr_idx); + *phy_pwr_idx =0 ; } } }
@@ -982,11 +982,13 @@ rtw8822b_set_tx_power_index_by_rate(struct rtw_dev *rtwdev, u8 path, u8 rs)static void rtw8822b_set_tx_power_index (struct rtw_dev *rtwdev) {struct rtw_hal *hal = &rtwdev->hal; +u32 phy_pwr_idx =0 ;int rs, path;for (path =0 ; path < hal->rf_path_num; path++) {for (rs =0 ; rs <RTW_RATE_SECTION_MAX ; rs++) -rtw8822b_set_tx_power_index_by_rate (rtwdev, path, rs); +rtw8822b_set_tx_power_index_by_rate (rtwdev, path, rs, + &phy_pwr_idx); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 213/325 wifi: rtw89: add wiphy_lock() to work that isnt held wiphy_lock() yet
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ping-Ke Shih <[email protected]>
[ Upstream commit ebfc9199df05d37b67f4d1b7ee997193f3d2e7c8 ]
To ensure where are protected by driver mutex can also be protected by wiphy_lock(), so afterward we can remove driver mutex safely.
--- drivers/net/wireless/realtek/rtw89/regd.c | 2 ++ drivers/net/wireless/realtek/rtw89/ser.c | 4 ++++ 2 files changed, 6 insertions(+)
drivers/net/wireless/realtek/rtw89/regd.c +2 -0
@@ -334,6 +334,7 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *requeststruct ieee80211_hw *hw =wiphy_to_ieee80211_hw (wiphy);struct rtw89_dev *rtwdev = hw->priv; +wiphy_lock (wiphy);mutex_lock (&rtwdev->mutex);rtw89_leave_ps_mode (rtwdev);
@@ -350,4 +351,5 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request exit:mutex_unlock (&rtwdev->mutex); +wiphy_unlock (wiphy); }
drivers/net/wireless/realtek/rtw89/ser.c +4 -0
@@ -153,9 +153,11 @@ static void ser_state_run(struct rtw89_ser *ser, u8 evt)rtw89_debug (rtwdev,RTW89_DBG_SER ,"ser: %s receive %s\n" ,ser_st_name (ser),ser_ev_name (ser, evt)); +wiphy_lock (rtwdev->hw->wiphy);mutex_lock (&rtwdev->mutex);rtw89_leave_lps (rtwdev);mutex_unlock (&rtwdev->mutex); +wiphy_unlock (rtwdev->hw->wiphy); ser->st_tbl[ser->state].st_func (ser, evt); }
@@ -624,9 +626,11 @@ static void ser_l2_reset_st_hdl(struct rtw89_ser *ser, u8 evt)switch (evt) {case SER_EV_STATE_IN : +wiphy_lock (rtwdev->hw->wiphy);mutex_lock (&rtwdev->mutex);ser_l2_reset_st_pre_hdl (ser);mutex_unlock (&rtwdev->mutex); +wiphy_unlock (rtwdev->hw->wiphy);ieee80211_restart_hw (rtwdev->hw);ser_set_alarm (ser,SER_RECFG_TIMEOUT ,SER_EV_L2_RECFG_TIMEOUT );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 214/325 spi: zynqmp-gqspi: Always acknowledge interrupts
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Anderson <[email protected]>
[ Upstream commit 89785306453ce6d949e783f6936821a0b7649ee2 ]
RXEMPTY can cause an IRQ, even though we may not do anything about it (such as if we are waiting for more received data). We must still handle these IRQs because we can tell they were caused by the device.
--- drivers/spi/spi-zynqmp-gqspi.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/spi/spi-zynqmp-gqspi.c +8 -12
@@ -698,7 +698,6 @@ static void zynqmp_process_dma_irq(struct zynqmp_qspi *xqspi)static irqreturn_t zynqmp_qspi_irq (int irq,void *dev_id) {struct zynqmp_qspi *xqspi = (struct zynqmp_qspi *)dev_id; -irqreturn_t ret =IRQ_NONE ;u32 status, mask, dma_status =0 ; status =zynqmp_gqspi_read (xqspi,GQSPI_ISR_OFST );
@@ -713,27 +712,24 @@ static irqreturn_t zynqmp_qspi_irq(int irq, void *dev_id) dma_status); } -if (mask &GQSPI_ISR_TXNOT_FULL_MASK ) { +if (!mask && !dma_status) +return IRQ_NONE ; + +if (mask &GQSPI_ISR_TXNOT_FULL_MASK )zynqmp_qspi_filltxfifo (xqspi,GQSPI_TX_FIFO_FILL ); - ret =IRQ_HANDLED ; - } -if (dma_status &GQSPI_QSPIDMA_DST_I_STS_DONE_MASK ) { +if (dma_status &GQSPI_QSPIDMA_DST_I_STS_DONE_MASK )zynqmp_process_dma_irq (xqspi); - ret =IRQ_HANDLED ; - }else if (!(mask &GQSPI_IER_RXEMPTY_MASK ) && - (mask &GQSPI_IER_GENFIFOEMPTY_MASK )) { +else if (!(mask &GQSPI_IER_RXEMPTY_MASK ) && + (mask &GQSPI_IER_GENFIFOEMPTY_MASK ))zynqmp_qspi_readrxfifo (xqspi,GQSPI_RX_FIFO_FILL ); - ret =IRQ_HANDLED ; - }if (xqspi->bytes_to_receive ==0 && xqspi->bytes_to_transfer ==0 && ((status &GQSPI_IRQ_MASK ) ==GQSPI_IRQ_MASK )) {zynqmp_gqspi_write (xqspi,GQSPI_IDR_OFST ,GQSPI_ISR_IDR_MASK );complete (&xqspi->data_completion); - ret =IRQ_HANDLED ; } -return ret; +return IRQ_HANDLED ; }/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 215/325 regulator: ad5398: Add device tree support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Isaac Scott <[email protected]>
[ Upstream commit 5a6a461079decea452fdcae955bccecf92e07e97 ]
Previously, the ad5398 driver used only platform_data, which is deprecated in favour of device tree. This caused the AD5398 to fail to probe as it could not load its init_data. If the AD5398 has a device tree node, pull the init_data from there using of_get_regulator_init_data.
--- drivers/regulator/ad5398.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/regulator/ad5398.c +9 -3
@@ -14,6 +14,7 @@#include <linux/platform_device.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> +#include <linux/regulator/of_regulator.h> #define AD5398_CURRENT_EN_MASK 0x8000
@@ -221,15 +222,20 @@ static int ad5398_probe(struct i2c_client *client,const struct ad5398_current_data_format *df = (struct ad5398_current_data_format *)id->driver_data; -if (!init_data) -return -EINVAL ; - chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL );if (!chip)return -ENOMEM ; config.dev = &client->dev; +if (client->dev.of_node) + init_data =of_get_regulator_init_data (&client->dev, + client->dev.of_node, + &ad5398_reg); +if (!init_data) +return -EINVAL ; + config.init_data = init_data; + config.of_node = client->dev.of_node; config.driver_data = chip; chip->client = client;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 216/325 wifi: ath9k: return by of_get_mac_address
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit dfffb317519f88534bb82797f055f0a2fd867e7b ]
When using nvmem, ath9k could potentially be loaded before nvmem, which loads after mtd. This is an issue if DT contains an nvmem mac address.
If nvmem is not ready in time for ath9k, -EPROBE_DEFER is returned. Pass it to _probe so that ath9k can properly grab a potentially present MAC address.
--- drivers/net/wireless/ath/ath9k/init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/init.c +3 -1
@@ -691,7 +691,9 @@ static int ath9k_of_init(struct ath_softc *sc) ah->ah_flags |=AH_NO_EEP_SWAP ; } -of_get_mac_address (np, common->macaddr); + ret =of_get_mac_address (np, common->macaddr); +if (ret == -EPROBE_DEFER ) +return ret;return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 217/325 drm/atomic: clarify the rules around drm_atomic_state->allow_modeset
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simona Vetter <[email protected]>
[ Upstream commit c5e3306a424b52e38ad2c28c7f3399fcd03e383d ]
msm is automagically upgrading normal commits to full modesets, and that's a big no-no:
- for one this results in full on->off->on transitions on all these crtc, at least if you're using the usual helpers. Which seems to be the case, and is breaking uapi
- further even if the ctm change itself would not result in flicker, this can hide modesets for other reasons. Which again breaks the uapi
v2: I forgot the case of adding unrelated crtc state. Add that case and link to the existing kerneldoc explainers. This has come up in an irc discussion with Manasi and Ville about intel's bigjoiner mode. Also cc everyone involved in the msm irc discussion, more people joined after I sent out v1.
v3: Wording polish from Pekka and Thomas
--- include/drm/drm_atomic.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
include/drm/drm_atomic.h +21 -2
@@ -372,8 +372,27 @@ struct drm_atomic_state {* * Allow full modeset. This is used by the ATOMIC IOCTL handler to * implement the DRM_MODE_ATOMIC_ALLOW_MODESET flag. Drivers should -* never consult this flag, instead looking at the output of -* drm_atomic_crtc_needs_modeset(). +* generally not consult this flag, but instead look at the output of +* drm_atomic_crtc_needs_modeset(). The detailed rules are: +* +* - Drivers must not consult @allow_modeset in the atomic commit path. +* Use drm_atomic_crtc_needs_modeset() instead. +* +* - Drivers must consult @allow_modeset before adding unrelated struct +* drm_crtc_state to this commit by calling +* drm_atomic_get_crtc_state(). See also the warning in the +* documentation for that function. +* +* - Drivers must never change this flag, it is under the exclusive +* control of userspace. +* +* - Drivers may consult @allow_modeset in the atomic check path, if +* they have the choice between an optimal hardware configuration +* which requires a modeset, and a less optimal configuration which +* can be committed without a modeset. An example would be suboptimal +* scanout FIFO allocation resulting in increased idle power +* consumption. This allows userspace to avoid flickering and delays +* for the normal composition loop at reasonable cost. */ bool allow_modeset : 1;/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 218/325 drm/panel-edp: Add Starry 116KHD024006
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 749b5b279e5636cdcef51e15d67b77162cca6caa ]
We have a few reports of sc7180-trogdor-pompom devices that have a panel in them that IDs as STA 0x0004 and has the following raw EDID:
00 ff ff ff ff ff ff 00 4e 81 04 00 00 00 00 00 10 20 01 04 a5 1a 0e 78 0a dc dd 96 5b 5b 91 28 1f 52 54 00 00 00 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 8e 1c 56 a0 50 00 1e 30 28 20 55 00 00 90 10 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fe 00 31 31 36 4b 48 44 30 32 34 30 30 36 0a 00 e6
We've been unable to locate a datasheet for this panel and our partner has not been responsive, but all Starry eDP datasheets that we can find agree on the same timing (delay_100_500_e200) so it should be safe to use that here instead of the super conservative timings. We'll still go a little extra conservative and allow hpd_absent of 200 instead of 100 because that won't add any real-world delay in most cases.
We'll associate the string from the EDID ("116KHD024006") with this panel. Given that the ID is the suspicious value of 0x0004 it seems likely that Starry doesn't always update their IDs but the string will still work to differentiate if we ever need to in the future.
--- drivers/gpu/drm/panel/panel-edp.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panel/panel-edp.c +1 -0
@@ -1944,6 +1944,7 @@ static const struct edp_panel_entry edp_panels[] = {EDP_PANEL_ENTRY ('S' ,'H' ,'P' ,0x1523 , &sharp_lq140m1jw46.delay,"LQ140M1JW46" ),EDP_PANEL_ENTRY ('S' ,'H' ,'P' ,0x154c , &delay_200_500_p2e100,"LQ116M1JW10" ), +EDP_PANEL_ENTRY ('S' ,'T' ,'A' ,0x0004 , &delay_200_500_e200,"116KHD024006" ), EDP_PANEL_ENTRY('S', 'T', 'A', 0x0100, &delay_100_500_e200, "2081116HHD028001-51D"), { /* sentinal */ }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 219/325 drm: Add valid clones check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jessica Zhang <[email protected]>
[ Upstream commit 41b4b11da02157c7474caf41d56baae0e941d01a ]
Check that all encoders attached to a given CRTC are valid possible_clones of each other.
--- drivers/gpu/drm/drm_atomic_helper.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +28 -0
@@ -573,6 +573,30 @@ mode_valid(struct drm_atomic_state *state)return 0 ; } +static int drm_atomic_check_valid_clones (struct drm_atomic_state *state, +struct drm_crtc *crtc) +{ +struct drm_encoder *drm_enc; +struct drm_crtc_state *crtc_state =drm_atomic_get_new_crtc_state (state, + crtc); + +drm_for_each_encoder_mask (drm_enc, crtc->dev, crtc_state->encoder_mask) { +if (!drm_enc->possible_clones) { +DRM_DEBUG ("enc%d possible_clones is 0\n" , drm_enc->base.id); +continue ; + } + +if ((crtc_state->encoder_mask & drm_enc->possible_clones) != + crtc_state->encoder_mask) { +DRM_DEBUG ("crtc%d failed valid clone check for mask 0x%x\n" , + crtc->base.id, crtc_state->encoder_mask); +return -EINVAL ; + } + } + +return 0 ; +} +/** * drm_atomic_helper_check_modeset - validate state object for modeset changes * @dev: DRM device
@@ -744,6 +768,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, ret =drm_atomic_add_affected_planes (state, crtc);if (ret !=0 )return ret; + + ret =drm_atomic_check_valid_clones (state, crtc); +if (ret !=0 ) +return ret; }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 220/325 ASoC: imx-card: Adjust over allocation of memory in imx_card_parse_of()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
[ Upstream commit a9a69c3b38c89d7992fb53db4abb19104b531d32 ]
Incorrect types are used as sizeof() arguments in devm_kcalloc(). It should be sizeof(dai_link_data) for link_data instead of sizeof(snd_soc_dai_link).
This is found by our static analysis tool.
--- sound/soc/fsl/imx-card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/imx-card.c +1 -1
@@ -517,7 +517,7 @@ static int imx_card_parse_of(struct imx_card_data *data)if (!card->dai_link)return -ENOMEM ; - data->link_data =devm_kcalloc (dev, num_links,sizeof (*link),GFP_KERNEL ); + data->link_data =devm_kcalloc (dev, num_links,sizeof (*link_data),GFP_KERNEL );if (!data->link_data)return -ENOMEM ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 221/325 pinctrl: meson: define the pull up/down resistor value as 60 kOhm
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Blumenstingl <[email protected]>
[ Upstream commit e56088a13708757da68ad035269d69b93ac8c389 ]
The public datasheets of the following Amlogic SoCs describe a typical resistor value for the built-in pull up/down resistor:
- Meson8/8b/8m2: not documented
- GXBB (S905): 60 kOhm
- GXL (S905X): 60 kOhm
- GXM (S912): 60 kOhm
- G12B (S922X): 60 kOhm
- SM1 (S905D3): 60 kOhm
The public G12B and SM1 datasheets additionally state min and max values:
- min value: 50 kOhm for both, pull-up and pull-down
- max value for the pull-up: 70 kOhm
- max value for the pull-down: 130 kOhm
Use 60 kOhm in the pinctrl-meson driver as well so it's shown in the debugfs output. It may not be accurate for Meson8/8b/8m2 but in reality 60 kOhm is closer to the actual value than 1 Ohm.
--- drivers/pinctrl/meson/pinctrl-meson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/meson/pinctrl-meson.c +1 -1
@@ -487,7 +487,7 @@ static int meson_pinconf_get(struct pinctrl_dev *pcdev, unsigned int pin,case PIN_CONFIG_BIAS_PULL_DOWN :case PIN_CONFIG_BIAS_PULL_UP :if (meson_pinconf_get_pull (pc, pin) == param) - arg =1 ; + arg =60000 ;else return -EINVAL ;break ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 222/325 ASoC: Intel: bytcr_rt5640: Add DMI quirk for Acer Aspire SW3-013
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit a549b927ea3f5e50b1394209b64e6e17e31d4db8 ]
Acer Aspire SW3-013 requires the very same quirk as other Acer Aspire model for making it working.
--- sound/soc/intel/boards/bytcr_rt5640.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +13 -0
@@ -576,6 +576,19 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {BYT_RT5640_SSP0_AIF2 | BYT_RT5640_MCLK_EN), }, + { /* Acer Aspire SW3-013 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Acer" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW3-013"), + }, + .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | +BYT_RT5640_JD_SRC_JD2_IN4N | +BYT_RT5640_OVCD_TH_2000UA | +BYT_RT5640_OVCD_SF_0P75 | +BYT_RT5640_DIFF_MIC | +BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, { .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 223/325 ALSA: hda/realtek: Add quirk for HP Spectre x360 15-df1xxx
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit be0c40da888840fe91b45474cb70779e6cbaf7ca ]
HP Spectre x360 15-df1xxx with SSID 13c:863e requires similar workarounds that were applied to another HP Spectre x360 models; it has a mute LED only, no micmute LEDs, and needs the speaker GPIO seup.
--- sound/pci/hda/patch_realtek.c | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
sound/pci/hda/patch_realtek.c +42 -0
@@ -6787,6 +6787,41 @@ static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec, } } +/* GPIO1 = amplifier on/off */ +static void alc285_fixup_hp_spectre_x360_df1 (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +struct alc_spec *spec = codec->spec; +static const hda_nid_t conn[] = {0x02 }; +static const struct hda_pintbl pincfgs[] = { + {0x14 ,0x90170110 },/* front/high speakers */ + {0x17 ,0x90170130 },/* back/bass speakers */ + { } + }; + +// enable mute led +alc285_fixup_hp_mute_led_coefbit (codec, fix, action); + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : +/* needed for amp of back speakers */ + spec->gpio_mask |=0x01 ; + spec->gpio_dir |=0x01 ; +snd_hda_apply_pincfgs (codec, pincfgs); +/* share DAC to have unified volume control */ +snd_hda_override_conn_list (codec,0x14 ,ARRAY_SIZE (conn), conn); +snd_hda_override_conn_list (codec,0x17 ,ARRAY_SIZE (conn), conn); +break ; +case HDA_FIXUP_ACT_INIT : +/* need to toggle GPIO to enable the amp of back speakers */ +alc_update_gpio_data (codec,0x01 , true); +msleep (100 ); +alc_update_gpio_data (codec,0x01 , false); +break ; + } +} +static void alc285_fixup_hp_spectre_x360 (struct hda_codec *codec,const struct hda_fixup *fix,int action) {
@@ -7326,6 +7361,7 @@ enum {ALC280_FIXUP_HP_9480M ,ALC245_FIXUP_HP_X360_AMP ,ALC285_FIXUP_HP_SPECTRE_X360_EB1 , +ALC285_FIXUP_HP_SPECTRE_X360_DF1 ,ALC285_FIXUP_HP_ENVY_X360 ,ALC288_FIXUP_DELL_HEADSET_MODE , ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
@@ -9322,6 +9358,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_spectre_x360_eb1 }, + [ALC285_FIXUP_HP_SPECTRE_X360_DF1] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_spectre_x360_df1 + }, [ALC285_FIXUP_HP_ENVY_X360] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_envy_x360,
@@ -9882,6 +9922,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x86c1 ,"HP Laptop 15-da3001TU" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x86c7 ,"HP Envy AiO 32" ,ALC274_FIXUP_HP_ENVY_GPIO ),SND_PCI_QUIRK (0x103c ,0x86e7 ,"HP Spectre x360 15-eb0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_EB1 ), +SND_PCI_QUIRK (0x103c ,0x863e ,"HP Spectre x360 15-df1xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_DF1 ),SND_PCI_QUIRK (0x103c ,0x86e8 ,"HP Spectre x360 15-eb0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_EB1 ),SND_PCI_QUIRK (0x103c ,0x86f9 ,"HP Spectre x360 13-aw0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED ), SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
@@ -10591,6 +10632,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"}, {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"}, {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"}, + {.id = ALC285_FIXUP_HP_SPECTRE_X360_DF1, .name = "alc285-hp-spectre-x360-df1"}, {.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"}, {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"}, {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 224/325 nvmet-tcp: dont restore null sk_state_change
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alistair Francis <[email protected]>
[ Upstream commit 46d22b47df2741996af277a2838b95f130436c13 ]
queue->state_change is set as part of nvmet_tcp_set_queue_sock(), but if the TCP connection isn't established when nvmet_tcp_set_queue_sock() is called then queue->state_change isn't set and sock->sk->sk_state_change isn't replaced.
As such we don't need to restore sock->sk->sk_state_change if queue->state_change is NULL.
This avoids NULL pointer dereferences such as this:
[ 286.462026][ C0] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 286.462814][ C0] #PF: supervisor instruction fetch in kernel mode [ 286.463796][ C0] #PF: error_code(0x0010) - not-present page [ 286.464392][ C0] PGD 8000000140620067 P4D 8000000140620067 PUD 114201067 PMD 0 [ 286.465086][ C0] Oops: Oops: 0010 [#1] SMP KASAN PTI [ 286.465559][ C0] CPU: 0 UID: 0 PID: 1628 Comm: nvme Not tainted 6.15.0-rc2+ #11 PREEMPT(voluntary) [ 286.466393][ C0] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/01/2014 [ 286.467147][ C0] RIP: 0010:0x0 [ 286.467420][ C0] Code: Unable to access opcode bytes at 0xffffffffffffffd6. [ 286.467977][ C0] RSP: 0018:ffff8883ae008580 EFLAGS: 00010246 [ 286.468425][ C0] RAX: 0000000000000000 RBX: ffff88813fd34100 RCX: ffffffffa386cc43 [ 286.469019][ C0] RDX: 1ffff11027fa68b6 RSI: 0000000000000008 RDI: ffff88813fd34100 [ 286.469545][ C0] RBP: ffff88813fd34160 R08: 0000000000000000 R09: ffffed1027fa682c [ 286.470072][ C0] R10: ffff88813fd34167 R11: 0000000000000000 R12: ffff88813fd344c3 [ 286.470585][ C0] R13: ffff88813fd34112 R14: ffff88813fd34aec R15: ffff888132cdd268 [ 286.471070][ C0] FS: 00007fe3c04c7d80(0000) GS:ffff88840743f000(0000) knlGS:0000000000000000 [ 286.471644][ C0] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 286.472543][ C0] CR2: ffffffffffffffd6 CR3: 000000012daca000 CR4: 00000000000006f0 [ 286.473500][ C0] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 286.474467][ C0] DR3: 0000000000000000 DR6: 00000000ffff07f0 DR7: 0000000000000400 [ 286.475453][ C0] Call Trace: [ 286.476102][ C0] <IRQ> [ 286.476719][ C0] tcp_fin+0x2bb/0x440 [ 286.477429][ C0] tcp_data_queue+0x190f/0x4e60 [ 286.478174][ C0] ? __build_skb_around+0x234/0x330 [ 286.478940][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.479659][ C0] ? __pfx_tcp_data_queue+0x10/0x10 [ 286.480431][ C0] ? tcp_try_undo_loss+0x640/0x6c0 [ 286.481196][ C0] ? seqcount_lockdep_reader_access.constprop.0+0x82/0x90 [ 286.482046][ C0] ? kvm_clock_get_cycles+0x14/0x30 [ 286.482769][ C0] ? ktime_get+0x66/0x150 [ 286.483433][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.484146][ C0] tcp_rcv_established+0x6e4/0x2050 [ 286.484857][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.485523][ C0] ? ipv4_dst_check+0x160/0x2b0 [ 286.486203][ C0] ? __pfx_tcp_rcv_established+0x10/0x10 [ 286.486917][ C0] ? lock_release+0x217/0x2c0 [ 286.487595][ C0] tcp_v4_do_rcv+0x4d6/0x9b0 [ 286.488279][ C0] tcp_v4_rcv+0x2af8/0x3e30 [ 286.488904][ C0] ? raw_local_deliver+0x51b/0xad0 [ 286.489551][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.490198][ C0] ? __pfx_tcp_v4_rcv+0x10/0x10 [ 286.490813][ C0] ? __pfx_raw_local_deliver+0x10/0x10 [ 286.491487][ C0] ? __pfx_nf_confirm+0x10/0x10 [nf_conntrack] [ 286.492275][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.492900][ C0] ip_protocol_deliver_rcu+0x8f/0x370 [ 286.493579][ C0] ip_local_deliver_finish+0x297/0x420 [ 286.494268][ C0] ip_local_deliver+0x168/0x430 [ 286.494867][ C0] ? __pfx_ip_local_deliver+0x10/0x10 [ 286.495498][ C0] ? __pfx_ip_local_deliver_finish+0x10/0x10 [ 286.496204][ C0] ? ip_rcv_finish_core+0x19a/0x1f20 [ 286.496806][ C0] ? lock_release+0x217/0x2c0 [ 286.497414][ C0] ip_rcv+0x455/0x6e0 [ 286.497945][ C0] ? __pfx_ip_rcv+0x10/0x10 [ 286.498550][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.499137][ C0] ? __pfx_ip_rcv_finish+0x10/0x10 [ 286.499763][ C0] ? lock_release+0x217/0x2c0 [ 286.500327][ C0] ? dl_scaled_delta_exec+0xd1/0x2c0 [ 286.500922][ C0] ? __pfx_ip_rcv+0x10/0x10 [ 286.501480][ C0] __netif_receive_skb_one_core+0x166/0x1b0 [ 286.502173][ C0] ? __pfx___netif_receive_skb_one_core+0x10/0x10 [ 286.502903][ C0] ? lock_acquire+0x2b2/0x310 [ 286.503487][ C0] ? process_backlog+0x372/0x1350 [ 286.504087][ C0] ? lock_release+0x217/0x2c0 [ 286.504642][ C0] process_backlog+0x3b9/0x1350 [ 286.505214][ C0] ? process_backlog+0x372/0x1350 [ 286.505779][ C0] __napi_poll.constprop.0+0xa6/0x490 [ 286.506363][ C0] net_rx_action+0x92e/0xe10 [ 286.506889][ C0] ? __pfx_net_rx_action+0x10/0x10 [ 286.507437][ C0] ? timerqueue_add+0x1f0/0x320 [ 286.507977][ C0] ? sched_clock_cpu+0x68/0x540 [ 286.508492][ C0] ? lock_acquire+0x2b2/0x310 [ 286.509043][ C0] ? kvm_sched_clock_read+0xd/0x20 [ 286.509607][ C0] ? handle_softirqs+0x1aa/0x7d0 [ 286.510187][ C0] handle_softirqs+0x1f2/0x7d0 [ 286.510754][ C0] ? __pfx_handle_softirqs+0x10/0x10 [ 286.511348][ C0] ? irqtime_account_irq+0x181/0x290 [ 286.511937][ C0] ? __dev_queue_xmit+0x85d/0x3450 [ 286.512510][ C0] do_softirq.part.0+0x89/0xc0 [ 286.513100][ C0] </IRQ> [ 286.513548][ C0] <TASK> [ 286.513953][ C0] __local_bh_enable_ip+0x112/0x140 [ 286.514522][ C0] ? __dev_queue_xmit+0x85d/0x3450 [ 286.515072][ C0] __dev_queue_xmit+0x872/0x3450 [ 286.515619][ C0] ? nft_do_chain+0xe16/0x15b0 [nf_tables] [ 286.516252][ C0] ? __pfx___dev_queue_xmit+0x10/0x10 [ 286.516817][ C0] ? selinux_ip_postroute+0x43c/0xc50 [ 286.517433][ C0] ? __pfx_selinux_ip_postroute+0x10/0x10 [ 286.518061][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.518606][ C0] ? ip_output+0x164/0x4a0 [ 286.519149][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.519671][ C0] ? ip_finish_output2+0x17d5/0x1fb0 [ 286.520258][ C0] ip_finish_output2+0xb4b/0x1fb0 [ 286.520787][ C0] ? __pfx_ip_finish_output2+0x10/0x10 [ 286.521355][ C0] ? __ip_finish_output+0x15d/0x750 [ 286.521890][ C0] ip_output+0x164/0x4a0 [ 286.522372][ C0] ? __pfx_ip_output+0x10/0x10 [ 286.522872][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.523402][ C0] ? _raw_spin_unlock_irqrestore+0x4c/0x60 [ 286.524031][ C0] ? __pfx_ip_finish_output+0x10/0x10 [ 286.524605][ C0] ? __ip_queue_xmit+0x999/0x2260 [ 286.525200][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.525744][ C0] ? ipv4_dst_check+0x16a/0x2b0 [ 286.526279][ C0] ? lock_release+0x217/0x2c0 [ 286.526793][ C0] __ip_queue_xmit+0x1883/0x2260 [ 286.527324][ C0] ? __skb_clone+0x54c/0x730 [ 286.527827][ C0] __tcp_transmit_skb+0x209b/0x37a0 [ 286.528374][ C0] ? __pfx___tcp_transmit_skb+0x10/0x10 [ 286.528952][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.529472][ C0] ? seqcount_lockdep_reader_access.constprop.0+0x82/0x90 [ 286.530152][ C0] ? trace_hardirqs_on+0x12/0x120 [ 286.530691][ C0] tcp_write_xmit+0xb81/0x88b0 [ 286.531224][ C0] ? mod_memcg_state+0x4d/0x60 [ 286.531736][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.532253][ C0] __tcp_push_pending_frames+0x90/0x320 [ 286.532826][ C0] tcp_send_fin+0x141/0xb50 [ 286.533352][ C0] ? __pfx_tcp_send_fin+0x10/0x10 [ 286.533908][ C0] ? __local_bh_enable_ip+0xab/0x140 [ 286.534495][ C0] inet_shutdown+0x243/0x320 [ 286.535077][ C0] nvme_tcp_alloc_queue+0xb3b/0x2590 [nvme_tcp] [ 286.535709][ C0] ? do_raw_spin_lock+0x129/0x260 [ 286.536314][ C0] ? __pfx_nvme_tcp_alloc_queue+0x10/0x10 [nvme_tcp] [ 286.536996][ C0] ? do_raw_spin_unlock+0x54/0x1e0 [ 286.537550][ C0] ? _raw_spin_unlock+0x29/0x50 [ 286.538127][ C0] ? do_raw_spin_lock+0x129/0x260 [ 286.538664][ C0] ? __pfx_do_raw_spin_lock+0x10/0x10 [ 286.539249][ C0] ? nvme_tcp_alloc_admin_queue+0xd5/0x340 [nvme_tcp] [ 286.539892][ C0] ? __wake_up+0x40/0x60 [ 286.540392][ C0] nvme_tcp_alloc_admin_queue+0xd5/0x340 [nvme_tcp] [ 286.541047][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.541589][ C0] nvme_tcp_setup_ctrl+0x8b/0x7a0 [nvme_tcp] [ 286.542254][ C0] ? _raw_spin_unlock_irqrestore+0x4c/0x60 [ 286.542887][ C0] ? __pfx_nvme_tcp_setup_ctrl+0x10/0x10 [nvme_tcp] [ 286.543568][ C0] ? trace_hardirqs_on+0x12/0x120 [ 286.544166][ C0] ? _raw_spin_unlock_irqrestore+0x35/0x60 [ 286.544792][ C0] ? nvme_change_ctrl_state+0x196/0x2e0 [nvme_core] [ 286.545477][ C0] nvme_tcp_create_ctrl+0x839/0xb90 [nvme_tcp] [ 286.546126][ C0] nvmf_dev_write+0x3db/0x7e0 [nvme_fabrics] [ 286.546775][ C0] ? rw_verify_area+0x69/0x520 [ 286.547334][ C0] vfs_write+0x218/0xe90 [ 286.547854][ C0] ? do_syscall_64+0x9f/0x190 [ 286.548408][ C0] ? trace_hardirqs_on_prepare+0xdb/0x120 [ 286.549037][ C0] ? syscall_exit_to_user_mode+0x93/0x280 [ 286.549659][ C0] ? __pfx_vfs_write+0x10/0x10 [ 286.550259][ C0] ? do_syscall_64+0x9f/0x190 [ 286.550840][ C0] ? syscall_exit_to_user_mode+0x8e/0x280 [ 286.551516][ C0] ? trace_hardirqs_on_prepare+0xdb/0x120 [ 286.552180][ C0] ? syscall_exit_to_user_mode+0x93/0x280 [ 286.552834][ C0] ? ksys_read+0xf5/0x1c0 [ 286.553386][ C0] ? __pfx_ksys_read+0x10/0x10 [ 286.553964][ C0] ksys_write+0xf5/0x1c0 [ 286.554499][ C0] ? __pfx_ksys_write+0x10/0x10 [ 286.555072][ C0] ? trace_hardirqs_on_prepare+0xdb/0x120 [ 286.555698][ C0] ? syscall_exit_to_user_mode+0x93/0x280 [ 286.556319][ C0] ? do_syscall_64+0x54/0x190 [ 286.556866][ C0] do_syscall_64+0x93/0x190 [ 286.557420][ C0] ? rcu_read_unlock+0x17/0x60 [ 286.557986][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.558526][ C0] ? lock_release+0x217/0x2c0 [ 286.559087][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.559659][ C0] ? count_memcg_events.constprop.0+0x4a/0x60 [ 286.560476][ C0] ? exc_page_fault+0x7a/0x110 [ 286.561064][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.561647][ C0] ? lock_release+0x217/0x2c0 [ 286.562257][ C0] ? do_user_addr_fault+0x171/0xa00 [ 286.562839][ C0] ? do_user_addr_fault+0x4a2/0xa00 [ 286.563453][ C0] ? irqentry_exit_to_user_mode+0x84/0x270 [ 286.564112][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.564677][ C0] ? irqentry_exit_to_user_mode+0x84/0x270 [ 286.565317][ C0] ? trace_hardirqs_on_prepare+0xdb/0x120 [ 286.565922][ C0] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 286.566542][ C0] RIP: 0033:0x7fe3c05e6504 [ 286.567102][ C0] Code: c7 00 16 00 00 00 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 80 3d c5 8b 10 00 00 74 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 55 48 89 e5 48 83 ec 20 48 89 [ 286.568931][ C0] RSP: 002b:00007fff76444f58 EFLAGS: 00000202 ORIG_RAX: 0000000000000001 [ 286.569807][ C0] RAX: ffffffffffffffda RBX: 000000003b40d930 RCX: 00007fe3c05e6504 [ 286.570621][ C0] RDX: 00000000000000cf RSI: 000000003b40d930 RDI: 0000000000000003 [ 286.571443][ C0] RBP: 0000000000000003 R08: 00000000000000cf R09: 000000003b40d930 [ 286.572246][ C0] R10: 0000000000000000 R11: 0000000000000202 R12: 000000003b40cd60 [ 286.573069][ C0] R13: 00000000000000cf R14: 00007fe3c07417f8 R15: 00007fe3c073502e [ 286.573886][ C0] </TASK>
--- drivers/nvme/target/tcp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/target/tcp.c +3 -0
@@ -1417,6 +1417,9 @@ static void nvmet_tcp_restore_socket_callbacks(struct nvmet_tcp_queue *queue) {struct socket *sock = queue->sock; +if (!queue->state_change) +return ; +write_lock_bh (&sock->sk->sk_callback_lock); sock->sk->sk_data_ready = queue->data_ready; sock->sk->sk_state_change = queue->state_change;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 225/325 io_uring/fdinfo: annotate racy sq/cq head/tail reads
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
[ Upstream commit f024d3a8ded0d8d2129ae123d7a5305c29ca44ce ]
syzbot complains about the cached sq head read, and it's totally right. But we don't need to care, it's just reading fdinfo, and reading the CQ or SQ tail/head entries are known racy in that they are just a view into that very instant and may of course be outdated by the time they are reported.
Annotate both the SQ head and CQ tail read with data_race() to avoid this syzbot complaint.
--- io_uring/fdinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
io_uring/fdinfo.c +2 -2
@@ -79,11 +79,11 @@ static __cold void __io_uring_show_fdinfo(struct io_ring_ctx *ctx,seq_printf (m,"SqMask:\t0x%x\n" , sq_mask);seq_printf (m,"SqHead:\t%u\n" , sq_head);seq_printf (m,"SqTail:\t%u\n" , sq_tail); -seq_printf (m,"CachedSqHead:\t%u\n" , ctx->cached_sq_head); +seq_printf (m,"CachedSqHead:\t%u\n" ,data_race (ctx->cached_sq_head));seq_printf (m,"CqMask:\t0x%x\n" , cq_mask);seq_printf (m,"CqHead:\t%u\n" , cq_head);seq_printf (m,"CqTail:\t%u\n" , cq_tail); -seq_printf (m,"CachedCqTail:\t%u\n" , ctx->cached_cq_tail); +seq_printf (m,"CachedCqTail:\t%u\n" ,data_race (ctx->cached_cq_tail));seq_printf (m,"SQEs:\t%u\n" , sq_tail - sq_head); sq_entries =min (sq_tail - sq_head, ctx->sq_entries);for (i =0 ; i < sq_entries; i++) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 226/325 btrfs: correct the order of prelim_ref arguments in btrfs__prelim_ref
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Goldwyn Rodrigues <[email protected]>
[ Upstream commit bc7e0975093567f51be8e1bdf4aa5900a3cf0b1e ]
btrfs_prelim_ref() calls the old and new reference variables in the incorrect order. This causes a NULL pointer dereference because oldref is passed as NULL to trace_btrfs_prelim_ref_insert().
Note, trace_btrfs_prelim_ref_insert() is being called with newref as oldref (and oldref as NULL) on purpose in order to print out the values of newref.
To reproduce:
echo 1 > /sys/kernel/debug/tracing/events/btrfs/btrfs_prelim_ref_insert/enable
Perform some writeback operations.
Backtrace: BUG: kernel NULL pointer dereference, address: 0000000000000018 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 115949067 P4D 115949067 PUD 11594a067 PMD 0 Oops: Oops: 0000 [#1] SMP NOPTI CPU: 1 UID: 0 PID: 1188 Comm: fsstress Not tainted 6.15.0-rc2-tester+ #47 PREEMPT(voluntary) 7ca2cef72d5e9c600f0c7718adb6462de8149622 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-2-gc13ff2cd-prebuilt.qemu.org 04/01/2014 RIP: 0010:trace_event_raw_event_btrfs__prelim_ref+0x72/0x130 Code: e8 43 81 9f ff 48 85 c0 74 78 4d 85 e4 0f 84 8f 00 00 00 49 8b 94 24 c0 06 00 00 48 8b 0a 48 89 48 08 48 8b 52 08 48 89 50 10 <49> 8b 55 18 48 89 50 18 49 8b 55 20 48 89 50 20 41 0f b6 55 28 88 RSP: 0018:ffffce44820077a0 EFLAGS: 00010286 RAX: ffff8c6b403f9014 RBX: ffff8c6b55825730 RCX: 304994edf9cf506b RDX: d8b11eb7f0fdb699 RSI: ffff8c6b403f9010 RDI: ffff8c6b403f9010 RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000010 R10: 00000000ffffffff R11: 0000000000000000 R12: ffff8c6b4e8fb000 R13: 0000000000000000 R14: ffffce44820077a8 R15: ffff8c6b4abd1540 FS: 00007f4dc6813740(0000) GS:ffff8c6c1d378000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000018 CR3: 000000010eb42000 CR4: 0000000000750ef0 PKRU: 55555554 Call Trace: <TASK> prelim_ref_insert+0x1c1/0x270 find_parent_nodes+0x12a6/0x1ee0 ? __entry_text_end+0x101f06/0x101f09 ? srso_alias_return_thunk+0x5/0xfbef5 ? srso_alias_return_thunk+0x5/0xfbef5 ? srso_alias_return_thunk+0x5/0xfbef5 ? srso_alias_return_thunk+0x5/0xfbef5 btrfs_is_data_extent_shared+0x167/0x640 ? fiemap_process_hole+0xd0/0x2c0 extent_fiemap+0xa5c/0xbc0 ? __entry_text_end+0x101f05/0x101f09 btrfs_fiemap+0x7e/0xd0 do_vfs_ioctl+0x425/0x9d0 __x64_sys_ioctl+0x75/0xc0
--- include/trace/events/btrfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/trace/events/btrfs.h +1 -1
@@ -1847,7 +1847,7 @@ DECLARE_EVENT_CLASS(btrfs__prelim_ref, TP_PROTO(const struct btrfs_fs_info *fs_info, const struct prelim_ref *oldref, const struct prelim_ref *newref, u64 tree_size), -TP_ARGS (fs_info, newref, oldref, tree_size), +TP_ARGS (fs_info, oldref, newref, tree_size),TP_STRUCT__entry_btrfs ( __field( u64, root_id )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 227/325 wifi: iwlwifi: add support for Killer on MTL
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit ebedf8b7f05b9c886d68d63025db8d1b12343157 ]
For now, we need another entry for these devices, this will be changed completely for 6.16.
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +2 -0
@@ -552,6 +552,8 @@ static const struct iwl_dev_info iwl_dev_info_table[] = {IWL_DEV_INFO (0x7A70 ,0x1692 , iwlax411_2ax_cfg_so_gf4_a0, iwl_ax411_killer_1690i_name),IWL_DEV_INFO (0x7AF0 ,0x1691 , iwlax411_2ax_cfg_so_gf4_a0, iwl_ax411_killer_1690s_name),IWL_DEV_INFO (0x7AF0 ,0x1692 , iwlax411_2ax_cfg_so_gf4_a0, iwl_ax411_killer_1690i_name), +IWL_DEV_INFO (0x7F70 ,0x1691 , iwlax411_2ax_cfg_so_gf4_a0, iwl_ax411_killer_1690s_name), +IWL_DEV_INFO (0x7F70 ,0x1692 , iwlax411_2ax_cfg_so_gf4_a0, iwl_ax411_killer_1690i_name),IWL_DEV_INFO (0x271C ,0x0214 , iwl9260_2ac_cfg, iwl9260_1_name), IWL_DEV_INFO(0x7E40, 0x1691, iwl_cfg_ma_a0_gf4_a0, iwl_ax411_killer_1690s_name),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 228/325 xenbus: Allow PVH dom0 a non-local xenstore
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Andryuk <[email protected]>
[ Upstream commit 90989869baae47ee2aa3bcb6f6eb9fbbe4287958 ]
Make xenbus_init() allow a non-local xenstore for a PVH dom0 - it is currently forced to XS_LOCAL. With Hyperlaunch booting dom0 and a xenstore stubdom, dom0 can be handled as a regular XS_HVM following the late init path.
Ideally we'd drop the use of xen_initial_domain() and just check for the event channel instead. However, ARM has a xen,enhanced no-xenstore mode, where the event channel and PFN would both be 0. Retain the xen_initial_domain() check, and use that for an additional check when the event channel is 0.
Check the full 64bit HVM_PARAM_STORE_EVTCHN value to catch the off chance that high bits are set for the 32bit event channel.
Message-ID: <[email protected]>
--- drivers/xen/xenbus/xenbus_probe.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/xen/xenbus/xenbus_probe.c +8 -6
@@ -966,9 +966,15 @@ static int __init xenbus_init(void)if (xen_pv_domain ()) xen_store_domain_type =XS_PV ;if (xen_hvm_domain ()) + { xen_store_domain_type =XS_HVM ; -if (xen_hvm_domain () &&xen_initial_domain ()) - xen_store_domain_type =XS_LOCAL ; + err =hvm_get_parameter (HVM_PARAM_STORE_EVTCHN , &v); +if (err) + goto out_error; + xen_store_evtchn = (int )v; +if (!v &&xen_initial_domain ()) + xen_store_domain_type =XS_LOCAL ; + }if (xen_pv_domain () && !xen_start_info->store_evtchn) xen_store_domain_type =XS_LOCAL ;if (xen_pv_domain () && xen_start_info->store_evtchn)
@@ -987,10 +993,6 @@ static int __init xenbus_init(void) xen_store_interface =gfn_to_virt (xen_store_gfn);break ;case XS_HVM : - err =hvm_get_parameter (HVM_PARAM_STORE_EVTCHN , &v); -if (err) - goto out_error; - xen_store_evtchn = (int )v; err =hvm_get_parameter (HVM_PARAM_STORE_PFN , &v);if (err) goto out_error;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 229/325 __legitimize_mnt(): check for MNT_SYNC_UMOUNT should be under mount_lock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 250cf3693060a5f803c5f1ddc082bb06b16112a9 ]
... or we risk stealing final mntput from sync umount - raising mnt_count after umount(2) has verified that victim is not busy, but before it has set MNT_SYNC_UMOUNT; in that case __legitimize_mnt() doesn't see that it's safe to quietly undo mnt_count increment and leaves dropping the reference to caller, where it'll be a full-blown mntput().
Check under mount_lock is needed; leaving the current one done before taking that makes no sense - it's nowhere near common enough to bother with.
--- fs/namespace.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
fs/namespace.c +1 -5
@@ -632,12 +632,8 @@ int __legitimize_mnt(struct vfsmount *bastard, unsigned seq)smp_mb ();// see mntput_no_expire() and do_umount() if (likely (!read_seqretry (&mount_lock, seq)))return 0 ; -if (bastard->mnt_flags &MNT_SYNC_UMOUNT ) { -mnt_add_count (mnt,-1 ); -return 1 ; - }lock_mount_hash (); -if (unlikely (bastard->mnt_flags &MNT_DOOMED )) { +if (unlikely (bastard->mnt_flags & (MNT_SYNC_UMOUNT |MNT_DOOMED ))) {mnt_add_count (mnt,-1 );unlock_mount_hash ();return 1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 230/325 espintcp: remove encap socket caching to avoid reference leak
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit 028363685bd0b7a19b4a820f82dd905b1dc83999 ]
The current scheme for caching the encap socket can lead to reference leaks when we try to delete the netns.
The reference chain is: xfrm_state -> enacp_sk -> netns
Since the encap socket is a userspace socket, it holds a reference on the netns. If we delete the espintcp state (through flush or individual delete) before removing the netns, the reference on the socket is dropped and the netns is correctly deleted. Otherwise, the netns may not be reachable anymore (if all processes within the ns have terminated), so we cannot delete the xfrm state to drop its reference on the socket.
This patch results in a small (~2% in my tests) performance regression.
A GC-type mechanism could be added for the socket cache, to clear references if the state hasn't been used "recently", but it's a lot more complex than just not caching the socket.
--- include/net/xfrm.h | 1 - net/ipv4/esp4.c | 49 ++++--------------------------------------- net/ipv6/esp6.c | 49 ++++--------------------------------------- net/xfrm/xfrm_state.c | 3 --- 4 files changed, 8 insertions(+), 94 deletions(-)
include/net/xfrm.h +0 -1
@@ -212,7 +212,6 @@ struct xfrm_state {/* Data for encapsulator */ struct xfrm_encap_tmpl *encap; -struct sock __rcu *encap_sk;/* Data for care-of address */ xfrm_address_t *coaddr;
net/ipv4/esp4.c +4 -45
83 lines not on this page · raw message
net/ipv6/esp6.c +4 -45
83 lines not on this page · raw message
net/xfrm/xfrm_state.c +0 -3
@@ -694,9 +694,6 @@ int __xfrm_state_delete(struct xfrm_state *x) net->xfrm.state_num--;spin_unlock (&net->xfrm.xfrm_state_lock); -if (x->encap_sk) -sock_put (rcu_dereference_raw (x->encap_sk)); -xfrm_dev_state_delete (x);/* All xfrm_state objects are created by xfrm_state_alloc.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 231/325 dmaengine: idxd: add per DSA wq workqueue for processing cr faults
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jiang <[email protected]>
[ Upstream commit 2f30decd2f23a376d2ed73dfe4c601421edf501a ]
Add a workqueue for user submitted completion record fault processing. The workqueue creation and destruction lifetime will be tied to the user sub-driver since it will only be used when the wq is a user type.
Stable-dep-of: 8dfa57aabff6 ("dmaengine: idxd: Fix allowing write() from different address spaces")
--- drivers/dma/idxd/cdev.c | 11 +++++++++++ drivers/dma/idxd/idxd.h | 1 + 2 files changed, 12 insertions(+)
drivers/dma/idxd/cdev.c +11 -0
@@ -408,6 +408,13 @@ static int idxd_user_drv_probe(struct idxd_dev *idxd_dev) }mutex_lock (&wq->wq_lock); + + wq->wq =create_workqueue (dev_name (wq_confdev (wq))); +if (!wq->wq) { + rc = -ENOMEM ; + goto wq_err; + } + wq->type =IDXD_WQT_USER ; rc =drv_enable_wq (wq);if (rc <0 )
@@ -426,7 +433,9 @@ static int idxd_user_drv_probe(struct idxd_dev *idxd_dev) err_cdev:drv_disable_wq (wq); err: +destroy_workqueue (wq->wq); wq->type =IDXD_WQT_NONE ; +wq_err:mutex_unlock (&wq->wq_lock);return rc; }
@@ -439,6 +448,8 @@ static void idxd_user_drv_remove(struct idxd_dev *idxd_dev)idxd_wq_del_cdev (wq);drv_disable_wq (wq); wq->type =IDXD_WQT_NONE ; +destroy_workqueue (wq->wq); + wq->wq =NULL ;mutex_unlock (&wq->wq_lock); }
drivers/dma/idxd/idxd.h +1 -0
@@ -185,6 +185,7 @@ struct idxd_wq {struct idxd_dev idxd_dev;struct idxd_cdev *idxd_cdev;struct wait_queue_head err_queue; +struct workqueue_struct *wq;struct idxd_device *idxd;int id;struct idxd_irq_entry ie;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 232/325 dmaengine: idxd: add idxd_copy_cr() to copy user completion record during page fault handling
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fenghua Yu <[email protected]>
[ Upstream commit b022f59725f0ae846191abbd6d2e611d7f60f826 ]
Define idxd_copy_cr() to copy completion record to fault address in user address that is found by work queue (wq) and PASID.
It will be used to write the user's completion record that the hardware device is not able to write due to user completion record page fault.
An xarray is added to associate the PASID and mm with the struct idxd_user_context so mm can be found by PASID and wq.
It is called when handling the completion record fault in a kernel thread context. Switch to the mm using kthread_use_vm() and copy the completion record to the mm via copy_to_user(). Once the copy is completed, switch back to the current mm using kthread_unuse_mm().
Stable-dep-of: 8dfa57aabff6 ("dmaengine: idxd: Fix allowing write() from different address spaces")
--- drivers/dma/idxd/cdev.c | 107 +++++++++++++++++++++++++++++++++++++-- drivers/dma/idxd/idxd.h | 6 +++ drivers/dma/idxd/init.c | 2 + drivers/dma/idxd/sysfs.c | 1 + 4 files changed, 111 insertions(+), 5 deletions(-)
drivers/dma/idxd/cdev.c +102 -5
@@ -12,7 +12,9 @@#include <linux/fs.h> #include <linux/poll.h> #include <linux/iommu.h> +#include <linux/highmem.h> #include <uapi/linux/idxd.h> +#include <linux/xarray.h> #include "registers.h" #include "idxd.h"
@@ -35,6 +37,7 @@ struct idxd_user_context {struct idxd_wq *wq;struct task_struct *task;unsigned int pasid; +struct mm_struct *mm;unsigned int flags;struct iommu_sva *sva; };
@@ -69,6 +72,19 @@ static inline struct idxd_wq *inode_wq(struct inode *inode)return idxd_cdev->wq; } +static void idxd_xa_pasid_remove (struct idxd_user_context *ctx) +{ +struct idxd_wq *wq = ctx->wq; +void *ptr; + +mutex_lock (&wq->uc_lock); + ptr =xa_cmpxchg (&wq->upasid_xa, ctx->pasid, ctx,NULL ,GFP_KERNEL ); +if (ptr != (void *)ctx) +dev_warn (&wq->idxd->pdev->dev,"xarray cmpxchg failed for pasid %u\n" , + ctx->pasid); +mutex_unlock (&wq->uc_lock); +} +static int idxd_cdev_open (struct inode *inode,struct file *filp) {struct idxd_user_context *ctx;
@@ -109,20 +125,26 @@ static int idxd_cdev_open(struct inode *inode, struct file *filp) pasid =iommu_sva_get_pasid (sva);if (pasid ==IOMMU_PASID_INVALID ) { -iommu_sva_unbind_device (sva); rc = -EINVAL ; - goto failed; + goto failed_get_pasid; } ctx->sva = sva; ctx->pasid = pasid; + ctx->mm = current->mm; + +mutex_lock (&wq->uc_lock); + rc =xa_insert (&wq->upasid_xa, pasid, ctx,GFP_KERNEL ); +mutex_unlock (&wq->uc_lock); +if (rc <0 ) +dev_warn (dev,"PASID entry already exist in xarray.\n" );if (wq_dedicated (wq)) { rc =idxd_wq_set_pasid (wq, pasid);if (rc <0 ) {iommu_sva_unbind_device (sva);dev_err (dev,"wq set pasid failed: %d\n" , rc); - goto failed; + goto failed_set_pasid; } } }
@@ -131,7 +153,13 @@ static int idxd_cdev_open(struct inode *inode, struct file *filp)mutex_unlock (&wq->wq_lock);return 0 ; - failed: +failed_set_pasid: +if (device_user_pasid_enabled (idxd)) +idxd_xa_pasid_remove (ctx); +failed_get_pasid: +if (device_user_pasid_enabled (idxd)) +iommu_sva_unbind_device (sva); +failed:mutex_unlock (&wq->wq_lock);kfree (ctx);return rc;
@@ -162,8 +190,10 @@ static int idxd_cdev_release(struct inode *node, struct file *filep) } } -if (ctx->sva) +if (ctx->sva) {iommu_sva_unbind_device (ctx->sva); +idxd_xa_pasid_remove (ctx); + }kfree (ctx);mutex_lock (&wq->wq_lock);idxd_wq_put (wq);
@@ -496,3 +526,70 @@ void idxd_cdev_remove(void)ida_destroy (&ictx[i].minor_ida); } } + +/** +* idxd_copy_cr - copy completion record to user address space found by wq and +* PASID +* @wq: work queue +* @pasid: PASID +* @addr: user fault address to write +* @cr: completion record +* @len: number of bytes to copy +* +* This is called by a work that handles completion record fault. +* +* Return: number of bytes copied. +*/ +int idxd_copy_cr (struct idxd_wq *wq,ioasid_t pasid,unsigned long addr, +void *cr,int len) +{ +struct device *dev = &wq->idxd->pdev->dev; +int left = len, status_size =1 ; +struct idxd_user_context *ctx; +struct mm_struct *mm; + +mutex_lock (&wq->uc_lock); + + ctx =xa_load (&wq->upasid_xa, pasid); +if (!ctx) { +dev_warn (dev,"No user context\n" ); + goto out; + } + + mm = ctx->mm; +/* +* The completion record fault handling work is running in kernel +* thread context. It temporarily switches to the mm to copy cr +* to addr in the mm. +*/ +kthread_use_mm (mm); + left =copy_to_user ((void __user *)addr + status_size, cr + status_size, + len - status_size); +/* +* Copy status only after the rest of completion record is copied +* successfully so that the user gets the complete completion record +* when a non-zero status is polled. +*/ +if (!left) { +u8 status; + +/* +* Ensure that the completion record's status field is written +* after the rest of the completion record has been written. +* This ensures that the user receives the correct completion +* record information once polling for a non-zero status. +*/ +wmb (); + status = *(u8 *)cr; +if (put_user (status, (u8 __user *)addr)) + left += status_size; + }else { + left += status_size; + } +kthread_unuse_mm (mm); + +out: +mutex_unlock (&wq->uc_lock); + +return len - left; +}
drivers/dma/idxd/idxd.h +6 -0
@@ -215,6 +215,10 @@ struct idxd_wq {char name[WQ_NAME_SIZE +1 ];u64 max_xfer_bytes;u32 max_batch_size; + +/* Lock to protect upasid_xa access. */ +struct mutex uc_lock; +struct xarray upasid_xa; };struct idxd_engine {
@@ -666,6 +670,8 @@ void idxd_cdev_remove(void);int idxd_cdev_get_major (struct idxd_device *idxd);int idxd_wq_add_cdev (struct idxd_wq *wq);void idxd_wq_del_cdev (struct idxd_wq *wq); +int idxd_copy_cr (struct idxd_wq *wq,ioasid_t pasid,unsigned long addr, +void *buf,int len);/* perfmon */ #if IS_ENABLED (CONFIG_INTEL_IDXD_PERFMON )
drivers/dma/idxd/init.c +2 -0
@@ -218,6 +218,8 @@ static int idxd_setup_wqs(struct idxd_device *idxd) }bitmap_copy (wq->opcap_bmap, idxd->opcap_bmap,IDXD_MAX_OPCAP_BITS ); } +mutex_init (&wq->uc_lock); +xa_init (&wq->upasid_xa); idxd->wqs[i] = wq; }
drivers/dma/idxd/sysfs.c +1 -0
@@ -1315,6 +1315,7 @@ static void idxd_conf_wq_release(struct device *dev)bitmap_free (wq->opcap_bmap);kfree (wq->wqcfg); +xa_destroy (&wq->upasid_xa);kfree (wq); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 233/325 dmaengine: idxd: Fix allowing write() from different address spaces
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
[ Upstream commit 8dfa57aabff625bf445548257f7711ef294cd30e ]
Check if the process submitting the descriptor belongs to the same address space as the one that opened the file, reject otherwise.
--- drivers/dma/idxd/cdev.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/dma/idxd/cdev.c +9 -0
@@ -240,6 +240,9 @@ static int idxd_cdev_mmap(struct file *filp, struct vm_area_struct *vma)if (!idxd->user_submission_safe && !capable (CAP_SYS_RAWIO ))return -EPERM ; +if (current->mm != ctx->mm) +return -EPERM ; + rc =check_vma (wq, vma, __func__);if (rc <0 )return rc;
@@ -306,6 +309,9 @@ static ssize_t idxd_cdev_write(struct file *filp, const char __user *buf, size_tssize_t written =0 ;int i; +if (current->mm != ctx->mm) +return -EPERM ; +for (i =0 ; i < len/sizeof (struct dsa_hw_desc ); i++) {int rc =idxd_submit_user_descriptor (ctx, udesc + i);
@@ -326,6 +332,9 @@ static __poll_t idxd_cdev_poll(struct file *filp,struct idxd_device *idxd = wq->idxd;__poll_t out =0 ; +if (current->mm != ctx->mm) +return -EPERM ; +poll_wait (filp, &wq->err_queue, wait);spin_lock (&idxd->dev_lock);if (idxd->sw_err.valid)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 234/325 remoteproc: qcom_wcnss: Fix on platforms without fallback regulators
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matti Lehtimäki <[email protected]>
[ Upstream commit 4ca45af0a56d00b86285d6fdd720dca3215059a7 ]
Recent change to handle platforms with only single power domain broke pronto-v3 which requires power domains and doesn't have fallback voltage regulators in case power domains are missing. Add a check to verify the number of fallback voltage regulators before using the code which handles single power domain situation.
--- drivers/remoteproc/qcom_wcnss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/remoteproc/qcom_wcnss.c +2 -1
@@ -445,7 +445,8 @@ static int wcnss_init_regulators(struct qcom_wcnss *wcnss,if (wcnss->num_pds) { info += wcnss->num_pds;/* Handle single power domain case */ - num_vregs += num_pd_vregs - wcnss->num_pds; +if (wcnss->num_pds < num_pd_vregs) + num_vregs += num_pd_vregs - wcnss->num_pds; }else { num_vregs += num_pd_vregs; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 235/325 clk: sunxi-ng: d1: Add missing divider for MMC mod clocks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andre Przywara <[email protected]>
[ Upstream commit 98e6da673cc6dd46ca9a599802bd2c8f83606710 ]
The D1/R528/T113 SoCs have a hidden divider of 2 in the MMC mod clocks, just as other recent SoCs. So far we did not describe that, which led to the resulting MMC clock rate to be only half of its intended value.
Use a macro that allows to describe a fixed post-divider, to compensate for that divisor.
This brings the MMC performance on those SoCs to its expected level, so about 23 MB/s for SD cards, instead of the 11 MB/s measured so far.
--- drivers/clk/sunxi-ng/ccu-sun20i-d1.c | 44 ++++++++++++++++------------ drivers/clk/sunxi-ng/ccu_mp.h | 22 ++++++++++++++ 2 files changed, 47 insertions(+), 19 deletions(-)
drivers/clk/sunxi-ng/ccu-sun20i-d1.c +25 -19
@@ -412,19 +412,23 @@ static const struct clk_parent_data mmc0_mmc1_parents[] = { { .hw = &pll_periph0_2x_clk.common.hw }, { .hw = &pll_audio1_div2_clk.common.hw }, }; -static SUNXI_CCU_MP_DATA_WITH_MUX_GATE(mmc0_clk, "mmc0", mmc0_mmc1_parents, 0x830, -0 ,4 ,/* M */ -8 ,2 ,/* P */ -24 ,3 ,/* mux */ -BIT (31 ),/* gate */ - 0); - -static SUNXI_CCU_MP_DATA_WITH_MUX_GATE(mmc1_clk, "mmc1", mmc0_mmc1_parents, 0x834, -0 ,4 ,/* M */ -8 ,2 ,/* P */ -24 ,3 ,/* mux */ -BIT (31 ),/* gate */ - 0); +static SUNXI_CCU_MP_DATA_WITH_MUX_GATE_POSTDIV(mmc0_clk, "mmc0", + mmc0_mmc1_parents,0x830 , +0 ,4 ,/* M */ +8 ,2 ,/* P */ +24 ,3 ,/* mux */ +BIT (31 ),/* gate */ +2 ,/* post-div */ + 0); + +static SUNXI_CCU_MP_DATA_WITH_MUX_GATE_POSTDIV(mmc1_clk, "mmc1", + mmc0_mmc1_parents,0x834 , +0 ,4 ,/* M */ +8 ,2 ,/* P */ +24 ,3 ,/* mux */ +BIT (31 ),/* gate */ +2 ,/* post-div */ + 0);static const struct clk_parent_data mmc2_parents[] = { { .fw_name = "hosc" },
@@ -433,12 +437,14 @@ static const struct clk_parent_data mmc2_parents[] = { { .hw = &pll_periph0_800M_clk.common.hw }, { .hw = &pll_audio1_div2_clk.common.hw }, }; -static SUNXI_CCU_MP_DATA_WITH_MUX_GATE(mmc2_clk, "mmc2", mmc2_parents, 0x838, -0 ,4 ,/* M */ -8 ,2 ,/* P */ -24 ,3 ,/* mux */ -BIT (31 ),/* gate */ - 0); +static SUNXI_CCU_MP_DATA_WITH_MUX_GATE_POSTDIV(mmc2_clk, "mmc2", mmc2_parents, +0x838 , +0 ,4 ,/* M */ +8 ,2 ,/* P */ +24 ,3 ,/* mux */ +BIT (31 ),/* gate */ +2 ,/* post-div */ + 0); static SUNXI_CCU_GATE_HWS(bus_mmc0_clk, "bus-mmc0", psi_ahb_hws, 0x84c, BIT(0), 0);
drivers/clk/sunxi-ng/ccu_mp.h +22 -0
@@ -52,6 +52,28 @@ struct ccu_mp { } \ } +#define SUNXI_CCU_MP_DATA_WITH_MUX_GATE_POSTDIV (_struct, _name, _parents, \ + _reg, \ + _mshift, _mwidth, \ + _pshift, _pwidth, \ + _muxshift, _muxwidth, \ + _gate, _postdiv, _flags)\ + struct ccu_mp _struct = { \ + .enable = _gate, \ + .m = _SUNXI_CCU_DIV(_mshift, _mwidth), \ + .p = _SUNXI_CCU_DIV(_pshift, _pwidth), \ + .mux = _SUNXI_CCU_MUX(_muxshift, _muxwidth), \ + .fixed_post_div = _postdiv, \ + .common = { \ + .reg = _reg, \ + .features = CCU_FEATURE_FIXED_POSTDIV, \ + .hw.init = CLK_HW_INIT_PARENTS_DATA(_name, \ + _parents, \ + &ccu_mp_ops, \ + _flags), \ + } \ + } + #define SUNXI_CCU_MP_WITH_MUX_GATE(_struct, _name, _parents, _reg, \ _mshift, _mwidth, \ _pshift, _pwidth, \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 236/325 xfrm: Sanitize marks before insert
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Chaignon <[email protected]>
[ Upstream commit 0b91fda3a1f044141e1e615456ff62508c32b202 ]
Prior to this patch, the mark is sanitized (applying the state's mask to the state's value) only on inserts when checking if a conflicting XFRM state or policy exists.
We discovered in Cilium that this same sanitization does not occur in the hot-path __xfrm_state_lookup. In the hot-path, the sk_buff's mark is simply compared to the state's value:
if ((mark & x->mark.m) != x->mark.v)
continue;Therefore, users can define unsanitized marks (ex. 0xf42/0xf00) which will never match any packet.
This commit updates __xfrm_state_insert and xfrm_policy_insert to store the sanitized marks, thus removing this footgun.
This has the side effect of changing the ip output, as the returned mark will have the mask applied to it when printed.
--- net/xfrm/xfrm_policy.c | 3 +++ net/xfrm/xfrm_state.c | 3 +++ 2 files changed, 6 insertions(+)
net/xfrm/xfrm_policy.c +3 -0
@@ -1597,6 +1597,9 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)struct xfrm_policy *delpol;struct hlist_head *chain; +/* Sanitize mark before store */ + policy->mark.v &= policy->mark.m; +spin_lock_bh (&net->xfrm.xfrm_policy_lock); chain =policy_hash_bysel (net, &policy->selector, policy->family, dir);if (chain)
net/xfrm/xfrm_state.c +3 -0
@@ -1275,6 +1275,9 @@ static void __xfrm_state_insert(struct xfrm_state *x)list_add (&x->km.all, &net->xfrm.state_all); +/* Sanitize mark before store */ + x->mark.v &= x->mark.m; + h =xfrm_dst_hash (net, &x->id.daddr, &x->props.saddr, x->props.reqid, x->props.family);hlist_add_head_rcu (&x->bydst, net->xfrm.state_bydst + h);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 237/325 dmaengine: idxd: Fix ->poll() return value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jiang <[email protected]>
[ Upstream commit ae74cd15ade833adc289279b5c6f12e78f64d4d7 ]
The fix to block access from different address space did not return a correct value for ->poll() change. kernel test bot reported that a return value of type __poll_t is expected rather than int. Fix to return POLLNVAL to indicate invalid request.
--- drivers/dma/idxd/cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/idxd/cdev.c +1 -1
@@ -333,7 +333,7 @@ static __poll_t idxd_cdev_poll(struct file *filp,__poll_t out =0 ;if (current->mm != ctx->mm) -return -EPERM ; +return POLLNVAL ;poll_wait (filp, &wq->err_queue, wait);spin_lock (&idxd->dev_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 238/325 Bluetooth: L2CAP: Fix not checking l2cap_chan security level
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 7af8479d9eb4319b4ba7b47a8c4d2c55af1c31e1 ]
l2cap_check_enc_key_size shall check the security level of the l2cap_chan rather than the hci_conn since for incoming connection request that may be different as hci_conn may already been encrypted using a different security level.
--- net/bluetooth/l2cap_core.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
net/bluetooth/l2cap_core.c +8 -7
@@ -1561,7 +1561,8 @@ static void l2cap_request_info(struct l2cap_conn *conn) sizeof(req), &req); } -static bool l2cap_check_enc_key_size (struct hci_conn *hcon) +static bool l2cap_check_enc_key_size (struct hci_conn *hcon, +struct l2cap_chan *chan) {/* The minimum encryption key size needs to be enforced by the * host stack before establishing any L2CAP connections. The
@@ -1575,7 +1576,7 @@ static bool l2cap_check_enc_key_size(struct hci_conn *hcon)int min_key_size = hcon->hdev->min_enc_key_size;/* On FIPS security level, key size must be 16 bytes */ -if (hcon->sec_level ==BT_SECURITY_FIPS ) +if (chan->sec_level ==BT_SECURITY_FIPS ) min_key_size =16 ; return (!test_bit(HCI_CONN_ENCRYPT, &hcon->flags) ||
@@ -1603,7 +1604,7 @@ static void l2cap_do_start(struct l2cap_chan *chan) !__l2cap_no_conn_pending(chan))return ; -if (l2cap_check_enc_key_size (conn->hcon)) +if (l2cap_check_enc_key_size (conn->hcon, chan))l2cap_start_connection (chan);else __set_chan_timer (chan,L2CAP_DISC_TIMEOUT );
@@ -1685,7 +1686,7 @@ static void l2cap_conn_start(struct l2cap_conn *conn)continue ; } -if (l2cap_check_enc_key_size (conn->hcon)) +if (l2cap_check_enc_key_size (conn->hcon, chan))l2cap_start_connection (chan);else l2cap_chan_close (chan,ECONNREFUSED );
@@ -4187,7 +4188,7 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,/* Check if the ACL is secure enough (if not SDP) */ if (psm !=cpu_to_le16 (L2CAP_PSM_SDP ) && (!hci_conn_check_link_mode (conn->hcon) || - !l2cap_check_enc_key_size (conn->hcon))) { + !l2cap_check_enc_key_size (conn->hcon, pchan))) { conn->disc_reason =HCI_ERROR_AUTH_FAILURE ; result =L2CAP_CR_SEC_BLOCK ; goto response;
@@ -8418,7 +8419,7 @@ static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) }if (chan->state ==BT_CONNECT ) { -if (!status &&l2cap_check_enc_key_size (hcon)) +if (!status &&l2cap_check_enc_key_size (hcon, chan))l2cap_start_connection (chan);else __set_chan_timer (chan,L2CAP_DISC_TIMEOUT );
@@ -8428,7 +8429,7 @@ static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)struct l2cap_conn_rsp rsp;__u16 res, stat; -if (!status &&l2cap_check_enc_key_size (hcon)) { +if (!status &&l2cap_check_enc_key_size (hcon, chan)) {if (test_bit (FLAG_DEFER_SETUP , &chan->flags)) { res =L2CAP_CR_PEND ; stat =L2CAP_CS_AUTHOR_PEND ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 239/325 bridge: netfilter: Fix forwarding of fragmented packets
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 91b6dbced0ef1d680afdd69b14fc83d50ebafaf3 ]
When netfilter defrag hooks are loaded (due to the presence of conntrack rules, for example), fragmented packets entering the bridge will be defragged by the bridge's pre-routing hook (br_nf_pre_routing() -> ipv4_conntrack_defrag()).
Later on, in the bridge's post-routing hook, the defragged packet will be fragmented again. If the size of the largest fragment is larger than what the kernel has determined as the destination MTU (using ip_skb_dst_mtu()), the defragged packet will be dropped.
Before commit ac6627a28dbf ("net: ipv4: Consolidate ipv4_mtu and ip_dst_mtu_maybe_forward"), ip_skb_dst_mtu() would return dst_mtu() as the destination MTU. Assuming the dst entry attached to the packet is the bridge's fake rtable one, this would simply be the bridge's MTU (see fake_mtu()).
However, after above mentioned commit, ip_skb_dst_mtu() ends up returning the route's MTU stored in the dst entry's metrics. Ideally, in case the dst entry is the bridge's fake rtable one, this should be the bridge's MTU as the bridge takes care of updating this metric when its MTU changes (see br_change_mtu()).
Unfortunately, the last operation is a no-op given the metrics attached to the fake rtable entry are marked as read-only. Therefore, ip_skb_dst_mtu() ends up returning 1500 (the initial MTU value) and defragged packets are dropped during fragmentation when dealing with large fragments and high MTU (e.g., 9k).
Fix by moving the fake rtable entry's metrics to be per-bridge (in a similar fashion to the fake rtable entry itself) and marking them as writable, thereby allowing MTU changes to be reflected.
--- net/bridge/br_nf_core.c | 7 ++----- net/bridge/br_private.h | 1 + 2 files changed, 3 insertions(+), 5 deletions(-)
net/bridge/br_nf_core.c +2 -5
@@ -65,17 +65,14 @@ static struct dst_ops fake_dst_ops = {* ipt_REJECT needs it. Future netfilter modules might * require us to fill additional fields. */ -static const u32 br_dst_default_metrics[RTAX_MAX ] = { - [RTAX_MTU -1 ] =1500 , -}; -void br_netfilter_rtable_init (struct net_bridge *br) {struct rtable *rt = &br->fake_rtable;atomic_set (&rt->dst.__refcnt,1 ); rt->dst.dev = br->dev; -dst_init_metrics (&rt->dst, br_dst_default_metrics, true); +dst_init_metrics (&rt->dst, br->metrics, false); +dst_metric_set (&rt->dst,RTAX_MTU , br->dev->mtu); rt->dst.flags =DST_NOXFRM |DST_FAKE_RTABLE ; rt->dst.ops = &fake_dst_ops; }
net/bridge/br_private.h +1 -0
@@ -478,6 +478,7 @@ struct net_bridge {struct rtable fake_rtable; struct rt6_info fake_rt6_info; }; +u32 metrics[RTAX_MAX ];#endif u16 group_fwd_mask;u16 group_fwd_mask_required;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 240/325 ice: fix vf->num_mac count with port representors
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
[ Upstream commit bbd95160a03dbfcd01a541f25c27ddb730dfbbd5 ]
The ice_vc_repr_add_mac() function indicates that it does not store the MAC address filters in the firmware. However, it still increments vf->num_mac. This is incorrect, as vf->num_mac should represent the number of MAC filters currently programmed to firmware.
Indeed, we only perform this increment if the requested filter is a unicast address that doesn't match the existing vf->hw_lan_addr. In addition, ice_vc_repr_del_mac() does not decrement the vf->num_mac counter. This results in the counter becoming out of sync with the actual count.
As it turns out, vf->num_mac is currently only used in legacy made without port representors. The single place where the value is checked is for enforcing a filter limit on untrusted VFs.
Upcoming patches to support VF Live Migration will use this value when determining the size of the TLV for MAC address filters. Fix the representor mode function to stop incrementing the counter incorrectly.
--- drivers/net/ethernet/intel/ice/ice_virtchnl.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_virtchnl.c +0 -1
@@ -3551,7 +3551,6 @@ static int ice_vc_repr_add_mac(struct ice_vf *vf, u8 *msg) }ice_vfhw_mac_add (vf, &al->list[i]); - vf->num_mac++;break ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 241/325 net: dwmac-sun8i: Use parsed internal PHY address instead of 1
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Kocialkowski <[email protected]>
[ Upstream commit 47653e4243f2b0a26372e481ca098936b51ec3a8 ]
While the MDIO address of the internal PHY on Allwinner sun8i chips is generally 1, of_mdio_parse_addr is used to cleanly parse the address from the device-tree instead of hardcoding it.
A commit reworking the code ditched the parsed value and hardcoded the value 1 instead, which didn't really break anything but is more fragile and not future-proof.
Restore the initial behavior using the parsed address returned from the helper.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +1 -1
@@ -948,7 +948,7 @@ static int sun8i_dwmac_set_syscon(struct device *dev,/* of_mdio_parse_addr returns a valid (0 ~ 31) PHY * address. No need to mask it again. */ - reg |=1 <<H3_EPHY_ADDR_SHIFT ; + reg |= ret <<H3_EPHY_ADDR_SHIFT ; }else {/* For SoCs without internal PHY the PHY selection bit should be * set to 0 (external PHY).
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 242/325 net: lan743x: Restore SGMII CTRL register on resume
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thangaraj Samynathan <[email protected]>
[ Upstream commit 293e38ff4e4c2ba53f3fd47d8a4a9f0f0414a7a6 ]
SGMII_CTRL register, which specifies the active interface, was not properly restored when resuming from suspend. This led to incorrect interface selection after resume particularly in scenarios involving the FPGA.
To fix this:
- Move the SGMII_CTRL setup out of the probe function.
- Initialize the register in the hardware initialization helper function, which is called during both device initialization and resume.
This ensures the interface configuration is consistently restored after suspend/resume cycles.
--- drivers/net/ethernet/microchip/lan743x_main.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/net/ethernet/microchip/lan743x_main.c +10 -9
@@ -3253,6 +3253,7 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter, struct pci_dev *pdev) {struct lan743x_tx *tx; +u32 sgmii_ctl;int index;int ret;
@@ -3265,6 +3266,15 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,spin_lock_init (&adapter->eth_syslock_spinlock);mutex_init (&adapter->sgmii_rw_lock);pci11x1x_set_rfe_rd_fifo_threshold (adapter); + sgmii_ctl =lan743x_csr_read (adapter,SGMII_CTL ); +if (adapter->is_sgmii_en) { + sgmii_ctl |=SGMII_CTL_SGMII_ENABLE_ ; + sgmii_ctl &= ~SGMII_CTL_SGMII_POWER_DN_ ; + }else { + sgmii_ctl &= ~SGMII_CTL_SGMII_ENABLE_ ; + sgmii_ctl |=SGMII_CTL_SGMII_POWER_DN_ ; + } +lan743x_csr_write (adapter,SGMII_CTL , sgmii_ctl); }else { adapter->max_tx_channels =LAN743X_MAX_TX_CHANNELS ; adapter->used_tx_channels =LAN743X_USED_TX_CHANNELS ;
@@ -3313,7 +3323,6 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,static int lan743x_mdiobus_init (struct lan743x_adapter *adapter) { -u32 sgmii_ctl;int ret; adapter->mdiobus =devm_mdiobus_alloc (&adapter->pdev->dev);
@@ -3325,10 +3334,6 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter) adapter->mdiobus->priv = (void *)adapter;if (adapter->is_pci11x1x) {if (adapter->is_sgmii_en) { - sgmii_ctl =lan743x_csr_read (adapter,SGMII_CTL ); - sgmii_ctl |=SGMII_CTL_SGMII_ENABLE_ ; - sgmii_ctl &= ~SGMII_CTL_SGMII_POWER_DN_ ; -lan743x_csr_write (adapter,SGMII_CTL , sgmii_ctl);netif_dbg (adapter, drv, adapter->netdev,"SGMII operation\n" ); adapter->mdiobus->probe_capabilities =MDIOBUS_C22_C45 ;
@@ -3338,10 +3343,6 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter)netif_dbg (adapter, drv, adapter->netdev,"lan743x-mdiobus-c45\n" ); }else { - sgmii_ctl =lan743x_csr_read (adapter,SGMII_CTL ); - sgmii_ctl &= ~SGMII_CTL_SGMII_ENABLE_ ; - sgmii_ctl |=SGMII_CTL_SGMII_POWER_DN_ ; -lan743x_csr_write (adapter,SGMII_CTL , sgmii_ctl);netif_dbg (adapter, drv, adapter->netdev,"RGMII operation\n" );// Only C22 support when RGMII I/F
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 243/325 io_uring: fix overflow resched cqe reordering
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ Upstream commit a7d755ed9ce9738af3db602eb29d32774a180bc7 ]
Leaving the CQ critical section in the middle of a overflow flushing can cause cqe reordering since the cache cq pointers are reset and any new cqe emitters that might get called in between are not going to be forced into io_cqe_cache_refill().
--- io_uring/io_uring.c | 1 + 1 file changed, 1 insertion(+)
io_uring/io_uring.c +1 -0
@@ -627,6 +627,7 @@ static bool __io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force)* to care for a non-real case. */ if (need_resched ()) { + ctx->cqe_sentinel = ctx->cqe_cached;io_cq_unlock_post (ctx);mutex_unlock (&ctx->uring_lock);cond_resched ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 244/325 sch_hfsc: Fix qlen accounting bug when using peek in hfsc_enqueue()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit 3f981138109f63232a5fb7165938d4c945cc1b9d ]
When enqueuing the first packet to an HFSC class, hfsc_enqueue() calls the child qdisc's peek() operation before incrementing sch->q.qlen and sch->qstats.backlog. If the child qdisc uses qdisc_peek_dequeued(), this may trigger an immediate dequeue and potential packet drop. In such cases, qdisc_tree_reduce_backlog() is called, but the HFSC qdisc's qlen and backlog have not yet been updated, leading to inconsistent queue accounting. This can leave an empty HFSC class in the active list, causing further consequences like use-after-free.
This patch fixes the bug by moving the increment of sch->q.qlen and sch->qstats.backlog before the call to the child qdisc's peek() operation. This ensures that queue length and backlog are always accurate when packet drops or dequeues are triggered during the peek.
--- net/sched/sch_hfsc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/sched/sch_hfsc.c +3 -3
@@ -1568,6 +1568,9 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)return err; } + sch->qstats.backlog += len; + sch->q.qlen++; +if (first && !cl->cl_nactive) {if (cl->cl_flags &HFSC_RSC )init_ed (cl, len);
@@ -1583,9 +1586,6 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) } - sch->qstats.backlog += len; - sch->q.qlen++; -return NET_XMIT_SUCCESS ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 245/325 octeontx2-pf: Add support for page pool
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ratheesh Kannoth <[email protected]>
[ Upstream commit b2e3406a38f0f48b1dfb81e5bb73d243ff6af179 ]
Page pool for each rx queue enhance rx side performance by reclaiming buffers back to each queue specific pool. DMA mapping is done only for first allocation of buffers. As subsequent buffers allocation avoid DMA mapping, it results in performance improvement.
Image | Performance
------------ | ------------
Vannila | 3Mpps
|
with this | 42Mppschange |
---------------------------
Stable-dep-of: b4164de5041b ("octeontx2-pf: Add AF_XDP non-zero copy support")
--- .../net/ethernet/marvell/octeontx2/Kconfig | 1 + .../marvell/octeontx2/nic/otx2_common.c | 78 ++++++++++++++++--- .../marvell/octeontx2/nic/otx2_common.h | 6 +- .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 11 ++- .../marvell/octeontx2/nic/otx2_txrx.c | 19 +++-- .../marvell/octeontx2/nic/otx2_txrx.h | 1 + .../ethernet/marvell/octeontx2/nic/qos_sq.c | 2 +- 7 files changed, 96 insertions(+), 22 deletions(-)
drivers/net/ethernet/marvell/octeontx2/Kconfig +1 -0
@@ -32,6 +32,7 @@ config OCTEONTX2_PF tristate "Marvell OcteonTX2 NIC Physical Function driver" select OCTEONTX2_MBOX select NET_DEVLINK + select PAGE_POOL depends on (64BIT && COMPILE_TEST) || ARM64 select DIMLIB depends on PCI
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +68 -10
145 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +4 -2
@@ -934,7 +934,7 @@ int otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool,int otx2_rxtx_enable (struct otx2_nic *pfvf,bool enable);void otx2_ctx_disable (struct mbox *mbox,int type,bool npa);int otx2_nix_config_bp (struct otx2_nic *pfvf,bool enable); -void otx2_cleanup_rx_cqes (struct otx2_nic *pfvf,struct otx2_cq_queue *cq); +void otx2_cleanup_rx_cqes (struct otx2_nic *pfvf,struct otx2_cq_queue *cq,int qidx);void otx2_cleanup_tx_cqes (struct otx2_nic *pfvf,struct otx2_cq_queue *cq);int otx2_sq_init (struct otx2_nic *pfvf,u16 qidx,u16 sqb_aura);int otx2_sq_aq_init (void *dev,u16 qidx,u16 sqb_aura);
@@ -942,7 +942,7 @@ int cn10k_sq_aq_init(void *dev, u16 qidx, u16 sqb_aura);int otx2_alloc_buffer (struct otx2_nic *pfvf,struct otx2_cq_queue *cq,dma_addr_t *dma);int otx2_pool_init (struct otx2_nic *pfvf,u16 pool_id, -int stack_pages,int numptrs,int buf_size); +int stack_pages,int numptrs,int buf_size,int type);int otx2_aura_init (struct otx2_nic *pfvf,int aura_id,int pool_id,int numptrs);
@@ -1012,6 +1012,8 @@ u16 otx2_get_max_mtu(struct otx2_nic *pfvf);int otx2_handle_ntuple_tc_features (struct net_device *netdev,netdev_features_t features);int otx2_smq_flush (struct otx2_nic *pfvf,int smq); +void otx2_free_bufs (struct otx2_nic *pfvf,struct otx2_pool *pool, +u64 iova,int size);/* tc support */ int otx2_init_tc (struct otx2_nic *nic);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +10 -1
@@ -1591,7 +1591,9 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)struct nix_lf_free_req *free_req;struct mbox *mbox = &pf->mbox;struct otx2_cq_queue *cq; +struct otx2_pool *pool;struct msg_req *req; +int pool_id;int qidx;/* Ensure all SQE are processed */
@@ -1618,7 +1620,7 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)for (qidx =0 ; qidx < qset->cq_cnt; qidx++) { cq = &qset->cq[qidx];if (cq->cq_type ==CQ_RX ) -otx2_cleanup_rx_cqes (pf, cq); +otx2_cleanup_rx_cqes (pf, cq, qidx);else otx2_cleanup_tx_cqes (pf, cq); }
@@ -1629,6 +1631,13 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)/* Free RQ buffer pointers*/ otx2_free_aura_ptr (pf,AURA_NIX_RQ ); +for (qidx =0 ; qidx < pf->hw.rx_queues; qidx++) { + pool_id =otx2_get_pool_idx (pf,AURA_NIX_RQ , qidx); + pool = &pf->qset.pool[pool_id]; +page_pool_destroy (pool->page_pool); + pool->page_pool =NULL ; + } +otx2_free_cq_res (pf);/* Free all ingress bandwidth profiles allocated */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +11 -8
@@ -218,9 +218,6 @@ static bool otx2_skb_add_frag(struct otx2_nic *pfvf, struct sk_buff *skb,skb_add_rx_frag (skb,skb_shinfo (skb)->nr_frags, page, va -page_address (page) + off, len - off, pfvf->rbsize); - -otx2_dma_unmap_page (pfvf, iova -OTX2_HEAD_ROOM , - pfvf->rbsize,DMA_FROM_DEVICE );return true; }
@@ -383,6 +380,8 @@ static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,if (pfvf->netdev->features &NETIF_F_RXCSUM ) skb->ip_summed =CHECKSUM_UNNECESSARY ; +skb_mark_for_recycle (skb); +napi_gro_frags (napi); }
@@ -1191,11 +1190,13 @@ bool otx2_sq_append_skb(struct net_device *netdev, struct otx2_snd_queue *sq, }EXPORT_SYMBOL (otx2_sq_append_skb); -void otx2_cleanup_rx_cqes (struct otx2_nic *pfvf,struct otx2_cq_queue *cq) +void otx2_cleanup_rx_cqes (struct otx2_nic *pfvf,struct otx2_cq_queue *cq,int qidx) {struct nix_cqe_rx_s *cqe; +struct otx2_pool *pool;int processed_cqe =0 ; -u64 iova, pa; +u16 pool_id; +u64 iova;if (pfvf->xdp_prog)xdp_rxq_info_unreg (&cq->xdp_rxq);
@@ -1203,6 +1204,9 @@ void otx2_cleanup_rx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq)if (otx2_nix_cq_op_status (pfvf, cq) || !cq->pend_cqe)return ; + pool_id =otx2_get_pool_idx (pfvf,AURA_NIX_RQ , qidx); + pool = &pfvf->qset.pool[pool_id]; +while (cq->pend_cqe) { cqe = (struct nix_cqe_rx_s *)otx2_get_next_cqe (cq); processed_cqe++;
@@ -1215,9 +1219,8 @@ void otx2_cleanup_rx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq)continue ; } iova = cqe->sg.seg_addr -OTX2_HEAD_ROOM ; - pa =otx2_iova_to_phys (pfvf->iommu_domain, iova); -otx2_dma_unmap_page (pfvf, iova, pfvf->rbsize,DMA_FROM_DEVICE ); -put_page (virt_to_page (phys_to_virt (pa))); + +otx2_free_bufs (pfvf, pool, iova, pfvf->rbsize); }/* Free CQEs to HW */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h +1 -0
@@ -118,6 +118,7 @@ struct otx2_cq_poll {struct otx2_pool {struct qmem *stack;struct qmem *fc_addr; +struct page_pool *page_pool;u16 rbsize; };
drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c +1 -1
@@ -63,7 +63,7 @@ static int otx2_qos_sq_aura_pool_init(struct otx2_nic *pfvf, int qidx)/* Initialize pool context */ err =otx2_pool_init (pfvf, pool_id, stack_pages, - num_sqbs, hw->sqb_size); + num_sqbs, hw->sqb_size,AURA_NIX_SQ );if (err) goto aura_free;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 246/325 octeontx2-pf: Add AF_XDP non-zero copy support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suman Ghosh <[email protected]>
[ Upstream commit b4164de5041b51cda3438e75bce668e2556057c3 ]
Set xdp rx ring memory type as MEM_TYPE_PAGE_POOL for af-xdp to work. This is needed since xdp_return_frame internally will use page pools.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +7 -1
@@ -988,6 +988,7 @@ static int otx2_cq_init(struct otx2_nic *pfvf, u16 qidx)int err, pool_id, non_xdp_queues;struct nix_aq_enq_req *aq;struct otx2_cq_queue *cq; +struct otx2_pool *pool; cq = &qset->cq[qidx]; cq->cq_idx = qidx;
@@ -996,8 +997,13 @@ static int otx2_cq_init(struct otx2_nic *pfvf, u16 qidx) cq->cq_type =CQ_RX ; cq->cint_idx = qidx; cq->cqe_cnt = qset->rqe_cnt; -if (pfvf->xdp_prog) +if (pfvf->xdp_prog) { + pool = &qset->pool[qidx];xdp_rxq_info_reg (&cq->xdp_rxq, pfvf->netdev, qidx,0 ); +xdp_rxq_info_reg_mem_model (&cq->xdp_rxq, +MEM_TYPE_PAGE_POOL , + pool->page_pool); + } }else if (qidx < non_xdp_queues) { cq->cq_type =CQ_TX ; cq->cint_idx = qidx - pfvf->hw.rx_queues;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 247/325 net/tipc: fix slab-use-after-free Read in tipc_aead_encrypt_done
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Liang <[email protected]>
[ Upstream commit e279024617134c94fd3e37470156534d5f2b3472 ]
Syzbot reported a slab-use-after-free with the following call trace:
==================================================================
BUG: KASAN: slab-use-after-free in tipc_aead_encrypt_done+0x4bd/0x510 net/tipc/crypto.c:840 Read of size 8 at addr ffff88807a733000 by task kworker/1:0/25 Call Trace: kasan_report+0xd9/0x110 mm/kasan/report.c:601 tipc_aead_encrypt_done+0x4bd/0x510 net/tipc/crypto.c:840 crypto_request_complete include/crypto/algapi.h:266 aead_request_complete include/crypto/internal/aead.h:85 cryptd_aead_crypt+0x3b8/0x750 crypto/cryptd.c:772 crypto_request_complete include/crypto/algapi.h:266 cryptd_queue_worker+0x131/0x200 crypto/cryptd.c:181 process_one_work+0x9fb/0x1b60 kernel/workqueue.c:3231 Allocated by task 8355: kzalloc_noprof include/linux/slab.h:778 tipc_crypto_start+0xcc/0x9e0 net/tipc/crypto.c:1466 tipc_init_net+0x2dd/0x430 net/tipc/core.c:72 ops_init+0xb9/0x650 net/core/net_namespace.c:139 setup_net+0x435/0xb40 net/core/net_namespace.c:343 copy_net_ns+0x2f0/0x670 net/core/net_namespace.c:508 create_new_namespaces+0x3ea/0xb10 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc0/0x1f0 kernel/nsproxy.c:228 ksys_unshare+0x419/0x970 kernel/fork.c:3323 __do_sys_unshare kernel/fork.c:3394 Freed by task 63: kfree+0x12a/0x3b0 mm/slub.c:4557 tipc_crypto_stop+0x23c/0x500 net/tipc/crypto.c:1539 tipc_exit_net+0x8c/0x110 net/tipc/core.c:119 ops_exit_list+0xb0/0x180 net/core/net_namespace.c:173 cleanup_net+0x5b7/0xbf0 net/core/net_namespace.c:640 process_one_work+0x9fb/0x1b60 kernel/workqueue.c:3231
After freed the tipc_crypto tx by delete namespace, tipc_aead_encrypt_done may still visit it in cryptd_queue_worker workqueue.
I reproduce this issue by:
ip netns add ns1
ip link add veth1 type veth peer name veth2
ip link set veth1 netns ns1
ip netns exec ns1 tipc bearer enable media eth dev veth1 ip netns exec ns1 tipc node set key this_is_a_master_key master ip netns exec ns1 tipc bearer disable media eth dev veth1 ip netns del ns1
The key of reproduction is that, simd_aead_encrypt is interrupted, leading to crypto_simd_usable() return false. Thus, the cryptd_queue_worker is triggered, and the tipc_crypto tx will be visited.
tipc_disc_timeout
tipc_bearer_xmit_skb
tipc_crypto_xmit
tipc_aead_encrypt
crypto_aead_encrypt
// encrypt()
simd_aead_encrypt
// crypto_simd_usable() is false
child = &ctx->cryptd_tfm->base; simd_aead_encrypt
crypto_aead_encrypt
// encrypt()
cryptd_aead_encrypt_enqueue
cryptd_aead_enqueue
cryptd_enqueue_request
// trigger cryptd_queue_worker
queue_work_on(smp_processor_id(), cryptd_wq, &cpu_queue->work)Fix this by holding net reference count before encrypt.
--- net/tipc/crypto.c | 5 +++++ 1 file changed, 5 insertions(+)
net/tipc/crypto.c +5 -0
@@ -817,12 +817,16 @@ static int tipc_aead_encrypt(struct tipc_aead *aead, struct sk_buff *skb, goto exit; } +/* Get net to avoid freed tipc_crypto when delete namespace */ +get_net (aead->crypto->net); +/* Now, do encrypt */ rc =crypto_aead_encrypt (req);if (rc == -EINPROGRESS || rc == -EBUSY )return rc;tipc_bearer_put (b); +put_net (aead->crypto->net); exit:kfree (ctx);
@@ -860,6 +864,7 @@ static void tipc_aead_encrypt_done(struct crypto_async_request *base, int err)kfree (tx_ctx);tipc_bearer_put (b);tipc_aead_put (aead); +put_net (net); }/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 248/325 octeontx2-af: Set LMT_ENA bit for APR table entries
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subbaraya Sundeep <[email protected]>
[ Upstream commit 0eefa27b493306928d88af6368193b134c98fd64 ]
This patch enables the LMT line for a PF/VF by setting the LMT_ENA bit in the APR_LMT_MAP_ENTRY_S structure.
Additionally, it simplifies the logic for calculating the LMTST table index by consistently using the maximum number of hw supported VFs (i.e., 256).
--- .../net/ethernet/marvell/octeontx2/af/rvu_cn10k.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c +13 -2
@@ -15,13 +15,17 @@#define LMT_TBL_OP_WRITE 1#define LMT_MAP_TABLE_SIZE (128 * 1024)#define LMT_MAPTBL_ENTRY_SIZE 16 +#define LMT_MAX_VFS 256 + +#define LMT_MAP_ENTRY_ENA BIT_ULL(20) +#define LMT_MAP_ENTRY_LINES GENMASK_ULL(18, 16)/* Function to perform operations (read/write) on lmtst map table */ static int lmtst_map_table_ops (struct rvu *rvu,u32 index,u64 *val,int lmt_tbl_op) {void __iomem *lmt_map_base; -u64 tbl_base; +u64 tbl_base, cfg; tbl_base =rvu_read64 (rvu,BLKADDR_APR ,APR_AF_LMT_MAP_BASE );
@@ -35,6 +39,13 @@ static int lmtst_map_table_ops(struct rvu *rvu, u32 index, u64 *val, *val =readq (lmt_map_base + index); }else {writeq ((*val), (lmt_map_base + index)); + + cfg =FIELD_PREP (LMT_MAP_ENTRY_ENA ,0x1 ); +/* 2048 LMTLINES */ + cfg |=FIELD_PREP (LMT_MAP_ENTRY_LINES ,0x6 ); + +writeq (cfg, (lmt_map_base + (index +8 ))); +/* Flushing the AP interceptor cache to make APR_LMT_MAP_ENTRY_S * changes effective. Write 1 for flush and read is being used as a * barrier and sets up a data dependency. Write to 0 after a write
@@ -52,7 +63,7 @@ static int lmtst_map_table_ops(struct rvu *rvu, u32 index, u64 *val,#define LMT_MAP_TBL_W1_OFF 8static u32 rvu_get_lmtst_tbl_index (struct rvu *rvu,u16 pcifunc) { -return ((rvu_get_pf (pcifunc) * rvu->hw->total_vfs) + +return ((rvu_get_pf (pcifunc) *LMT_MAX_VFS ) + (pcifunc &RVU_PFVF_FUNC_MASK )) *LMT_MAPTBL_ENTRY_SIZE ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 249/325 octeontx2-af: Fix APR entry mapping based on APR_LMT_CFG
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geetha sowjanya <[email protected]>
[ Upstream commit a6ae7129819ad20788e610261246e71736543b8b ]
The current implementation maps the APR table using a fixed size, which can lead to incorrect mapping when the number of PFs and VFs varies.
This patch corrects the mapping by calculating the APR table size dynamically based on the values configured in the APR_LMT_CFG register, ensuring accurate representation of APR entries in debugfs.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c | 9 ++++++--- .../net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 11 ++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c +6 -3
@@ -13,7 +13,6 @@/* RVU LMTST */ #define LMT_TBL_OP_READ 0#define LMT_TBL_OP_WRITE 1 -#define LMT_MAP_TABLE_SIZE (128 * 1024)#define LMT_MAPTBL_ENTRY_SIZE 16#define LMT_MAX_VFS 256
@@ -26,10 +25,14 @@ static int lmtst_map_table_ops(struct rvu *rvu, u32 index, u64 *val, {void __iomem *lmt_map_base;u64 tbl_base, cfg; +int pfs, vfs; tbl_base =rvu_read64 (rvu,BLKADDR_APR ,APR_AF_LMT_MAP_BASE ); + cfg =rvu_read64 (rvu,BLKADDR_APR ,APR_AF_LMT_CFG ); + vfs =1 << (cfg &0xF ); + pfs =1 << ((cfg >>4 ) &0x7 ); - lmt_map_base =ioremap_wc (tbl_base,LMT_MAP_TABLE_SIZE ); + lmt_map_base =ioremap_wc (tbl_base, pfs * vfs *LMT_MAPTBL_ENTRY_SIZE );if (!lmt_map_base) {dev_err (rvu->dev,"Failed to setup lmt map table mapping!!\n" );return -ENOMEM ;
@@ -80,7 +83,7 @@ static int rvu_get_lmtaddr(struct rvu *rvu, u16 pcifunc,mutex_lock (&rvu->rsrc_lock);rvu_write64 (rvu,BLKADDR_RVUM ,RVU_AF_SMMU_ADDR_REQ , iova); - pf =rvu_get_pf (pcifunc) &0x1F ; + pf =rvu_get_pf (pcifunc) &RVU_PFVF_PF_MASK ; val =BIT_ULL (63 ) |BIT_ULL (14 ) |BIT_ULL (13 ) | pf <<8 | ((pcifunc &RVU_PFVF_FUNC_MASK ) &0xFF );rvu_write64 (rvu,BLKADDR_RVUM ,RVU_AF_SMMU_TXN_REQ , val);
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +8 -3
@@ -580,6 +580,7 @@ static ssize_t rvu_dbg_lmtst_map_table_display(struct file *filp,u64 lmt_addr, val, tbl_base;int pf, vf, num_vfs, hw_vfs;void __iomem *lmt_map_base; +int apr_pfs, apr_vfs;int buf_size =10240 ;size_t off =0 ;int index =0 ;
@@ -595,8 +596,12 @@ static ssize_t rvu_dbg_lmtst_map_table_display(struct file *filp,return -ENOMEM ; tbl_base =rvu_read64 (rvu,BLKADDR_APR ,APR_AF_LMT_MAP_BASE ); + val =rvu_read64 (rvu,BLKADDR_APR ,APR_AF_LMT_CFG ); + apr_vfs =1 << (val &0xF ); + apr_pfs =1 << ((val >>4 ) &0x7 ); - lmt_map_base =ioremap_wc (tbl_base,128 *1024 ); + lmt_map_base =ioremap_wc (tbl_base, apr_pfs * apr_vfs * +LMT_MAPTBL_ENTRY_SIZE );if (!lmt_map_base) {dev_err (rvu->dev,"Failed to setup lmt map table mapping!!\n" );kfree (buf);
@@ -618,7 +623,7 @@ static ssize_t rvu_dbg_lmtst_map_table_display(struct file *filp, off +=scnprintf (&buf[off], buf_size -1 - off,"PF%d \t\t\t" , pf); - index = pf * rvu->hw->total_vfs *LMT_MAPTBL_ENTRY_SIZE ; + index = pf * apr_vfs *LMT_MAPTBL_ENTRY_SIZE ; off +=scnprintf (&buf[off], buf_size -1 - off," 0x%llx\t\t" , (tbl_base + index)); lmt_addr =readq (lmt_map_base + index);
@@ -631,7 +636,7 @@ static ssize_t rvu_dbg_lmtst_map_table_display(struct file *filp,/* Reading num of VFs per PF */ rvu_get_pf_numvfs (rvu, pf, &num_vfs, &hw_vfs);for (vf =0 ; vf < num_vfs; vf++) { - index = (pf * rvu->hw->total_vfs *16 ) + + index = (pf * apr_vfs *LMT_MAPTBL_ENTRY_SIZE ) + ((vf +1 ) *LMT_MAPTBL_ENTRY_SIZE ); off +=scnprintf (&buf[off], buf_size -1 - off,"PF%d:VF%d \t\t" , pf, vf);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 250/325 crypto: algif_hash - fix double free in hash_accept
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Pravdin <[email protected]>
commit b2df03ed4052e97126267e8c13ad4204ea6ba9b6 upstream.
If accept(2) is called on socket type algif_hash with MSG_MORE flag set and crypto_ahash_import fails, sk2 is freed. However, it is also freed in af_alg_release, leading to slab-use-after-free error.
--- crypto/algif_hash.c | 4 ---- 1 file changed, 4 deletions(-)
crypto/algif_hash.c +0 -4
@@ -263,10 +263,6 @@ static int hash_accept(struct socket *soreturn err; err =crypto_ahash_import (&ctx2->req, state); -if (err) { -sock_orphan (sk2); -sock_put (sk2); - }return err; }
Greg Kroah-Hartman
maintainerPATCH 251/325 padata: do not leak refcount in reorder_work
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominik Grzegorzek <[email protected]>
commit d6ebcde6d4ecf34f8495fb30516645db3aea8993 upstream.
A recent patch that addressed a UAF introduced a reference count leak:
the parallel_data refcount is incremented unconditionally, regardless of the return value of queue_work(). If the work item is already queued, the incremented refcount is never decremented.
Fix this by checking the return value of queue_work() and decrementing the refcount when necessary.
Resolves:
Unreferenced object 0xffff9d9f421e3d80 (size 192):
comm "cryptomgr_probe", pid 157, jiffies 4294694003 hex dump (first 32 bytes):
80 8b cf 41 9f 9d ff ff b8 97 e0 89 ff ff ff ff ...A............
d0 97 e0 89 ff ff ff ff 19 00 00 00 1f 88 23 00 ..............#.
backtrace (crc 838fb36):
__kmalloc_cache_noprof+0x284/0x320
padata_alloc_pd+0x20/0x1e0
padata_alloc_shell+0x3b/0xa0
0xffffffffc040a54d
cryptomgr_probe+0x43/0xc0
kthread+0xf6/0x1f0
ret_from_fork+0x2f/0x50
ret_from_fork_asm+0x1a/0x30--- kernel/padata.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/padata.c +2 -1
@@ -350,7 +350,8 @@ static void padata_reorder(struct parall* To avoid UAF issue, add pd ref here, and put pd ref after reorder_work finish. */ padata_get_pd (pd); -queue_work (pinst->serial_wq, &pd->reorder_work); +if (!queue_work (pinst->serial_wq, &pd->reorder_work)) +padata_put_pd (pd); } }
Greg Kroah-Hartman
maintainerPATCH 252/325 can: slcan: allow reception of short error messages
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlos Sanchez <[email protected]>
commit ef0841e4cb08754be6cb42bf97739fce5d086e5f upstream.
Allows slcan to receive short messages (typically errors) from the serial interface.
When error support was added to slcan protocol in b32ff4668544e1333b694fcc7812b2d7397b4d6a ("can: slcan: extend the protocol with error info") the minimum valid message size changed from 5 (minimum standard can frame tIII0) to 3 ("e1a" is a valid protocol message, it is one of the examples given in the comments for slcan_bump_err() ), but the check for minimum message length prodicating all decoding was not adjusted. This makes short error messages discarded and error frames not being generated.
This patch changes the minimum length to the new minimum (3 characters, excluding terminator, is now a valid message).
--- drivers/net/can/slcan/slcan-core.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/net/can/slcan/slcan-core.c +20 -6
@@ -71,12 +71,21 @@ MODULE_AUTHOR("Dario Binacchi <dario.bin#define SLCAN_CMD_LEN 1#define SLCAN_SFF_ID_LEN 3#define SLCAN_EFF_ID_LEN 8 +#define SLCAN_DATA_LENGTH_LEN 1 +#define SLCAN_ERROR_LEN 1#define SLCAN_STATE_LEN 1#define SLCAN_STATE_BE_RXCNT_LEN 3#define SLCAN_STATE_BE_TXCNT_LEN 3 -#define SLCAN_STATE_FRAME_LEN (1 + SLCAN_CMD_LEN + \ - SLCAN_STATE_BE_RXCNT_LEN + \ - SLCAN_STATE_BE_TXCNT_LEN) +#define SLCAN_STATE_MSG_LEN (SLCAN_CMD_LEN + \ + SLCAN_STATE_LEN + \ + SLCAN_STATE_BE_RXCNT_LEN + \ + SLCAN_STATE_BE_TXCNT_LEN) +#define SLCAN_ERROR_MSG_LEN_MIN (SLCAN_CMD_LEN + \ + SLCAN_ERROR_LEN + \ + SLCAN_DATA_LENGTH_LEN) +#define SLCAN_FRAME_MSG_LEN_MIN (SLCAN_CMD_LEN + \ + SLCAN_SFF_ID_LEN + \ + SLCAN_DATA_LENGTH_LEN)struct slcan {struct can_priv can;
@@ -176,6 +185,9 @@ static void slcan_bump_frame(struct slcau32 tmpid;char *cmd = sl->rbuff; +if (sl->rcount <SLCAN_FRAME_MSG_LEN_MIN ) +return ; + skb =alloc_can_skb (sl->dev, &cf);if (unlikely (!skb)) { sl->dev->stats.rx_dropped++;
@@ -281,7 +293,7 @@ static void slcan_bump_state(struct slcareturn ; } -if (state == sl->can.state || sl->rcount <SLCAN_STATE_FRAME_LEN ) +if (state == sl->can.state || sl->rcount !=SLCAN_STATE_MSG_LEN )return ; cmd +=SLCAN_STATE_BE_RXCNT_LEN +SLCAN_CMD_LEN +1 ;
@@ -328,6 +340,9 @@ static void slcan_bump_err(struct slcanbool rx_errors = false, tx_errors = false, rx_over_errors = false;int i, len; +if (sl->rcount <SLCAN_ERROR_MSG_LEN_MIN ) +return ; +/* get len from sanitized ASCII value */ len = cmd[1 ];if (len >='0' && len <'9' )
@@ -456,8 +471,7 @@ static void slcan_bump(struct slcan *sl)static void slcan_unesc (struct slcan *sl,unsigned char s) {if ((s =='\r' ) || (s =='\a' )) {/* CR or BEL ends the pdu */ -if (!test_and_clear_bit (SLF_ERROR , &sl->flags) && - sl->rcount >4 ) +if (!test_and_clear_bit (SLF_ERROR , &sl->flags))slcan_bump (sl); sl->rcount =0 ;
Greg Kroah-Hartman
maintainerPATCH 253/325 can: bcm: add locking for bcm_op runtime updates
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Hartkopp <[email protected]>
commit c2aba69d0c36a496ab4f2e81e9c2b271f2693fd7 upstream.
The CAN broadcast manager (CAN BCM) can send a sequence of CAN frames via hrtimer. The content and also the length of the sequence can be changed resp reduced at runtime where the 'currframe' counter is then set to zero.
Although this appeared to be a safe operation the updates of 'currframe' can be triggered from user space and hrtimer context in bcm_can_tx(). Anderson Nascimento created a proof of concept that triggered a KASAN slab-out-of-bounds read access which can be prevented with a spin_lock_bh.
At the rework of bcm_can_tx() the 'count' variable has been moved into the protected section as this variable can be modified from both contexts too.
--- net/can/bcm.c | 66 +++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 21 deletions(-)
net/can/bcm.c +45 -21
@@ -58,6 +58,7 @@#include <linux/can/skb.h> #include <linux/can/bcm.h> #include <linux/slab.h> +#include <linux/spinlock.h> #include <net/sock.h> #include <net/net_namespace.h>
@@ -120,6 +121,7 @@ struct bcm_op {struct canfd_frame last_sframe;struct sock *sk;struct net_device *rx_reg_dev; +spinlock_t bcm_tx_lock;/* protect currframe/count in runtime updates */ };struct bcm_sock {
@@ -273,13 +275,18 @@ static void bcm_can_tx(struct bcm_op *op {struct sk_buff *skb;struct net_device *dev; -struct canfd_frame *cf = op->frames + op->cfsiz * op->currframe; +struct canfd_frame *cf;int err;/* no target device? => exit */ if (!op->ifindex)return ; +/* read currframe under lock protection */ +spin_lock_bh (&op->bcm_tx_lock); + cf = op->frames + op->cfsiz * op->currframe; +spin_unlock_bh (&op->bcm_tx_lock); + dev =dev_get_by_index (sock_net (op->sk), op->ifindex);if (!dev) {/* RFC: should this bcm_op remove itself here? */
@@ -300,6 +307,10 @@ static void bcm_can_tx(struct bcm_op *op skb->dev = dev;can_skb_set_owner (skb, op->sk); err =can_send (skb,1 ); + +/* update currframe and count under lock protection */ +spin_lock_bh (&op->bcm_tx_lock); +if (!err) op->frames_abs++;
@@ -308,6 +319,11 @@ static void bcm_can_tx(struct bcm_op *op/* reached last frame? */ if (op->currframe >= op->nframes) op->currframe =0 ; + +if (op->count >0 ) + op->count--; + +spin_unlock_bh (&op->bcm_tx_lock); out:dev_put (dev); }
@@ -404,7 +420,7 @@ static enum hrtimer_restart bcm_tx_timeostruct bcm_msg_head msg_head;if (op->kt_ival1 && (op->count >0 )) { - op->count--; +bcm_can_tx (op);if (!op->count && (op->flags &TX_COUNTEVT )) {/* create notification to user */
@@ -419,7 +435,6 @@ static enum hrtimer_restart bcm_tx_timeobcm_send_to_user (op, &msg_head,NULL ,0 ); } -bcm_can_tx (op); }else if (op->kt_ival2) {bcm_can_tx (op);
@@ -914,6 +929,27 @@ static int bcm_tx_setup(struct bcm_msg_h } op->flags = msg_head->flags; +/* only lock for unlikely count/nframes/currframe changes */ +if (op->nframes != msg_head->nframes || + op->flags &TX_RESET_MULTI_IDX || + op->flags &SETTIMER ) { + +spin_lock_bh (&op->bcm_tx_lock); + +if (op->nframes != msg_head->nframes || + op->flags &TX_RESET_MULTI_IDX ) { +/* potentially update changed nframes */ + op->nframes = msg_head->nframes; +/* restart multiple frame transmission */ + op->currframe =0 ; + } + +if (op->flags &SETTIMER ) + op->count = msg_head->count; + +spin_unlock_bh (&op->bcm_tx_lock); + } + }else {/* insert new BCM operation for the given can_id */
@@ -921,9 +957,14 @@ static int bcm_tx_setup(struct bcm_msg_hif (!op)return -ENOMEM ; +spin_lock_init (&op->bcm_tx_lock); op->can_id = msg_head->can_id; op->cfsiz =CFSIZ (msg_head->flags); op->flags = msg_head->flags; + op->nframes = msg_head->nframes; + +if (op->flags &SETTIMER ) + op->count = msg_head->count;/* create array for CAN frames and copy the data */ if (msg_head->nframes >1 ) {
@@ -982,22 +1023,8 @@ static int bcm_tx_setup(struct bcm_msg_h }/* if ((op = bcm_find_op(&bo->tx_ops, msg_head->can_id, ifindex))) */ -if (op->nframes != msg_head->nframes) { - op->nframes = msg_head->nframes; -/* start multiple frame transmission with index 0 */ - op->currframe =0 ; - } - -/* check flags */ - -if (op->flags &TX_RESET_MULTI_IDX ) { -/* start multiple frame transmission with index 0 */ - op->currframe =0 ; - } -if (op->flags &SETTIMER ) {/* set timer values */ - op->count = msg_head->count; op->ival1 = msg_head->ival1; op->ival2 = msg_head->ival2; op->kt_ival1 =bcm_timeval_to_ktime (msg_head->ival1);
@@ -1014,11 +1041,8 @@ static int bcm_tx_setup(struct bcm_msg_h op->flags |=TX_ANNOUNCE ; } -if (op->flags &TX_ANNOUNCE ) { +if (op->flags &TX_ANNOUNCE )bcm_can_tx (op); -if (op->count) - op->count--; - }if (op->flags &STARTTIMER )bcm_tx_start_timer (op);
Greg Kroah-Hartman
maintainerPATCH 254/325 can: bcm: add missing rcu read protection for procfs content
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Hartkopp <[email protected]>
commit dac5e6249159ac255dad9781793dbe5908ac9ddb upstream.
When the procfs content is generated for a bcm_op which is in the process to be removed the procfs output might show unreliable data (UAF).
As the removal of bcm_op's is already implemented with rcu handling this patch adds the missing rcu_read_lock() and makes sure the list entries are properly removed under rcu protection.
--- net/can/bcm.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
net/can/bcm.c +9 -4
@@ -207,7 +207,9 @@ static int bcm_proc_show(struct seq_fileseq_printf (m," / bound %s" ,bcm_proc_getifname (net, ifname, bo->ifindex));seq_printf (m," <<<\n" ); -list_for_each_entry (op, &bo->rx_ops, list) { +rcu_read_lock (); + +list_for_each_entry_rcu (op, &bo->rx_ops, list) {unsigned long reduction;
@@ -263,6 +265,9 @@ static int bcm_proc_show(struct seq_file seq_printf(m, "# sent %ld\n", op->frames_abs); }seq_putc (m,'\n' ); + +rcu_read_unlock (); +return 0 ; }#endif /* CONFIG_PROC_FS */
@@ -816,7 +821,7 @@ static int bcm_delete_rx_op(struct list_REGMASK (op->can_id), bcm_rx_handler, op); -list_del (&op->list); +list_del_rcu (&op->list);bcm_remove_op (op);return 1 ;/* done */ }
@@ -836,7 +841,7 @@ static int bcm_delete_tx_op(struct list_list_for_each_entry_safe (op, n, ops, list) {if ((op->can_id == mh->can_id) && (op->ifindex == ifindex) && (op->flags &CAN_FD_FRAME ) == (mh->flags &CAN_FD_FRAME )) { -list_del (&op->list); +list_del_rcu (&op->list);bcm_remove_op (op);return 1 ;/* done */ }
@@ -1258,7 +1263,7 @@ static int bcm_rx_setup(struct bcm_msg_h bcm_rx_handler, op, "bcm", sk);if (err) {/* this bcm rx op is broken -> remove it */ -list_del (&op->list); +list_del_rcu (&op->list);bcm_remove_op (op);return err; }
Greg Kroah-Hartman
maintainerPATCH 255/325 ALSA: pcm: Fix race of buffer access at PCM OSS layer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 93a81ca0657758b607c3f4ba889ae806be9beb73 upstream.
The PCM OSS layer tries to clear the buffer with the silence data at initialization (or reconfiguration) of a stream with the explicit call of snd_pcm_format_set_silence() with runtime->dma_area. But this may lead to a UAF because the accessed runtime->dma_area might be freed concurrently, as it's performed outside the PCM ops.
For avoiding it, move the code into the PCM core and perform it inside the buffer access lock, so that it won't be changed during the operation.
--- include/sound/pcm.h | 2 ++ sound/core/oss/pcm_oss.c | 3 +-- sound/core/pcm_native.c | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-)
include/sound/pcm.h +2 -0
@@ -1429,6 +1429,8 @@ int snd_pcm_lib_mmap_iomem(struct snd_pc#define snd_pcm_lib_mmap_iomem NULL#endif +void snd_pcm_runtime_buffer_set_silence (struct snd_pcm_runtime *runtime); +/** * snd_pcm_limit_isa_dma_size - Get the max size fitting with ISA DMA transfer * @dma: DMA number
sound/core/oss/pcm_oss.c +1 -2
@@ -1085,8 +1085,7 @@ static int snd_pcm_oss_change_params_loc runtime->oss.params =0 ; runtime->oss.prepare =1 ; runtime->oss.buffer_used =0 ; -if (runtime->dma_area) -snd_pcm_format_set_silence (runtime->format, runtime->dma_area,bytes_to_samples (runtime, runtime->dma_bytes)); +snd_pcm_runtime_buffer_set_silence (runtime); runtime->oss.period_frames =snd_pcm_alsa_frames (substream, oss_period_size);
sound/core/pcm_native.c +11 -0
@@ -703,6 +703,17 @@ static void snd_pcm_buffer_access_unlockatomic_inc (&runtime->buffer_accessing); } +/* fill the PCM buffer with the current silence format; called from pcm_oss.c */ +void snd_pcm_runtime_buffer_set_silence (struct snd_pcm_runtime *runtime) +{ +snd_pcm_buffer_access_lock (runtime); +if (runtime->dma_area) +snd_pcm_format_set_silence (runtime->format, runtime->dma_area, +bytes_to_samples (runtime, runtime->dma_bytes)); +snd_pcm_buffer_access_unlock (runtime); +} +EXPORT_SYMBOL_GPL (snd_pcm_runtime_buffer_set_silence); +#if IS_ENABLED (CONFIG_SND_PCM_OSS )#define is_oss_stream (substream) ((substream)->oss.oss)#else
Greg Kroah-Hartman
maintainerPATCH 256/325 ALSA: hda/realtek: Add quirk for Lenovo Yoga Pro 7 14ASP10
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ed Burcher <[email protected]>
commit 8d70503068510e6080c2c649cccb154f16de26c9 upstream.
Lenovo Yoga Pro 7 (gen 10) with Realtek ALC3306 and combined CS35L56 amplifiers need quirk ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN to enable bass
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10379,6 +10379,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x17aa ,0x3866 ,"Lenovo 13X" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x17aa ,0x3869 ,"Lenovo Yoga7 14IAL7" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ),SND_PCI_QUIRK (0x17aa ,0x3902 ,"Lenovo E50-80" ,ALC269_FIXUP_DMIC_THINKPAD_ACPI ), +SND_PCI_QUIRK (0x17aa ,0x390d ,"Lenovo Yoga Pro 7 14ASP10" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ),SND_PCI_QUIRK (0x17aa ,0x3913 ,"Lenovo 145" ,ALC236_FIXUP_LENOVO_INV_DMIC ),SND_PCI_QUIRK (0x17aa ,0x3977 ,"IdeaPad S210" ,ALC283_FIXUP_INT_MIC ), SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Greg Kroah-Hartman
maintainerPATCH 257/325 llc: fix data loss when reading from a socket in llc_ui_recvmsg()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilia Gavrilov <[email protected]>
commit 239af1970bcb039a1551d2c438d113df0010c149 upstream.
For SOCK_STREAM sockets, if user buffer size (len) is less than skb size (skb->len), the remaining data from skb will be lost after calling kfree_skb().
To fix this, move the statement for partial reading above skb deletion.
Found by InfoTeCS on behalf of Linux Verification Center (linuxtesting.org)
--- net/llc/af_llc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/llc/af_llc.c +4 -4
@@ -888,15 +888,15 @@ static int llc_ui_recvmsg(struct socketif (sk->sk_type !=SOCK_STREAM ) goto copy_uaddr; +/* Partial read */ +if (used + offset < skb_len) +continue ; +if (!(flags &MSG_PEEK )) {skb_unlink (skb, &sk->sk_receive_queue);kfree_skb (skb); *seq =0 ; } - -/* Partial read */ -if (used + offset < skb_len) -continue ; }while (len >0 ); out:
Greg Kroah-Hartman
maintainerPATCH 258/325 platform/x86: dell-wmi-sysman: Avoid buffer overflow in current_password_store()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Moskovkin <[email protected]>
commit 4e89a4077490f52cde652d17e32519b666abf3a6 upstream.
If the 'buf' array received from the user contains an empty string, the 'length' variable will be zero. Accessing the 'buf' array element with index 'length - 1' will result in a buffer overflow.
Add a check for an empty string.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c +1 -1
@@ -45,7 +45,7 @@ static ssize_t current_password_store(stint length; length =strlen (buf); -if (buf[length-1 ] =='\n' ) +if (length && buf[length -1 ] =='\n' ) length--;/* firmware does verifiation of min/max password length,
Greg Kroah-Hartman
maintainerPATCH 259/325 drm/edid: fixed the bug that hdr metadata was not reset
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: feijuan.li <[email protected]>
commit 6692dbc15e5ed40a3aa037aced65d7b8826c58cd upstream.
When DP connected to a device with HDR capability, the hdr structure was filled.Then connected to another sink device without hdr capability, but the hdr info still exist.
--- drivers/gpu/drm/drm_edid.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_edid.c +1 -0
@@ -6164,6 +6164,7 @@ static void drm_reset_display_info(struc info->has_hdmi_infoframe = false; info->rgb_quant_range_selectable = false;memset (&info->hdmi,0 ,sizeof (info->hdmi)); +memset (&connector->hdr_sink_metadata,0 ,sizeof (connector->hdr_sink_metadata)); info->edid_hdmi_rgb444_dc_modes =0 ; info->edid_hdmi_ycbcr444_dc_modes =0 ;
Greg Kroah-Hartman
maintainerPATCH 260/325 smb: client: Fix use-after-free in cifs_fill_dirent
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Zhaolong <[email protected]>
commit a7a8fe56e932a36f43e031b398aef92341bf5ea0 upstream.
There is a race condition in the readdir concurrency process, which may access the rsp buffer after it has been released, triggering the following KASAN warning.
==================================================================
BUG: KASAN: slab-use-after-free in cifs_fill_dirent+0xb03/0xb60 [cifs]
Read of size 4 at addr ffff8880099b819c by task a.out/342975
CPU: 2 UID: 0 PID: 342975 Comm: a.out Not tainted 6.15.0-rc6+ #240 PREEMPT(full)
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x53/0x70
print_report+0xce/0x640
kasan_report+0xb8/0xf0
cifs_fill_dirent+0xb03/0xb60 [cifs]
cifs_readdir+0x12cb/0x3190 [cifs]
iterate_dir+0x1a1/0x520
__x64_sys_getdents+0x134/0x220
do_syscall_64+0x4b/0x110
entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7f996f64b9f9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89
f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01
f0 ff ff 0d f7 c3 0c 00 f7 d8 64 89 8
RSP: 002b:00007f996f53de78 EFLAGS: 00000207 ORIG_RAX: 000000000000004e
RAX: ffffffffffffffda RBX: 00007f996f53ecdc RCX: 00007f996f64b9f9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00007f996f53dea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000207 R12: ffffffffffffff88
R13: 0000000000000000 R14: 00007ffc8cd9a500 R15: 00007f996f51e000
</TASK>
Allocated by task 408:
kasan_save_stack+0x20/0x40
kasan_save_track+0x14/0x30
__kasan_slab_alloc+0x6e/0x70
kmem_cache_alloc_noprof+0x117/0x3d0
mempool_alloc_noprof+0xf2/0x2c0
cifs_buf_get+0x36/0x80 [cifs]
allocate_buffers+0x1d2/0x330 [cifs]
cifs_demultiplex_thread+0x22b/0x2690 [cifs]
kthread+0x394/0x720
ret_from_fork+0x34/0x70
ret_from_fork_asm+0x1a/0x30
Freed by task 342979:
kasan_save_stack+0x20/0x40
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x37/0x50
kmem_cache_free+0x2b8/0x500
cifs_buf_release+0x3c/0x70 [cifs]
cifs_readdir+0x1c97/0x3190 [cifs]
iterate_dir+0x1a1/0x520
__x64_sys_getdents64+0x134/0x220
do_syscall_64+0x4b/0x110
entry_SYSCALL_64_after_hwframe+0x76/0x7e
The buggy address belongs to the object at ffff8880099b8000
which belongs to the cache cifs_request of size 16588
The buggy address is located 412 bytes inside of
freed 16588-byte region [ffff8880099b8000, ffff8880099bc0cc)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x99b8
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0x80000000000040(head|node=0|zone=1)
page_type: f5(slab)
raw: 0080000000000040 ffff888001e03400 0000000000000000 dead000000000001
raw: 0000000000000000 0000000000010001 00000000f5000000 0000000000000000
head: 0080000000000040 ffff888001e03400 0000000000000000 dead000000000001
head: 0000000000000000 0000000000010001 00000000f5000000 0000000000000000
head: 0080000000000003 ffffea0000266e01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8880099b8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880099b8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880099b8180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880099b8200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880099b8280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================POC is available in the link [1].
The problem triggering process is as follows:
Process 1 Process 2
-----------------------------------------------------------------cifs_readdir
/* file->private_data == NULL */
initiate_cifs_search
cifsFile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);
smb2_query_dir_first ->query_dir_first()
SMB2_query_directory
SMB2_query_directory_init
cifs_send_recv
smb2_parse_query_directory
srch_inf->ntwrk_buf_start = (char *)rsp;
srch_inf->srch_entries_start = (char *)rsp + ...
srch_inf->last_entry = (char *)rsp + ...
srch_inf->smallBuf = true;
find_cifs_entry
/* if (cfile->srch_inf.ntwrk_buf_start) */
cifs_small_buf_release(cfile->srch_inf // free
cifs_readdir ->iterate_shared()
/* file->private_data != NULL */
find_cifs_entry
/* in while (...) loop */
smb2_query_dir_next ->query_dir_next()
SMB2_query_directory
SMB2_query_directory_init
cifs_send_recv
compound_send_recv
smb_send_rqst
__smb_send_rqst
rc = -ERESTARTSYS;
/* if (fatal_signal_pending()) */
goto out;
return rc
/* if (cfile->srch_inf.last_entry) */
cifs_save_resume_key()
cifs_fill_dirent // UAF
/* if (rc) */
return -ENOENT;Fix this by ensuring the return code is checked before using pointers from the srch_inf.
--- fs/smb/client/readdir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/smb/client/readdir.c +2 -2
@@ -788,11 +788,11 @@ find_cifs_entry(const unsigned int xid, rc = server->ops->query_dir_next (xid, tcon, &cfile->fid, search_flags, &cfile->srch_inf); +if (rc) +return -ENOENT ;/* FindFirst/Next set last_entry to NULL on malformed reply */ if (cfile->srch_inf.last_entry)cifs_save_resume_key (cfile->srch_inf.last_entry, cfile); -if (rc) -return -ENOENT ; }if (index_to_find < cfile->srch_inf.index_of_last_entry) {/* we found the buffer that contains the entry */
Greg Kroah-Hartman
maintainerPATCH 261/325 smb: client: Reset all search buffer pointers when releasing buffer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Zhaolong <[email protected]>
commit e48f9d849bfdec276eebf782a84fd4dfbe1c14c0 upstream.
Multiple pointers in struct cifs_search_info (ntwrk_buf_start, srch_entries_start, and last_entry) point to the same allocated buffer. However, when freeing this buffer, only ntwrk_buf_start was set to NULL, while the other pointers remained pointing to freed memory.
This is defensive programming to prevent potential issues with stale pointers. While the active UAF vulnerability is fixed by the previous patch, this change ensures consistent pointer state and more robust error handling.
--- fs/smb/client/readdir.c | 3 +++ 1 file changed, 3 insertions(+)
fs/smb/client/readdir.c +3 -0
@@ -765,7 +765,10 @@ find_cifs_entry(const unsigned int xid,else cifs_buf_release (cfile->srch_inf. ntwrk_buf_start); +/* Reset all pointers to the network buffer to prevent stale references */ cfile->srch_inf.ntwrk_buf_start =NULL ; + cfile->srch_inf.srch_entries_start =NULL ; + cfile->srch_inf.last_entry =NULL ; } rc =initiate_cifs_search (xid, file, full_path);if (rc) {
Greg Kroah-Hartman
maintainerPATCH 262/325 Revert "drm/amd: Keep display off while going into S4"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
commit 7e7cb7a13c81073d38a10fa7b450d23712281ec4 upstream.
commit 68bfdc8dc0a1a ("drm/amd: Keep display off while going into S4") attempted to keep displays off during the S4 sequence by not resuming display IP. This however leads to hangs because DRM clients such as the console can try to access registers and cause a hang.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -5
@@ -2897,11 +2897,6 @@ static int dm_resume(void *handle)return 0 ; } - -/* leave display off for S4 sequence */ -if (adev->in_s4) -return 0 ; -/* Recreate dc_state - DC invalidates it when setting power state to S3. */ dc_release_state (dm_state->context); dm_state->context =dc_create_state (dm->dc);
Greg Kroah-Hartman
maintainerPATCH 263/325 memcg: always call cond_resched() after fn()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
commit 06717a7b6c86514dbd6ab322e8083ffaa4db5712 upstream.
I am seeing soft lockup on certain machine types when a cgroup OOMs. This is happening because killing the process in certain machine might be very slow, which causes the soft lockup and RCU stalls. This happens usually when the cgroup has MANY processes and memory.oom.group is set.
Example I am seeing in real production:
[462012.244552] Memory cgroup out of memory: Killed process 3370438 (crosvm) ....
....
[462037.318059] Memory cgroup out of memory: Killed process 4171372 (adb) ....
[462037.348314] watchdog: BUG: soft lockup - CPU#64 stuck for 26s! [stat_manager-ag:1618982]
....Quick look at why this is so slow, it seems to be related to serial flush for certain machine types. For all the crashes I saw, the target CPU was at console_flush_all().
In the case above, there are thousands of processes in the cgroup, and it is soft locking up before it reaches the 1024 limit in the code (which would call the cond_resched()). So, cond_resched() in 1024 blocks is not sufficient.
Remove the counter-based conditional rescheduling logic and call cond_resched() unconditionally after each task iteration, after fn() is called. This avoids the lockup independently of how slow fn() is.
--- mm/memcontrol.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
mm/memcontrol.c +2 -4
@@ -1242,7 +1242,6 @@ int mem_cgroup_scan_tasks(struct mem_cgr {struct mem_cgroup *iter;int ret =0 ; -int i =0 ;BUG_ON (memcg == root_mem_cgroup);
@@ -1252,10 +1251,9 @@ int mem_cgroup_scan_tasks(struct mem_cgrcss_task_iter_start (&iter->css,CSS_TASK_ITER_PROCS , &it);while (!ret && (task =css_task_iter_next (&it))) { -/* Avoid potential softlockup warning */ -if ((++i &1023 ) ==0 ) -cond_resched (); ret =fn (task, arg); +/* Avoid potential softlockup warning */ +cond_resched (); }css_task_iter_end (&it);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 264/325 mm/page_alloc.c: avoid infinite retries caused by cpuset race
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tianyang Zhang <[email protected]>
commit e05741fb10c38d70bbd7ec12b23c197b6355d519 upstream.
__alloc_pages_slowpath has no change detection for ac->nodemask in the part of retry path, while cpuset can modify it in parallel. For some processes that set mempolicy as MPOL_BIND, this results ac->nodemask changes, and then the should_reclaim_retry will judge based on the latest nodemask and jump to retry, while the get_page_from_freelist only traverses the zonelist from ac->preferred_zoneref, which selected by a expired nodemask and may cause infinite retries in some cases
cpu 64:
__alloc_pages_slowpath {
/* ..... */
retry:
/* ac->nodemask = 0x1, ac->preferred->zone->nid = 1 */
if (alloc_flags & ALLOC_KSWAPD)
wake_all_kswapds(order, gfp_mask, ac);
/* cpu 1:
cpuset_write_resmask
update_nodemask
update_nodemasks_hier
update_tasks_nodemask
mpol_rebind_task
mpol_rebind_policy
mpol_rebind_nodemask
// mempolicy->nodes has been modified,
// which ac->nodemask point to
*/
/* ac->nodemask = 0x3, ac->preferred->zone->nid = 1 */
if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags,
did_some_progress > 0, &no_progress_loops))
goto retry;
}Simultaneously starting multiple cpuset01 from LTP can quickly reproduce this issue on a multi node server when the maximum memory pressure is reached and the swap is enabled
--- mm/page_alloc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
mm/page_alloc.c +8 -0
@@ -5195,6 +5195,14 @@ restart: } retry: +/* +* Deal with possible cpuset update races or zonelist updates to avoid +* infinite retries. +*/ +if (check_retry_cpuset (cpuset_mems_cookie, ac) || +check_retry_zonelist (zonelist_iter_cookie)) + goto restart; +/* Ensure kswapd doesn't accidentally go to sleep as long as we loop */ if (alloc_flags &ALLOC_KSWAPD )wake_all_kswapds (order, gfp_mask, ac);
Greg Kroah-Hartman
maintainerPATCH 265/325 Revert "arm64: dts: allwinner: h6: Use RSB for AXP805 PMIC connection"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jernej Skrabec <[email protected]>
[ Upstream commit 573f99c7585f597630f14596550c79e73ffaeef4 ]
This reverts commit 531fdbeedeb89bd32018a35c6e137765c9cc9e97.
Hardware that uses I2C wasn't designed with high speeds in mind, so communication with PMIC via RSB can intermittently fail. Go back to I2C as higher speed and efficiency isn't worth the trouble.
--- .../dts/allwinner/sun50i-h6-beelink-gs1.dts | 38 +++++++++---------- .../dts/allwinner/sun50i-h6-orangepi-3.dts | 14 +++---- .../dts/allwinner/sun50i-h6-orangepi.dtsi | 22 +++++------ 3 files changed, 37 insertions(+), 37 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts +19 -19
@@ -151,28 +151,12 @@ vcc-pg-supply = <®_aldo1>; }; -&r_ir { - linux,rc-map-name = "rc-beelink-gs1"; - status = "okay"; -}; - -&r_pio { - /* - * FIXME: We can't add that supply for now since it would - * create a circular dependency between pinctrl, the regulator - * and the RSB Bus. - * - * vcc-pl-supply = <®_aldo1>; - */ - vcc-pm-supply = <®_aldo1>; -}; - -&r_rsb { +&r_i2c { status = "okay"; - axp805: pmic@745 { + axp805: pmic@36 { compatible = "x-powers,axp805", "x-powers,axp806"; - reg = <0x745>; + reg = <0x36>; interrupt-parent = <&r_intc>; interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>; interrupt-controller;
@@ -290,6 +274,22 @@ }; }; +&r_ir { + linux,rc-map-name = "rc-beelink-gs1"; + status = "okay"; +}; + +&r_pio { + /* + * PL0 and PL1 are used for PMIC I2C + * don't enable the pl-supply else + * it will fail at boot + * + * vcc-pl-supply = <®_aldo1>; + */ + vcc-pm-supply = <®_aldo1>; +}; + &spdif { pinctrl-names = "default"; pinctrl-0 = <&spdif_tx_pin>;
arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts +7 -7
@@ -175,16 +175,12 @@ vcc-pg-supply = <®_vcc_wifi_io>; }; -&r_ir { - status = "okay"; -}; - -&r_rsb { +&r_i2c { status = "okay"; - axp805: pmic@745 { + axp805: pmic@36 { compatible = "x-powers,axp805", "x-powers,axp806"; - reg = <0x745>; + reg = <0x36>; interrupt-parent = <&r_intc>; interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>; interrupt-controller;
@@ -295,6 +291,10 @@ }; }; +&r_ir { + status = "okay"; +}; + &rtc { clocks = <&ext_osc32k>; };
arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi +11 -11
@@ -112,20 +112,12 @@ vcc-pg-supply = <®_aldo1>; }; -&r_ir { - status = "okay"; -}; - -&r_pio { - vcc-pm-supply = <®_bldo3>; -}; - -&r_rsb { +&r_i2c { status = "okay"; - axp805: pmic@745 { + axp805: pmic@36 { compatible = "x-powers,axp805", "x-powers,axp806"; - reg = <0x745>; + reg = <0x36>; interrupt-parent = <&r_intc>; interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>; interrupt-controller;
@@ -240,6 +232,14 @@ }; }; +&r_ir { + status = "okay"; +}; + +&r_pio { + vcc-pm-supply = <®_bldo3>; +}; + &rtc { clocks = <&ext_osc32k>; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 266/325 ksmbd: fix stream write failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 1f4bbedd4e5a69b01cde2cc21d01151ab2d0884f ]
If there is no stream data in file, v_len is zero. So, If position(*pos) is zero, stream write will fail due to stream write position validation check. This patch reorganize stream write position validation.
--- fs/smb/server/vfs.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
fs/smb/server/vfs.c +6 -8
@@ -423,10 +423,15 @@ static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos,ksmbd_debug (VFS ,"write stream data pos : %llu, count : %zd\n" , *pos, count); +if (*pos >=XATTR_SIZE_MAX ) { +pr_err ("stream write position %lld is out of bounds\n" , *pos); +return -EINVAL ; + } + size = *pos + count;if (size >XATTR_SIZE_MAX ) { size =XATTR_SIZE_MAX ; - count = (*pos + count) -XATTR_SIZE_MAX ; + count =XATTR_SIZE_MAX - *pos; } v_len = ksmbd_vfs_getcasexattr(user_ns,
@@ -440,13 +445,6 @@ static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos, goto out; } -if (v_len <= *pos) { -pr_err ("stream write position %lld is out of bounds (stream length: %zd)\n" , - *pos, v_len); - err = -EINVAL ; - goto out; - } -if (v_len < size) { wbuf =kvzalloc (size,GFP_KERNEL );if (!wbuf) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 267/325 spi: spi-fsl-dspi: restrict register range for regmap access
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larisa Grigore <[email protected]>
[ Upstream commit 283ae0c65e9c592f4a1ba4f31917f5e766da7f31 ]
DSPI registers are NOT continuous, some registers are reserved and accessing them from userspace will trigger external abort, add regmap register access table to avoid below abort.
For example on S32G:
# cat /sys/kernel/debug/regmap/401d8000.spi/registers
Internal error: synchronous external abort: 96000210 1 PREEMPT SMP ... Call trace: regmap_mmio_read32le+0x24/0x48 regmap_mmio_read+0x48/0x70 _regmap_bus_reg_read+0x38/0x48 _regmap_read+0x68/0x1b0 regmap_read+0x50/0x78 regmap_read_debugfs+0x120/0x338
--- drivers/spi/spi-fsl-dspi.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/spi/spi-fsl-dspi.c +19 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ // // Copyright 2013 Freescale Semiconductor, Inc. -// Copyright 2020 NXP +// Copyright 2020-2025 NXP // // Freescale DSPI driver // This file contains a driver for the Freescale DSPI
@@ -1128,6 +1128,20 @@ static int dspi_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(dspi_pm, dspi_suspend, dspi_resume); +static const struct regmap_range dspi_yes_ranges[] = { +regmap_reg_range (SPI_MCR ,SPI_MCR ), +regmap_reg_range (SPI_TCR ,SPI_CTAR (3 )), +regmap_reg_range (SPI_SR ,SPI_TXFR3 ), +regmap_reg_range (SPI_RXFR0 ,SPI_RXFR3 ), +regmap_reg_range (SPI_CTARE (0 ),SPI_CTARE (3 )), +regmap_reg_range (SPI_SREX ,SPI_SREX ), +}; + +static const struct regmap_access_table dspi_access_table = { + .yes_ranges = dspi_yes_ranges, + .n_yes_ranges =ARRAY_SIZE (dspi_yes_ranges), +}; +static const struct regmap_range dspi_volatile_ranges[] = {regmap_reg_range (SPI_MCR ,SPI_TCR ),regmap_reg_range (SPI_SR ,SPI_SR ),
@@ -1145,6 +1159,8 @@ static const struct regmap_config dspi_regmap_config = { .reg_stride = 4, .max_register = 0x88, .volatile_table = &dspi_volatile_table, + .rd_table = &dspi_access_table, + .wr_table = &dspi_access_table, };static const struct regmap_range dspi_xspi_volatile_ranges[] = {
@@ -1166,6 +1182,8 @@ static const struct regmap_config dspi_xspi_regmap_config[] = { .reg_stride = 4, .max_register = 0x13c, .volatile_table = &dspi_xspi_volatile_table, + .rd_table = &dspi_access_table, + .wr_table = &dspi_access_table, }, { .name = "pushr",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 268/325 spi: spi-fsl-dspi: Halt the module after a new message transfer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bogdan-Gabriel Roman <[email protected]>
[ Upstream commit 8a30a6d35a11ff5ccdede7d6740765685385a917 ]
The XSPI mode implementation in this driver still uses the EOQ flag to signal the last word in a transmission and deassert the PCS signal. However, at speeds lower than ~200kHZ, the PCS signal seems to remain asserted even when SR[EOQF] = 1 indicates the end of a transmission. This is a problem for target devices which require the deassertation of the PCS signal between transfers.
Hence, this commit 'forces' the deassertation of the PCS by stopping the module through MCR[HALT] after completing a new transfer. According to the reference manual, the module stops or transitions from the Running state to the Stopped state after the current frame, when any one of the following conditions exist:
- The value of SR[EOQF] = 1.
- The chip is in Debug mode and the value of MCR[FRZ] = 1.
- The value of MCR[HALT] = 1.
This shouldn't be done if the last transfer in the message has cs_change set.
--- drivers/spi/spi-fsl-dspi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/spi/spi-fsl-dspi.c +24 -0
@@ -61,6 +61,7 @@#define SPI_SR_TFIWF BIT(18)#define SPI_SR_RFDF BIT(17)#define SPI_SR_CMDFFF BIT(16) +#define SPI_SR_TXRXS BIT(30)#define SPI_SR_CLEAR (SPI_SR_TCFQF | \ SPI_SR_TFUF | SPI_SR_TFFF | \ SPI_SR_CMDTCF | SPI_SR_SPEF | \
@@ -907,9 +908,20 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr,struct spi_device *spi = message->spi;struct spi_transfer *transfer;int status =0 ; +u32 val =0 ; +bool cs_change = false; message->actual_length =0 ; +/* Put DSPI in running mode if halted. */ +regmap_read (dspi->regmap,SPI_MCR , &val); +if (val &SPI_MCR_HALT ) { +regmap_update_bits (dspi->regmap,SPI_MCR ,SPI_MCR_HALT ,0 ); +while (regmap_read (dspi->regmap,SPI_SR , &val) >=0 && + !(val &SPI_SR_TXRXS )) + ; + } +list_for_each_entry (transfer, &message->transfers, transfer_list) { dspi->cur_transfer = transfer; dspi->cur_msg = message;
@@ -934,6 +946,7 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr, dspi->tx_cmd |=SPI_PUSHR_CMD_CONT ; } + cs_change = transfer->cs_change; dspi->tx = transfer->tx_buf; dspi->rx = transfer->rx_buf; dspi->len = transfer->len;
@@ -966,6 +979,15 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr,spi_transfer_delay_exec (transfer); } +if (status || !cs_change) { +/* Put DSPI in stop mode */ +regmap_update_bits (dspi->regmap,SPI_MCR , +SPI_MCR_HALT ,SPI_MCR_HALT ); +while (regmap_read (dspi->regmap,SPI_SR , &val) >=0 && + val &SPI_SR_TXRXS ) + ; + } + message->status = status;spi_finalize_current_message (ctlr);
@@ -1206,6 +1228,8 @@ static int dspi_init(struct fsl_dspi *dspi)if (!spi_controller_is_slave (dspi->ctlr)) mcr |=SPI_MCR_MASTER ; + mcr |=SPI_MCR_HALT ; +regmap_write (dspi->regmap,SPI_MCR , mcr);regmap_write (dspi->regmap,SPI_SR ,SPI_SR_CLEAR );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 269/325 spi: spi-fsl-dspi: Reset SR flags before sending a new message
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larisa Grigore <[email protected]>
[ Upstream commit 7aba292eb15389073c7f3bd7847e3862dfdf604d ]
If, in a previous transfer, the controller sends more data than expected by the DSPI target, SR.RFDF (RX FIFO is not empty) will remain asserted. When flushing the FIFOs at the beginning of a new transfer (writing 1 into MCR.CLR_TXF and MCR.CLR_RXF), SR.RFDF should also be cleared. Otherwise, when running in target mode with DMA, if SR.RFDF remains asserted, the DMA callback will be fired before the controller sends any data.
Take this opportunity to reset all Status Register fields.
--- drivers/spi/spi-fsl-dspi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi-fsl-dspi.c +2 -0
@@ -956,6 +956,8 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr,SPI_MCR_CLR_TXF |SPI_MCR_CLR_RXF , SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); +regmap_write (dspi->regmap,SPI_SR ,SPI_SR_CLEAR ); +spi_take_timestamp_pre (dspi->ctlr, dspi->cur_transfer, dspi->progress, !dspi->irq);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 270/325 kbuild: Disable -Wdefault-const-init-unsafe
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit d0afcfeb9e3810ec89d1ffde1a0e36621bb75dca upstream.
A new on by default warning in clang [1] aims to flags instances where const variables without static or thread local storage or const members in aggregate types are not initialized because it can lead to an indeterminate value. This is quite noisy for the kernel due to instances originating from header files such as:
drivers/gpu/drm/i915/gt/intel_ring.h:62:2: error: default initialization of an object of type 'typeof (ring->size)' (aka 'const unsigned int') leaves the object uninitialized [-Werror,-Wdefault-const-init-var-unsafe]
62 | typecheck(typeof(ring->size), next);
| ^
include/linux/typecheck.h:10:9: note: expanded from macro 'typecheck'
10 | ({ type __dummy; \
| ^ include/net/ip.h:478:14: error: default initialization of an object of type 'typeof (rt->dst.expires)' (aka 'const unsigned long') leaves the object uninitialized [-Werror,-Wdefault-const-init-var-unsafe]
478 | if (mtu && time_before(jiffies, rt->dst.expires))
| ^
include/linux/jiffies.h:138:26: note: expanded from macro 'time_before'
138 | #define time_before(a,b) time_after(b,a)
| ^
include/linux/jiffies.h:128:3: note: expanded from macro 'time_after'
128 | (typecheck(unsigned long, a) && \
| ^
include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
11 | typeof(x) __dummy2; \
| ^ include/linux/list.h:409:27: warning: default initialization of an object of type 'union (unnamed union at include/linux/list.h:409:27)' with const member leaves the object uninitialized [-Wdefault-const-init-field-unsafe]
409 | struct list_head *next = smp_load_acquire(&head->next);
| ^
include/asm-generic/barrier.h:176:29: note: expanded from macro 'smp_load_acquire'
176 | #define smp_load_acquire(p) __smp_load_acquire(p)
| ^
arch/arm64/include/asm/barrier.h:164:59: note: expanded from macro '__smp_load_acquire'
164 | union { __unqual_scalar_typeof(*p) __val; char __c[1]; } __u; \
| ^ include/linux/list.h:409:27: note: member '__val' declared 'const' here
crypto/scatterwalk.c:66:22: error: default initialization of an object of type 'struct scatter_walk' with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe]
66 | struct scatter_walk walk;
| ^
include/crypto/algapi.h:112:15: note: member 'addr' declared 'const' here
112 | void *const addr;
| ^ fs/hugetlbfs/inode.c:733:24: error: default initialization of an object of type 'struct vm_area_struct' with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe]
733 | struct vm_area_struct pseudo_vma;
| ^
include/linux/mm_types.h:803:20: note: member 'vm_flags' declared 'const' here
803 | const vm_flags_t vm_flags;
| ^Silencing the instances from typecheck.h is difficult because '= {}' is not available in older but supported compilers and '= {0}' would cause warnings about a literal 0 being treated as NULL. While it might be possible to come up with a local hack to silence the warning for clang-21+, it may not be worth it since -Wuninitialized will still trigger if an uninitialized const variable is actually used.
In all audited cases of the "field" variant of the warning, the members are either not used in the particular call path, modified through other means such as memset() / memcpy() because the containing object is not const, or are within a union with other non-const members.
Since this warning does not appear to have a high signal to noise ratio, just disable it.
[nathan: Apply change to Makefile instead of scripts/Makefile.extrawarn
due to lack of e88ca24319e4 in older stable branches]
--- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Makefile +12 -0
@@ -875,6 +875,18 @@ ifdef CONFIG_CC_IS_CLANG KBUILD_CPPFLAGS += -Qunused-arguments # The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable. KBUILD_CFLAGS += -Wno-gnu + +# Clang may emit a warning when a const variable, such as the dummy variables +# in typecheck(), or const member of an aggregate type are not initialized, +# which can result in unexpected behavior. However, in many audited cases of +# the "field" variant of the warning, this is intentional because the field is +# never used within a particular call path, the field is within a union with +# other non-const members, or the containing object is not const so the field +# can be modified via memcpy() / memset(). While the variable warning also gets +# disabled with this same switch, there should not be too much coverage lost +# because -Wuninitialized will still flag when an uninitialized const variable +# is used. +KBUILD_CFLAGS += $(call cc-disable-warning, default-const-init-unsafe) else # gcc inanely warns about local variables called 'main'
Greg Kroah-Hartman
maintainerPATCH 271/325 serial: sh-sci: Save and restore more registers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 81100b9a7b0515132996d62a7a676a77676cb6e3 upstream.
On (H)SCIF with a Baud Rate Generator for External Clock (BRG), there are multiple ways to configure the requested serial speed. If firmware uses a different method than Linux, and if any debug info is printed after the Bit Rate Register (SCBRR) is restored, but before termios is reconfigured (which configures the alternative method), the system may lock-up during resume.
Fix this by saving and restoring the contents of the BRG Frequency Division (SCDL) and Clock Select (SCCKS) registers as well.
Also save and restore the HSCIF's Sampling Rate Register (HSSRR), which configures the sampling point, and the SCIFA/SCIFB's Serial Port Control and Data Registers (SCPCR/SCPDR), which configure the optional control flow signals.
After this, all registers that are not saved/restored are either:
- read-only,
- write-only,
- status registers containing flags with clear-after-set semantics,
- FIFO Data Count Trigger registers, which do not matter much for the serial console.
--- drivers/tty/serial/sh-sci.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/tty/serial/sh-sci.c +25 -0
@@ -106,10 +106,15 @@ struct plat_sci_reg { };struct sci_suspend_regs { +u16 scdl; +u16 sccks;u16 scsmr;u16 scscr;u16 scfcr;u16 scsptr; +u16 hssrr; +u16 scpcr; +u16 scpdr;u8 scbrr;u8 semr; };
@@ -3418,6 +3423,10 @@ static void sci_console_save(struct sci_struct sci_suspend_regs *regs = &s->suspend_regs;struct uart_port *port = &s->port; +if (sci_getreg (port,SCDL )->size) + regs->scdl =sci_serial_in (port,SCDL ); +if (sci_getreg (port,SCCKS )->size) + regs->sccks =sci_serial_in (port,SCCKS );if (sci_getreg (port,SCSMR )->size) regs->scsmr =sci_serial_in (port,SCSMR );if (sci_getreg (port,SCSCR )->size)
@@ -3428,6 +3437,12 @@ static void sci_console_save(struct sci_ regs->scsptr =sci_serial_in (port,SCSPTR );if (sci_getreg (port,SCBRR )->size) regs->scbrr =sci_serial_in (port,SCBRR ); +if (sci_getreg (port,HSSRR )->size) + regs->hssrr =sci_serial_in (port,HSSRR ); +if (sci_getreg (port,SCPCR )->size) + regs->scpcr =sci_serial_in (port,SCPCR ); +if (sci_getreg (port,SCPDR )->size) + regs->scpdr =sci_serial_in (port,SCPDR );if (sci_getreg (port,SEMR )->size) regs->semr =sci_serial_in (port,SEMR ); }
@@ -3437,6 +3452,10 @@ static void sci_console_restore(struct sstruct sci_suspend_regs *regs = &s->suspend_regs;struct uart_port *port = &s->port; +if (sci_getreg (port,SCDL )->size) +sci_serial_out (port,SCDL , regs->scdl); +if (sci_getreg (port,SCCKS )->size) +sci_serial_out (port,SCCKS , regs->sccks);if (sci_getreg (port,SCSMR )->size)sci_serial_out (port,SCSMR , regs->scsmr);if (sci_getreg (port,SCSCR )->size)
@@ -3447,6 +3466,12 @@ static void sci_console_restore(struct ssci_serial_out (port,SCSPTR , regs->scsptr);if (sci_getreg (port,SCBRR )->size)sci_serial_out (port,SCBRR , regs->scbrr); +if (sci_getreg (port,HSSRR )->size) +sci_serial_out (port,HSSRR , regs->hssrr); +if (sci_getreg (port,SCPCR )->size) +sci_serial_out (port,SCPCR , regs->scpcr); +if (sci_getreg (port,SCPDR )->size) +sci_serial_out (port,SCPDR , regs->scpdr);if (sci_getreg (port,SEMR )->size)sci_serial_out (port,SEMR , regs->semr); }
Greg Kroah-Hartman
maintainerPATCH 272/325 pinctrl: tegra: Fix off by one in tegra_pinctrl_get_group()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 5a062c3c3b82004766bc3ece82b594d337076152 upstream.
This should be >= pmx->soc->ngroups instead of > to avoid an out of bounds access. The pmx->soc->groups[] array is allocated in tegra_pinctrl_probe().
--- drivers/pinctrl/tegra/pinctrl-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/tegra/pinctrl-tegra.c +1 -1
@@ -305,7 +305,7 @@ static const struct tegra_pingroup *tegr {struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev); -if (group_index <0 || group_index > pmx->soc->ngroups) +if (group_index <0 || group_index >= pmx->soc->ngroups)return NULL ;return &pmx->soc->groups[group_index];
Greg Kroah-Hartman
maintainerPATCH 273/325 i3c: master: svc: Fix implicit fallthrough in svc_i3c_master_ibi_work()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit e8d2d287e26d9bd9114cf258a123a6b70812442e upstream.
Clang warns (or errors with CONFIG_WERROR=y):
drivers/i3c/master/svc-i3c-master.c:596:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
596 | default:
| ^
drivers/i3c/master/svc-i3c-master.c:596:2: note: insert 'break;' to avoid fall-through
596 | default:
| ^
| break;1 error generated.
Clang is a little more pedantic than GCC, which does not warn when falling through to a case that is just break or return. Clang's version is more in line with the kernel's own stance in deprecated.rst, which states that all switch/case blocks must end in either break, fallthrough, continue, goto, or return. Add the missing break to silence the warning.
--- drivers/i3c/master/svc-i3c-master.c | 1 + 1 file changed, 1 insertion(+)
drivers/i3c/master/svc-i3c-master.c +1 -0
@@ -496,6 +496,7 @@ static void svc_i3c_master_ibi_work(strubreak ;case SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST :svc_i3c_master_emit_stop (master); +break ;default :break ; }
Greg Kroah-Hartman
maintainerPATCH 274/325 x86/mm/init: Handle the special case of device private pages in add_pages(), to not increase max_pfn and trigger dma_addressing_limited() bounce buffers bounce buffers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Balbir Singh <[email protected]>
commit 7170130e4c72ce0caa0cb42a1627c635cc262821 upstream.
As Bert Karwatzki reported, the following recent commit causes a performance regression on AMD iGPU and dGPU systems:
7ffb791423c7 ("x86/kaslr: Reduce KASLR entropy on most x86 systems")
It exposed a bug with nokaslr and zone device interaction.
The root cause of the bug is that, the GPU driver registers a zone device private memory region. When KASLR is disabled or the above commit is applied, the direct_map_physmem_end is set to much higher than 10 TiB typically to the 64TiB address. When zone device private memory is added to the system via add_pages(), it bumps up the max_pfn to the same value. This causes dma_addressing_limited() to return true, since the device cannot address memory all the way up to max_pfn.
This caused a regression for games played on the iGPU, as it resulted in the DMA32 zone being used for GPU allocations.
Fix this by not bumping up max_pfn on x86 systems, when pgmap is passed into add_pages(). The presence of pgmap is used to determine if device private memory is being added via add_pages().
More details:
devm_request_mem_region() and request_free_mem_region() request for device private memory. iomem_resource is passed as the base resource with start and end parameters. iomem_resource's end depends on several factors, including the platform and virtualization. On x86 for example on bare metal, this value is set to boot_cpu_data.x86_phys_bits. boot_cpu_data.x86_phys_bits can change depending on support for MKTME. By default it is set to the same as log2(direct_map_physmem_end) which is 46 to 52 bits depending on the number of levels in the page table. The allocation routines used iomem_resource's end and direct_map_physmem_end to figure out where to allocate the region.
[ arch/powerpc is also impacted by this problem, but this patch does not fix
the issue for PowerPC. ]
Testing:
1. Tested on a virtual machine with test_hmm for zone device inseration
2. A previous version of this patch was tested by Bert, please see:
https://lore.kernel.org/lkml/[email protected]/
[ mingo: Clarified the comments and the changelog. ]
--- arch/x86/mm/init_64.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
arch/x86/mm/init_64.c +12 -3
@@ -959,9 +959,18 @@ int add_pages(int nid, unsigned long sta ret =__add_pages (nid, start_pfn, nr_pages, params);WARN_ON_ONCE (ret); -/* update max_pfn, max_low_pfn and high_memory */ -update_end_of_memory_vars (start_pfn <<PAGE_SHIFT , - nr_pages <<PAGE_SHIFT ); +/* +* Special case: add_pages() is called by memremap_pages() for adding device +* private pages. Do not bump up max_pfn in the device private path, +* because max_pfn changes affect dma_addressing_limited(). +* +* dma_addressing_limited() returning true when max_pfn is the device's +* addressable memory can force device drivers to use bounce buffers +* and impact their performance negatively: +*/ +if (!params->pgmap) +/* update max_pfn, max_low_pfn and high_memory */ +update_end_of_memory_vars (start_pfn <<PAGE_SHIFT , nr_pages <<PAGE_SHIFT );return ret; }
Greg Kroah-Hartman
maintainerPATCH 275/325 dmaengine: idxd: Fix passing freed memory in idxd_cdev_open()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harshit Mogalapalli <[email protected]>
commit 0642287e3ecdd0d1f88e6a2e63768e16153a990c upstream.
Smatch warns:
drivers/dma/idxd/cdev.c:327: idxd_cdev_open() warn: 'sva' was already freed.
When idxd_wq_set_pasid() fails, the current code unbinds sva and then goes to 'failed_set_pasid' where iommu_sva_unbind_device is called again causing the above warning.
[ device_user_pasid_enabled(idxd) is still true when calling failed_set_pasid ]
Fix this by removing additional unbind when idxd_wq_set_pasid() fails
--- drivers/dma/idxd/cdev.c | 1 - 1 file changed, 1 deletion(-)
drivers/dma/idxd/cdev.c +0 -1
@@ -142,7 +142,6 @@ static int idxd_cdev_open(struct inode *if (wq_dedicated (wq)) { rc =idxd_wq_set_pasid (wq, pasid);if (rc <0 ) { -iommu_sva_unbind_device (sva);dev_err (dev,"wq set pasid failed: %d\n" , rc); goto failed_set_pasid; }
Greg Kroah-Hartman
maintainerPATCH 276/325 octeontx2-pf: fix page_pool creation fail for rings > 32k
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ratheesh Kannoth <[email protected]>
commit 49fa4b0d06705a24a81bb8be6eb175059b77f0a7 upstream.
octeontx2 driver calls page_pool_create() during driver probe() and fails if queue size > 32k. Page pool infra uses these buffers as shock absorbers for burst traffic. These pages are pinned down over time as working sets varies, due to the recycling nature of page pool, given page pool (currently) don't have a shrinker mechanism, the pages remain pinned down in ptr_ring. Instead of clamping page_pool size to 32k at
most, limit it even more to 2k to avoid wasting memory.
This have been tested on octeontx2 CN10KA hardware. TCP and UDP tests using iperf shows no performance regressions.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 2 +- drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +1 -1
@@ -1434,7 +1434,7 @@ int otx2_pool_init(struct otx2_nic *pfvf } pp_params.flags =PP_FLAG_PAGE_FRAG |PP_FLAG_DMA_MAP ; - pp_params.pool_size = numptrs; + pp_params.pool_size =min (OTX2_PAGE_POOL_SZ , numptrs); pp_params.nid =NUMA_NO_NODE ; pp_params.dev = pfvf->dev; pp_params.dma_dir =DMA_FROM_DEVICE ;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h +2 -0
@@ -23,6 +23,8 @@#define OTX2_ETH_HLEN (VLAN_ETH_HLEN + VLAN_HLEN)#define OTX2_MIN_MTU 60 +#define OTX2_PAGE_POOL_SZ 2048 +#define OTX2_MAX_GSO_SEGS 255#define OTX2_MAX_FRAGS_IN_SQE 9
Greg Kroah-Hartman
maintainerPATCH 277/325 octeontx2-pf: Fix page pool cache index corruption.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ratheesh Kannoth <[email protected]>
commit 88e69af061f2e061a68751ef9cad47a674527a1b upstream.
The access to page pool cache' array and the count' variable is not locked. Page pool cache access is fine as long as there is only one consumer per pool.
octeontx2 driver fills in rx buffers from page pool in NAPI context. If system is stressed and could not allocate buffers, refiiling work will be delegated to a delayed workqueue. This means that there are two cosumers to the page pool cache.
Either workqueue or IRQ/NAPI can be run on other CPU. This will lead to lock less access, hence corruption of cache pool indexes.
To fix this issue, NAPI is rescheduled from workqueue context to refill rx buffers.
--- drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c | 6 +- drivers/net/ethernet/marvell/octeontx2/nic/cn10k.h | 2 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 43 ++------------- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 3 - drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 7 +- drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 30 ++++++++-- drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h | 4 - 7 files changed, 44 insertions(+), 51 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c +4 -2
@@ -107,12 +107,13 @@ int cn10k_sq_aq_init(void *dev, u16 qidx }#define NPA_MAX_BURST 16 -void cn10k_refill_pool_ptrs (void *dev,struct otx2_cq_queue *cq) +int cn10k_refill_pool_ptrs (void *dev,struct otx2_cq_queue *cq) {struct otx2_nic *pfvf = dev; +int cnt = cq->pool_ptrs;u64 ptrs[NPA_MAX_BURST ]; -int num_ptrs =1 ;dma_addr_t bufptr; +int num_ptrs =1 ;/* Refill pool with new buffers */ while (cq->pool_ptrs) {
@@ -131,6 +132,7 @@ void cn10k_refill_pool_ptrs(void *dev, s num_ptrs =1 ; } } +return cnt - cq->pool_ptrs; }void cn10k_sqe_flush (void *dev,struct otx2_snd_queue *sq,int size,int qidx)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k.h +1 -1
@@ -24,7 +24,7 @@ static inline int mtu_to_dwrr_weight(strreturn weight; } -void cn10k_refill_pool_ptrs (void *dev,struct otx2_cq_queue *cq); +int cn10k_refill_pool_ptrs (void *dev,struct otx2_cq_queue *cq);void cn10k_sqe_flush (void *dev,struct otx2_snd_queue *sq,int size,int qidx);int cn10k_sq_aq_init (void *dev,u16 qidx,u16 sqb_aura);int cn10k_lmtst_init (struct otx2_nic *pfvf);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +6 -37
65 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +2 -1
@@ -280,6 +280,7 @@ struct flr_work {struct refill_work {struct delayed_work pool_refill_work;struct otx2_nic *pf; +struct napi_struct *napi; };/* PTPv2 originTimestamp structure */
@@ -347,7 +348,7 @@ struct dev_hw_ops {int (*sq_aq_init)(void *dev,u16 qidx,u16 sqb_aura);void (*sqe_flush)(void *dev,struct otx2_snd_queue *sq,int size,int qidx); -void (*refill_pool_ptrs)(void *dev,struct otx2_cq_queue *cq); +int (*refill_pool_ptrs)(void *dev,struct otx2_cq_queue *cq);void (*aura_freeptr)(void *dev,int aura,u64 buf); };
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +4 -3
@@ -2005,6 +2005,10 @@ int otx2_stop(struct net_device *netdev)netif_tx_disable (netdev); +for (wrk =0 ; wrk < pf->qset.cq_cnt; wrk++) +cancel_delayed_work_sync (&pf->refill_wrk[wrk].pool_refill_work); +devm_kfree (pf->dev, pf->refill_wrk); +otx2_free_hw_resources (pf);otx2_free_cints (pf, pf->hw.cint_cnt);otx2_disable_napi (pf);
@@ -2012,9 +2016,6 @@ int otx2_stop(struct net_device *netdev)for (qidx =0 ; qidx < netdev->num_tx_queues; qidx++)netdev_tx_reset_queue (netdev_get_tx_queue (netdev, qidx)); -for (wrk =0 ; wrk < pf->qset.cq_cnt; wrk++) -cancel_delayed_work_sync (&pf->refill_wrk[wrk].pool_refill_work); -devm_kfree (pf->dev, pf->refill_wrk);kfree (qset->sq);kfree (qset->cq);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +25 -5
@@ -428,9 +428,10 @@ process_cqe:return processed_cqe; } -void otx2_refill_pool_ptrs (void *dev,struct otx2_cq_queue *cq) +int otx2_refill_pool_ptrs (void *dev,struct otx2_cq_queue *cq) {struct otx2_nic *pfvf = dev; +int cnt = cq->pool_ptrs;dma_addr_t bufptr;while (cq->pool_ptrs) {
@@ -439,6 +440,8 @@ void otx2_refill_pool_ptrs(void *dev, stotx2_aura_freeptr (pfvf, cq->cq_idx, bufptr +OTX2_HEAD_ROOM ); cq->pool_ptrs--; } + +return cnt - cq->pool_ptrs; } static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
@@ -532,6 +535,7 @@ int otx2_napi_handler(struct napi_structstruct otx2_cq_queue *cq;struct otx2_qset *qset;struct otx2_nic *pfvf; +int filled_cnt =-1 ; cq_poll = container_of(napi, struct otx2_cq_poll, napi); pfvf = (struct otx2_nic *)cq_poll->dev;
@@ -552,7 +556,7 @@ int otx2_napi_handler(struct napi_struct }if (rx_cq && rx_cq->pool_ptrs) - pfvf->hw_ops->refill_pool_ptrs (pfvf, rx_cq); + filled_cnt = pfvf->hw_ops->refill_pool_ptrs (pfvf, rx_cq);/* Clear the IRQ */ otx2_write64 (pfvf,NIX_LF_CINTX_INT (cq_poll->cint_idx),BIT_ULL (0 ));
@@ -565,9 +569,25 @@ int otx2_napi_handler(struct napi_structif (pfvf->flags &OTX2_FLAG_ADPTV_INT_COAL_ENABLED )otx2_adjust_adaptive_coalese (pfvf, cq_poll); -/* Re-enable interrupts */ -otx2_write64 (pfvf,NIX_LF_CINTX_ENA_W1S (cq_poll->cint_idx), -BIT_ULL (0 )); +if (unlikely (!filled_cnt)) { +struct refill_work *work; +struct delayed_work *dwork; + + work = &pfvf->refill_wrk[cq->cq_idx]; + dwork = &work->pool_refill_work; +/* Schedule a task if no other task is running */ +if (!cq->refill_task_sched) { + work->napi = napi; + cq->refill_task_sched = true; +schedule_delayed_work (dwork, +msecs_to_jiffies (100 )); + } + }else { +/* Re-enable interrupts */ +otx2_write64 (pfvf, +NIX_LF_CINTX_ENA_W1S (cq_poll->cint_idx), +BIT_ULL (0 )); + } }return workdone; }
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h +2 -2
@@ -170,6 +170,6 @@ void cn10k_sqe_flush(void *dev, struct o int size, int qidx);void otx2_sqe_flush (void *dev,struct otx2_snd_queue *sq,int size,int qidx); -void otx2_refill_pool_ptrs (void *dev,struct otx2_cq_queue *cq); -void cn10k_refill_pool_ptrs (void *dev,struct otx2_cq_queue *cq); +int otx2_refill_pool_ptrs (void *dev,struct otx2_cq_queue *cq); +int cn10k_refill_pool_ptrs (void *dev,struct otx2_cq_queue *cq);#endif /* OTX2_TXRX_H */
Greg Kroah-Hartman
maintainerPATCH 278/325 octeontx2-pf: Fix page pool frag allocation warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ratheesh Kannoth <[email protected]>
commit 50e492143374c17ad89c865a1a44837b3f5c8226 upstream.
Since page pool param's "order" is set to 0, will result in below warn message if interface is configured with higher rx buffer size.
Steps to reproduce the issue.
1. devlink dev param set pci/0002:04:00.0 name receive_buffer_size \
value 8196 cmode runtime
2. ifconfig eth0 up
[ 19.901356] ------------[ cut here ]------------ [ 19.901361] WARNING: CPU: 11 PID: 12331 at net/core/page_pool.c:567 page_pool_alloc_frag+0x3c/0x230 [ 19.901449] pstate: 82401009 (Nzcv daif +PAN -UAO +TCO -DIT +SSBS BTYPE=--) [ 19.901451] pc : page_pool_alloc_frag+0x3c/0x230 [ 19.901453] lr : __otx2_alloc_rbuf+0x60/0xbc [rvu_nicpf] [ 19.901460] sp : ffff80000f66b970 [ 19.901461] x29: ffff80000f66b970 x28: 0000000000000000 x27: 0000000000000000 [ 19.901464] x26: ffff800000d15b68 x25: ffff000195b5c080 x24: ffff0002a5a32dc0 [ 19.901467] x23: ffff0001063c0878 x22: 0000000000000100 x21: 0000000000000000 [ 19.901469] x20: 0000000000000000 x19: ffff00016f781000 x18: 0000000000000000 [ 19.901472] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 19.901474] x14: 0000000000000000 x13: ffff0005ffdc9c80 x12: 0000000000000000 [ 19.901477] x11: ffff800009119a38 x10: 4c6ef2e3ba300519 x9 : ffff800000d13844 [ 19.901479] x8 : ffff0002a5a33cc8 x7 : 0000000000000030 x6 : 0000000000000030 [ 19.901482] x5 : 0000000000000005 x4 : 0000000000000000 x3 : 0000000000000a20 [ 19.901484] x2 : 0000000000001080 x1 : ffff80000f66b9d4 x0 : 0000000000001000 [ 19.901487] Call trace: [ 19.901488] page_pool_alloc_frag+0x3c/0x230 [ 19.901490] __otx2_alloc_rbuf+0x60/0xbc [rvu_nicpf] [ 19.901494] otx2_rq_aura_pool_init+0x1c4/0x240 [rvu_nicpf] [ 19.901498] otx2_open+0x228/0xa70 [rvu_nicpf] [ 19.901501] otx2vf_open+0x20/0xd0 [rvu_nicvf] [ 19.901504] __dev_open+0x114/0x1d0 [ 19.901507] __dev_change_flags+0x194/0x210 [ 19.901510] dev_change_flags+0x2c/0x70 [ 19.901512] devinet_ioctl+0x3a4/0x6c4 [ 19.901515] inet_ioctl+0x228/0x240 [ 19.901518] sock_ioctl+0x2ac/0x480 [ 19.901522] __arm64_sys_ioctl+0x564/0xe50 [ 19.901525] invoke_syscall.constprop.0+0x58/0xf0 [ 19.901529] do_el0_svc+0x58/0x150 [ 19.901531] el0_svc+0x30/0x140 [ 19.901533] el0t_64_sync_handler+0xe8/0x114 [ 19.901535] el0t_64_sync+0x1a0/0x1a4 [ 19.901537] ---[ end trace 678c0bf660ad8116 ]---
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +1 -0
@@ -1402,6 +1402,7 @@ int otx2_pool_init(struct otx2_nic *pfvfreturn 0 ; } + pp_params.order =get_order (buf_size); pp_params.flags =PP_FLAG_PAGE_FRAG |PP_FLAG_DMA_MAP ; pp_params.pool_size =min (OTX2_PAGE_POOL_SZ , numptrs); pp_params.nid =NUMA_NO_NODE ;
Greg Kroah-Hartman
maintainerPATCH 279/325 hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
commit 53dac345395c0d2493cbc2f4c85fe38aef5b63f5 upstream.
hrtimers are migrated away from the dying CPU to any online target at the CPUHP_AP_HRTIMERS_DYING stage in order not to delay bandwidth timers handling tasks involved in the CPU hotplug forward progress.
However wakeups can still be performed by the outgoing CPU after CPUHP_AP_HRTIMERS_DYING. Those can result again in bandwidth timers being armed. Depending on several considerations (crystal ball power management based election, earliest timer already enqueued, timer migration enabled or not), the target may eventually be the current CPU even if offline. If that happens, the timer is eventually ignored.
The most notable example is RCU which had to deal with each and every of those wake-ups by deferring them to an online CPU, along with related workarounds:
_ e787644caf76 (rcu: Defer RCU kthreads wakeup when CPU is dying) _ 9139f93209d1 (rcu/nocb: Fix RT throttling hrtimer armed from offline CPU) _ f7345ccc62a4 (rcu/nocb: Fix rcuog wake-up from offline softirq)
The problem isn't confined to RCU though as the stop machine kthread (which runs CPUHP_AP_HRTIMERS_DYING) reports its completion at the end of its work through cpu_stop_signal_done() and performs a wake up that eventually arms the deadline server timer:
WARNING: CPU: 94 PID: 588 at kernel/time/hrtimer.c:1086 hrtimer_start_range_ns+0x289/0x2d0
CPU: 94 UID: 0 PID: 588 Comm: migration/94 Not tainted
Stopper: multi_cpu_stop+0x0/0x120 <- stop_machine_cpuslocked+0x66/0xc0
RIP: 0010:hrtimer_start_range_ns+0x289/0x2d0
Call Trace:
<TASK>
start_dl_timer
enqueue_dl_entity
dl_server_start
enqueue_task_fair
enqueue_task
ttwu_do_activate
try_to_wake_up
complete
cpu_stopper_threadInstead of providing yet another bandaid to work around the situation, fix it in the hrtimers infrastructure instead: always migrate away a timer to an online target whenever it is enqueued from an offline CPU.
This will also allow to revert all the above RCU disgraceful hacks.
--- include/linux/hrtimer.h | 1 kernel/time/hrtimer.c | 103 ++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 83 insertions(+), 21 deletions(-)
include/linux/hrtimer.h +1 -0
@@ -237,6 +237,7 @@ struct hrtimer_cpu_base {ktime_t softirq_expires_next;struct hrtimer *softirq_next_timer;struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES ]; +call_single_data_t csd; }____cacheline_aligned ;static inline void hrtimer_set_expires (struct hrtimer *timer,ktime_t time)
kernel/time/hrtimer.c +82 -21
176 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 280/325 btrfs: check folio mapping after unlock in relocate_one_folio()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Burkov <[email protected]>
commit 3e74859ee35edc33a022c3f3971df066ea0ca6b9 upstream.
When we call btrfs_read_folio() to bring a folio uptodate, we unlock the folio. The result of that is that a different thread can modify the mapping (like remove it with invalidate) before we call folio_lock(). This results in an invalid page and we need to try again.
In particular, if we are relocating concurrently with aborting a transaction, this can result in a crash like the following:
BUG: kernel NULL pointer dereference, address: 0000000000000000 PGD 0 P4D 0 Oops: 0000 [#1] SMP CPU: 76 PID: 1411631 Comm: kworker/u322:5 Workqueue: events_unbound btrfs_reclaim_bgs_work RIP: 0010:set_page_extent_mapped+0x20/0xb0 RSP: 0018:ffffc900516a7be8 EFLAGS: 00010246 RAX: ffffea009e851d08 RBX: ffffea009e0b1880 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffc900516a7b90 RDI: ffffea009e0b1880 RBP: 0000000003573000 R08: 0000000000000001 R09: ffff88c07fd2f3f0 R10: 0000000000000000 R11: 0000194754b575be R12: 0000000003572000 R13: 0000000003572fff R14: 0000000000100cca R15: 0000000005582fff FS: 0000000000000000(0000) GS:ffff88c07fd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000407d00f002 CR4: 00000000007706f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> ? __die+0x78/0xc0 ? page_fault_oops+0x2a8/0x3a0 ? __switch_to+0x133/0x530 ? wq_worker_running+0xa/0x40 ? exc_page_fault+0x63/0x130 ? asm_exc_page_fault+0x22/0x30 ? set_page_extent_mapped+0x20/0xb0 relocate_file_extent_cluster+0x1a7/0x940 relocate_data_extent+0xaf/0x120 relocate_block_group+0x20f/0x480 btrfs_relocate_block_group+0x152/0x320 btrfs_relocate_chunk+0x3d/0x120 btrfs_reclaim_bgs_work+0x2ae/0x4e0 process_scheduled_works+0x184/0x370 worker_thread+0xc6/0x3e0 ? blk_add_timer+0xb0/0xb0 kthread+0xae/0xe0 ? flush_tlb_kernel_range+0x90/0x90 ret_from_fork+0x2f/0x40 ? flush_tlb_kernel_range+0x90/0x90 ret_from_fork_asm+0x11/0x20 </TASK>
This occurs because cleanup_one_transaction() calls destroy_delalloc_inodes() which calls invalidate_inode_pages2() which takes the folio_lock before setting mapping to NULL. We fail to check this, and subsequently call set_extent_mapping(), which assumes that mapping != NULL (in fact it asserts that in debug mode)
Note that the "fixes" patch here is not the one that introduced the race (the very first iteration of this code from 2009) but a more recent change that made this particular crash happen in practice.
--- fs/btrfs/relocation.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/relocation.c +6 -0
@@ -2977,6 +2977,7 @@ static int relocate_one_page(struct inodint ret;ASSERT (page_index <= last_index); +again: page =find_lock_page (inode->i_mapping, page_index);if (!page) { page_cache_sync_readahead(inode->i_mapping, ra, NULL,
@@ -2998,6 +2999,11 @@ static int relocate_one_page(struct inod ret = -EIO ; goto release_page; } +if (page->mapping != inode->i_mapping) { +unlock_page (page); +put_page (page); + goto again; + } }/*
Greg Kroah-Hartman
maintainerPATCH 281/325 af_unix: Kconfig: make CONFIG_UNIX bool
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Mikhalitsyn <[email protected]>
commit 97154bcf4d1b7cabefec8a72cff5fbb91d5afb7b upstream.
Let's make CONFIG_UNIX a bool instead of a tristate.
We've decided to do that during discussion about SCM_PIDFD patchset [1].
[1] https://lore.kernel.org/lkml/[email protected]/
--- net/unix/Kconfig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
net/unix/Kconfig +1 -5
@@ -4,7 +4,7 @@ # config UNIX - tristate "Unix domain sockets" + bool "Unix domain sockets" help If you say Y here, you will include support for Unix domain sockets; sockets are the standard Unix mechanism for establishing and
@@ -14,10 +14,6 @@ config UNIX an embedded system or something similar, you therefore definitely want to say Y here. - To compile this driver as a module, choose M here: the module will be - called unix. Note that several important services won't work - correctly if you say M here and then neglect to load the module. - Say Y unless you know what you are doing. config UNIX_SCM
Greg Kroah-Hartman
maintainerPATCH 282/325 af_unix: Return struct unix_sock from unix_get_socket().
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
commit 5b17307bd0789edea0675d524a2b277b93bbde62 upstream.
Currently, unix_get_socket() returns struct sock, but after calling it, we always cast it to unix_sk().
Let's return struct unix_sock from unix_get_socket().
--- include/net/af_unix.h | 2 +- net/unix/garbage.c | 19 +++++++------------ net/unix/scm.c | 19 +++++++------------ 3 files changed, 15 insertions(+), 25 deletions(-)
include/net/af_unix.h +1 -1
@@ -13,7 +13,7 @@ void unix_notinflight(struct user_structvoid unix_destruct_scm (struct sk_buff *skb);void unix_gc (void );void wait_for_unix_gc (void ); -struct sock *unix_get_socket (struct file *filp); +struct unix_sock *unix_get_socket (struct file *filp);struct sock *unix_peer_get (struct sock *sk);#define UNIX_HASH_MOD (256 - 1)
net/unix/garbage.c +7 -12
@@ -105,20 +105,15 @@ static void scan_inflight(struct sock *xwhile (nfd--) {/* Get the socket the fd matches if it indeed does so */ -struct sock *sk =unix_get_socket (*fp++); +struct unix_sock *u =unix_get_socket (*fp++); -if (sk) { -struct unix_sock *u =unix_sk (sk); +/* Ignore non-candidates, they could have been added +* to the queues after starting the garbage collection +*/ +if (u &&test_bit (UNIX_GC_CANDIDATE , &u->gc_flags)) { + hit = true; -/* Ignore non-candidates, they could -* have been added to the queues after -* starting the garbage collection -*/ -if (test_bit (UNIX_GC_CANDIDATE , &u->gc_flags)) { - hit = true; - -func (u); - } +func (u); } }if (hit && hitlist !=NULL ) {
net/unix/scm.c +7 -12
@@ -21,9 +21,8 @@ EXPORT_SYMBOL(gc_inflight_list);DEFINE_SPINLOCK (unix_gc_lock);EXPORT_SYMBOL (unix_gc_lock); -struct sock *unix_get_socket (struct file *filp) +struct unix_sock *unix_get_socket (struct file *filp) { -struct sock *u_sock =NULL ;struct inode *inode =file_inode (filp);/* Socket ? */
@@ -33,10 +32,10 @@ struct sock *unix_get_socket(struct file/* PF_UNIX ? */ if (s && sock->ops && sock->ops->family ==PF_UNIX ) - u_sock = s; +return unix_sk (s); } -return u_sock; +return NULL ; }EXPORT_SYMBOL (unix_get_socket);
@@ -45,13 +44,11 @@ EXPORT_SYMBOL(unix_get_socket);*/ void unix_inflight (struct user_struct *user,struct file *fp) { -struct sock *s =unix_get_socket (fp); +struct unix_sock *u =unix_get_socket (fp);spin_lock (&unix_gc_lock); -if (s) { -struct unix_sock *u =unix_sk (s); - +if (u) {if (!u->inflight) {BUG_ON (!list_empty (&u->link));list_add_tail (&u->link, &gc_inflight_list);
@@ -68,13 +65,11 @@ void unix_inflight(struct user_struct *uvoid unix_notinflight (struct user_struct *user,struct file *fp) { -struct sock *s =unix_get_socket (fp); +struct unix_sock *u =unix_get_socket (fp);spin_lock (&unix_gc_lock); -if (s) { -struct unix_sock *u =unix_sk (s); - +if (u) {BUG_ON (!u->inflight);BUG_ON (list_empty (&u->link));
Greg Kroah-Hartman
maintainerPATCH 283/325 af_unix: Run GC on only one CPU.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
commit 8b90a9f819dc2a06baae4ec1a64d875e53b824ec upstream.
If more than 16000 inflight AF_UNIX sockets exist and the garbage collector is not running, unix_(dgram|stream)_sendmsg() call unix_gc(). Also, they wait for unix_gc() to complete.
In unix_gc(), all inflight AF_UNIX sockets are traversed at least once, and more if they are the GC candidate. Thus, sendmsg() significantly slows down with too many inflight AF_UNIX sockets.
There is a small window to invoke multiple unix_gc() instances, which will then be blocked by the same spinlock except for one.
Let's convert unix_gc() to use struct work so that it will not consume CPUs unnecessarily.
Note WRITE_ONCE(gc_in_progress, true) is moved before running GC. If we leave the WRITE_ONCE() as is and use the following test to call flush_work(), a process might not call it.
CPU 0 CPU 1
--- ---
start work and call __unix_gc()
if (work_pending(&unix_gc_work) || <-- false
READ_ONCE(gc_in_progress)) <-- false
flush_work(); <-- missed!
WRITE_ONCE(gc_in_progress, true)
--- net/unix/garbage.c | 54 ++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-)
net/unix/garbage.c +27 -27
@@ -86,7 +86,6 @@/* Internal data structures and random procedures: */ static LIST_HEAD (gc_candidates); -static DECLARE_WAIT_QUEUE_HEAD (unix_gc_wait);static void scan_inflight (struct sock *x,void (*func)(struct unix_sock *),struct sk_buff_head *hitlist)
@@ -182,23 +181,8 @@ static void inc_inflight_move_tail(struc }static bool gc_in_progress; -#define UNIX_INFLIGHT_TRIGGER_GC 16000 - -void wait_for_unix_gc (void ) -{ -/* If number of inflight sockets is insane, -* force a garbage collect right now. -* Paired with the WRITE_ONCE() in unix_inflight(), -* unix_notinflight() and gc_in_progress(). -*/ -if (READ_ONCE (unix_tot_inflight) >UNIX_INFLIGHT_TRIGGER_GC && - !READ_ONCE (gc_in_progress)) -unix_gc (); -wait_event (unix_gc_wait, !READ_ONCE (gc_in_progress)); -} -/* The external entry point: unix_gc() */ -void unix_gc (void ) +static void __unix_gc (struct work_struct *work) {struct sk_buff *next_skb, *skb;struct unix_sock *u;
@@ -209,13 +193,6 @@ void unix_gc(void)spin_lock (&unix_gc_lock); -/* Avoid a recursive GC. */ -if (gc_in_progress) - goto out; - -/* Paired with READ_ONCE() in wait_for_unix_gc(). */ -WRITE_ONCE (gc_in_progress, true); -/* First, select candidates for garbage collection. Only * in-flight sockets are considered, and from those only ones * which don't have any external reference.
@@ -346,8 +323,31 @@ void unix_gc(void)/* Paired with READ_ONCE() in wait_for_unix_gc(). */ WRITE_ONCE (gc_in_progress, false); -wake_up (&unix_gc_wait); - - out:spin_unlock (&unix_gc_lock); } + +static DECLARE_WORK(unix_gc_work, __unix_gc); + +void unix_gc (void ) +{ +WRITE_ONCE (gc_in_progress, true); +queue_work (system_unbound_wq, &unix_gc_work); +} + +#define UNIX_INFLIGHT_TRIGGER_GC 16000 + +void wait_for_unix_gc (void ) +{ +/* If number of inflight sockets is insane, +* force a garbage collect right now. +* +* Paired with the WRITE_ONCE() in unix_inflight(), +* unix_notinflight(), and __unix_gc(). +*/ +if (READ_ONCE (unix_tot_inflight) >UNIX_INFLIGHT_TRIGGER_GC && + !READ_ONCE (gc_in_progress)) +unix_gc (); + +if (READ_ONCE (gc_in_progress)) +flush_work (&unix_gc_work); +}
Greg Kroah-Hartman
maintainerPATCH 284/325 af_unix: Try to run GC async.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
commit d9f21b3613337b55cc9d4a6ead484dca68475143 upstream.
If more than 16000 inflight AF_UNIX sockets exist and the garbage collector is not running, unix_(dgram|stream)_sendmsg() call unix_gc(). Also, they wait for unix_gc() to complete.
In unix_gc(), all inflight AF_UNIX sockets are traversed at least once, and more if they are the GC candidate. Thus, sendmsg() significantly slows down with too many inflight AF_UNIX sockets.
However, if a process sends data with no AF_UNIX FD, the sendmsg() call does not need to wait for GC. After this change, only the process that meets the condition below will be blocked under such a situation.
1) cmsg contains AF_UNIX socket
2) more than 32 AF_UNIX sent by the same user are still inflight
Note that even a sendmsg() call that does not meet the condition but has AF_UNIX FD will be blocked later in unix_scm_to_skb() by the spinlock, but we allow that as a bonus for sane users.
The results below are the time spent in unix_dgram_sendmsg() sending 1 byte of data with no FD 4096 times on a host where 32K inflight AF_UNIX sockets exist.
Without series: the sane sendmsg() needs to wait gc unreasonably.
$ sudo /usr/share/bcc/tools/funclatency -p 11165 unix_dgram_sendmsg
Tracing 1 functions for "unix_dgram_sendmsg"... Hit Ctrl-C to end.
^C
nsecs : count distribution
[...]
524288 -> 1048575 : 0 | |
1048576 -> 2097151 : 3881 |****************************************|
2097152 -> 4194303 : 214 |** |
4194304 -> 8388607 : 1 | |avg = 1825567 nsecs, total: 7477526027 nsecs, count: 4096
With series: the sane sendmsg() can finish much faster.
$ sudo /usr/share/bcc/tools/funclatency -p 8702 unix_dgram_sendmsg
Tracing 1 functions for "unix_dgram_sendmsg"... Hit Ctrl-C to end.
^C
nsecs : count distribution
[...]
128 -> 255 : 0 | |
256 -> 511 : 4092 |****************************************|
512 -> 1023 : 2 | |
1024 -> 2047 : 0 | |
2048 -> 4095 : 0 | |
4096 -> 8191 : 1 | |
8192 -> 16383 : 1 | |avg = 410 nsecs, total: 1680510 nsecs, count: 4096
--- include/net/af_unix.h | 12 ++++++++++-- include/net/scm.h | 1 + net/core/scm.c | 5 +++++ net/unix/af_unix.c | 6 ++++-- net/unix/garbage.c | 10 +++++++++- 5 files changed, 29 insertions(+), 5 deletions(-)
include/net/af_unix.h +10 -2
@@ -8,12 +8,20 @@#include <linux/refcount.h> #include <net/sock.h> +#if IS_ENABLED (CONFIG_UNIX ) +struct unix_sock *unix_get_socket (struct file *filp); +#else +static inline struct unix_sock *unix_get_socket (struct file *filp) +{ +return NULL ; +} +#endif +void unix_inflight (struct user_struct *user,struct file *fp);void unix_notinflight (struct user_struct *user,struct file *fp);void unix_destruct_scm (struct sk_buff *skb);void unix_gc (void ); -void wait_for_unix_gc (void ); -struct unix_sock *unix_get_socket (struct file *filp); +void wait_for_unix_gc (struct scm_fp_list *fpl);struct sock *unix_peer_get (struct sock *sk);#define UNIX_HASH_MOD (256 - 1)
include/net/scm.h +1 -0
@@ -23,6 +23,7 @@ struct scm_creds {struct scm_fp_list {short count; +short count_unix;short max;struct user_struct *user;struct file *fp[SCM_MAX_FD ];
net/core/scm.c +5 -0
@@ -36,6 +36,7 @@#include <net/compat.h> #include <net/scm.h> #include <net/cls_cgroup.h> +#include <net/af_unix.h> /*
@@ -85,6 +86,7 @@ static int scm_fp_copy(struct cmsghdr *creturn -ENOMEM ; *fplp = fpl; fpl->count =0 ; + fpl->count_unix =0 ; fpl->max =SCM_MAX_FD ; fpl->user =NULL ; }
@@ -109,6 +111,9 @@ static int scm_fp_copy(struct cmsghdr *cfput (file);return -EINVAL ; } +if (unix_get_socket (file)) + fpl->count_unix++; + *fpp++ = file; fpl->count++; }
net/unix/af_unix.c +4 -2
@@ -1875,11 +1875,12 @@ static int unix_dgram_sendmsg(struct soclong timeo;int err; -wait_for_unix_gc (); err =scm_send (sock, msg, &scm, false);if (err <0 )return err; +wait_for_unix_gc (scm.fp); + err = -EOPNOTSUPP ;if (msg->msg_flags&MSG_OOB ) goto out;
@@ -2145,11 +2146,12 @@ static int unix_stream_sendmsg(struct sobool fds_sent = false;int data_len; -wait_for_unix_gc (); err =scm_send (sock, msg, &scm, false);if (err <0 )return err; +wait_for_unix_gc (scm.fp); + err = -EOPNOTSUPP ;if (msg->msg_flags &MSG_OOB ) {#if IS_ENABLED (CONFIG_AF_UNIX_OOB )
net/unix/garbage.c +9 -1
@@ -335,8 +335,9 @@ void unix_gc(void) }#define UNIX_INFLIGHT_TRIGGER_GC 16000 +#define UNIX_INFLIGHT_SANE_USER (SCM_MAX_FD * 8) -void wait_for_unix_gc (void ) +void wait_for_unix_gc (struct scm_fp_list *fpl) {/* If number of inflight sockets is insane, * force a garbage collect right now.
@@ -348,6 +349,13 @@ void wait_for_unix_gc(void) !READ_ONCE(gc_in_progress))unix_gc (); +/* Penalise users who want to send AF_UNIX sockets +* but whose sockets have not been received yet. +*/ +if (!fpl || !fpl->count_unix || +READ_ONCE (fpl->user->unix_inflight) <UNIX_INFLIGHT_SANE_USER ) +return ; +if (READ_ONCE (gc_in_progress))flush_work (&unix_gc_work); }
Greg Kroah-Hartman
maintainerPATCH 285/325 af_unix: Replace BUG_ON() with WARN_ON_ONCE().
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
commit d0f6dc26346863e1f4a23117f5468614e54df064 upstream.
This is a prep patch for the last patch in this series so that checkpatch will not warn about BUG_ON().
--- net/unix/garbage.c | 8 ++++---- net/unix/scm.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
net/unix/garbage.c +4 -4
@@ -145,7 +145,7 @@ static void scan_children(struct sock *x/* An embryo cannot be in-flight, so it's safe * to use the list link. */ -BUG_ON (!list_empty (&u->link)); +WARN_ON_ONCE (!list_empty (&u->link));list_add_tail (&u->link, &embryos); }spin_unlock (&x->sk_receive_queue.lock);
@@ -224,8 +224,8 @@ static void __unix_gc(struct work_struct total_refs =file_count (sk->sk_socket->file); -BUG_ON (!u->inflight); -BUG_ON (total_refs < u->inflight); +WARN_ON_ONCE (!u->inflight); +WARN_ON_ONCE (total_refs < u->inflight);if (total_refs == u->inflight) {list_move_tail (&u->link, &gc_candidates);__set_bit (UNIX_GC_CANDIDATE , &u->gc_flags);
@@ -318,7 +318,7 @@ static void __unix_gc(struct work_structlist_move_tail (&u->link, &gc_inflight_list);/* All candidates should have been detached by now. */ -BUG_ON (!list_empty (&gc_candidates)); +WARN_ON_ONCE (!list_empty (&gc_candidates));/* Paired with READ_ONCE() in wait_for_unix_gc(). */ WRITE_ONCE (gc_in_progress, false);
net/unix/scm.c +4 -4
@@ -50,10 +50,10 @@ void unix_inflight(struct user_struct *uif (u) {if (!u->inflight) { -BUG_ON (!list_empty (&u->link)); +WARN_ON_ONCE (!list_empty (&u->link));list_add_tail (&u->link, &gc_inflight_list); }else { -BUG_ON (list_empty (&u->link)); +WARN_ON_ONCE (list_empty (&u->link)); } u->inflight++;/* Paired with READ_ONCE() in wait_for_unix_gc() */
@@ -70,8 +70,8 @@ void unix_notinflight(struct user_structspin_lock (&unix_gc_lock);if (u) { -BUG_ON (!u->inflight); -BUG_ON (list_empty (&u->link)); +WARN_ON_ONCE (!u->inflight); +WARN_ON_ONCE (list_empty (&u->link)); u->inflight--;if (!u->inflight)
Greg Kroah-Hartman
maintainerPATCH 286/325 af_unix: Remove io_uring code for GC.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
commit 11498715f266a3fb4caabba9dd575636cbcaa8f1 upstream.
Since commit 705318a99a13 ("io_uring/af_unix: disable sending io_uring over sockets"), io_uring's unix socket cannot be passed via SCM_RIGHTS, so it does not contribute to cyclic reference and no longer be candidate for garbage collection.
Also, commit 6e5e6d274956 ("io_uring: drop any code related to SCM_RIGHTS") cleaned up SCM_RIGHTS code in io_uring.
Let's do it in AF_UNIX as well by reverting commit 0091bfc81741 ("io_uring/af_unix: defer registered files gc to io_uring release") and commit 10369080454d ("net: reclaim skb->scm_io_uring bit").
--- net/unix/garbage.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-)
net/unix/garbage.c +2 -23
@@ -184,12 +184,10 @@ static bool gc_in_progress;static void __unix_gc (struct work_struct *work) { -struct sk_buff *next_skb, *skb; -struct unix_sock *u; -struct unix_sock *next;struct sk_buff_head hitlist; -struct list_head cursor; +struct unix_sock *u, *next;LIST_HEAD (not_cycle_list); +struct list_head cursor;spin_lock (&unix_gc_lock);
@@ -293,30 +291,11 @@ static void __unix_gc(struct work_structspin_unlock (&unix_gc_lock); -/* We need io_uring to clean its registered files, ignore all io_uring -* originated skbs. It's fine as io_uring doesn't keep references to -* other io_uring instances and so killing all other files in the cycle -* will put all io_uring references forcing it to go through normal -* release.path eventually putting registered files. -*/ - skb_queue_walk_safe(&hitlist, skb, next_skb) { -if (skb->scm_io_uring) { -__skb_unlink (skb, &hitlist); -skb_queue_tail (&skb->sk->sk_receive_queue, skb); - } - } -/* Here we are. Hitlist is filled. Die. */ __skb_queue_purge (&hitlist);spin_lock (&unix_gc_lock); -/* There could be io_uring registered files, just push them back to -* the inflight list -*/ -list_for_each_entry_safe (u, next, &gc_candidates, link) -list_move_tail (&u->link, &gc_inflight_list); -/* All candidates should have been detached by now. */ WARN_ON_ONCE (!list_empty (&gc_candidates));
Greg Kroah-Hartman
maintainerPATCH 287/325 af_unix: Remove CONFIG_UNIX_SCM.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
commit 99a7a5b9943ea2d05fb0dee38e4ae2290477ed83 upstream.
Originally, the code related to garbage collection was all in garbage.c.
Commit f4e65870e5ce ("net: split out functions related to registering inflight socket files") moved some functions to scm.c for io_uring and added CONFIG_UNIX_SCM just in case AF_UNIX was built as module.
However, since commit 97154bcf4d1b ("af_unix: Kconfig: make CONFIG_UNIX bool"), AF_UNIX is no longer built separately. Also, io_uring does not support SCM_RIGHTS now.
Let's move the functions back to garbage.c
--- include/net/af_unix.h | 7 +- net/Makefile | 2 net/unix/Kconfig | 5 - net/unix/Makefile | 2 net/unix/af_unix.c | 63 ++++++++++++++++++++- net/unix/garbage.c | 73 +++++++++++++++++++++++- net/unix/scm.c | 149 -------------------------------------------------- net/unix/scm.h | 10 --- 8 files changed, 137 insertions(+), 174 deletions(-) delete mode 100644 net/unix/scm.c delete mode 100644 net/unix/scm.h
include/net/af_unix.h +4 -3
@@ -17,19 +17,20 @@ static inline struct unix_sock *unix_get }#endif +extern spinlock_t unix_gc_lock; +extern unsigned int unix_tot_inflight; +void unix_inflight (struct user_struct *user,struct file *fp);void unix_notinflight (struct user_struct *user,struct file *fp); -void unix_destruct_scm (struct sk_buff *skb);void unix_gc (void );void wait_for_unix_gc (struct scm_fp_list *fpl); +struct sock *unix_peer_get (struct sock *sk);#define UNIX_HASH_MOD (256 - 1)#define UNIX_HASH_SIZE (256 * 2)#define UNIX_HASH_BITS 8 -extern unsigned int unix_tot_inflight; -struct unix_address {refcount_t refcnt;int len;
net/Makefile +1 -1
@@ -17,7 +17,7 @@ obj-$(CONFIG_NETFILTER) += netfilter/ obj-$(CONFIG_INET) += ipv4/ obj-$(CONFIG_TLS) += tls/ obj-$(CONFIG_XFRM) += xfrm/ -obj-$(CONFIG_UNIX_SCM) += unix/ +obj-$(CONFIG_UNIX) += unix/ obj-y += ipv6/ obj-$(CONFIG_BPFILTER) += bpfilter/ obj-$(CONFIG_PACKET) += packet/
net/unix/Kconfig +0 -5
@@ -16,11 +16,6 @@ config UNIX Say Y unless you know what you are doing. -config UNIX_SCM - bool - depends on UNIX - default y - config AF_UNIX_OOB bool depends on UNIX
net/unix/Makefile +0 -2
@@ -11,5 +11,3 @@ unix-$(CONFIG_BPF_SYSCALL) += unix_bpf.o obj-$(CONFIG_UNIX_DIAG) += unix_diag.o unix_diag-y := diag.o - -obj-$(CONFIG_UNIX_SCM) += scm.o
net/unix/af_unix.c +61 -2
81 lines not on this page · raw message
net/unix/garbage.c +71 -2
82 lines not on this page · raw message
net/unix/scm.c deleted +0 -149
149 lines not on this page · raw message
net/unix/scm.h deleted +0 -10
@@ -1,10 +0,0 @@ -#ifndef NET_UNIX_SCM_H -#define NET_UNIX_SCM_H - -extern struct list_head gc_inflight_list; -extern spinlock_t unix_gc_lock; - -int unix_attach_fds (struct scm_cookie *scm,struct sk_buff *skb); -void unix_detach_fds (struct scm_cookie *scm,struct sk_buff *skb); - -#endif