5.12.17-rc1 review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 295/700 hwmon: (max31722) Remove non-standard ACPI device IDs
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 97387c2f06bcfd79d04a848d35517b32ee6dca7c ]
Valid Maxim Integrated ACPI device IDs would start with MXIM, not with MAX1. On top of that, ACPI device IDs reflecting chip names are almost always invalid.
Remove the invalid ACPI IDs.
--- drivers/hwmon/max31722.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/hwmon/max31722.c +0 -9
@@ -6,7 +6,6 @@* Copyright (c) 2016, Intel Corporation. */ -#include <linux/acpi.h> #include <linux/hwmon.h> #include <linux/hwmon-sysfs.h> #include <linux/kernel.h>
@@ -133,20 +132,12 @@ static const struct spi_device_id max31722_spi_id[] = { {"max31723", 0}, {} }; - -static const struct acpi_device_id __maybe_unused max31722_acpi_id[] = { - {"MAX31722" ,0 }, - {"MAX31723" ,0 }, - {} -}; -MODULE_DEVICE_TABLE (spi, max31722_spi_id);static struct spi_driver max31722_driver = { .driver = { .name ="max31722" , .pm = &max31722_pm_ops, - .acpi_match_table =ACPI_PTR (max31722_acpi_id), }, .probe = max31722_probe, .remove = max31722_remove,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 296/700 hwmon: (max31790) Fix fan speed reporting for fan7..12
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit cbbf244f0515af3472084f22b6213121b4a63835 ]
Fans 7..12 do not have their own set of configuration registers. So far the code ignored that and read beyond the end of the configuration register range to get the tachometer period. This resulted in more or less random fan speed values for those fans.
The datasheet is quite vague when it comes to defining the tachometer period for fans 7..12. Experiments confirm that the period is the same for both fans associated with a given set of configuration registers.
--- drivers/hwmon/max31790.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/max31790.c +1 -1
@@ -171,7 +171,7 @@ static int max31790_read_fan(struct device *dev, u32 attr, int channel,switch (attr) {case hwmon_fan_input: - sr =get_tach_period (data->fan_dynamics[channel]); + sr =get_tach_period (data->fan_dynamics[channel %NR_CHANNEL ]); rpm =RPM_FROM_REG (data->tach[channel], sr); *val = rpm;return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 297/700 KVM: nVMX: Sync all PGDs on nested transition with shadow paging
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit 07ffaf343e34b555c9e7ea39a9c81c439a706f13 ]
Trigger a full TLB flush on behalf of the guest on nested VM-Enter and VM-Exit when VPID is disabled for L2. kvm_mmu_new_pgd() syncs only the current PGD, which can theoretically leave stale, unsync'd entries in a previous guest PGD, which could be consumed if L2 is allowed to load CR3 with PCID_NOFLUSH=1.
Rename KVM_REQ_HV_TLB_FLUSH to KVM_REQ_TLB_FLUSH_GUEST so that it can be utilized for its obvious purpose of emulating a guest TLB flush.
Note, there is no change the actual TLB flush executed by KVM, even though the fast PGD switch uses KVM_REQ_TLB_FLUSH_CURRENT. When VPID is disabled for L2, vpid02 is guaranteed to be '0', and thus nested_get_vpid02() will return the VPID that is shared by L1 and L2.
Generate the request outside of kvm_mmu_new_pgd(), as getting the common helper to correctly identify which requested is needed is quite painful. E.g. using KVM_REQ_TLB_FLUSH_GUEST when nested EPT is in play is wrong as a TLB flush from the L1 kernel's perspective does not invalidate EPT mappings. And, by using KVM_REQ_TLB_FLUSH_GUEST, nVMX can do future simplification by moving the logic into nested_vmx_transition_tlb_flush().
Message-Id: <[email protected]>
--- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/hyperv.c | 2 +- arch/x86/kvm/vmx/nested.c | 17 ++++++++++++----- arch/x86/kvm/x86.c | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -1
@@ -85,7 +85,7 @@#define KVM_REQ_APICV_UPDATE \ KVM_ARCH_REQ_FLAGS(25, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP)#define KVM_REQ_TLB_FLUSH_CURRENT KVM_ARCH_REQ(26) -#define KVM_REQ_HV_TLB_FLUSH \ +#define KVM_REQ_TLB_FLUSH_GUEST \ KVM_ARCH_REQ_FLAGS(27, KVM_REQUEST_NO_WAKEUP)#define KVM_REQ_APF_READY KVM_ARCH_REQ(28)#define KVM_REQ_MSR_FILTER_CHANGED KVM_ARCH_REQ(29)
arch/x86/kvm/hyperv.c +1 -1
@@ -1704,7 +1704,7 @@ static u64 kvm_hv_flush_tlb(struct kvm_vcpu *vcpu, u64 ingpa, u16 rep_cnt, bool* vcpu->arch.cr3 may not be up-to-date for running vCPUs so we can't * analyze it here, flush TLB regardless of the specified address space. */ -kvm_make_vcpus_request_mask (kvm,KVM_REQ_HV_TLB_FLUSH , +kvm_make_vcpus_request_mask (kvm,KVM_REQ_TLB_FLUSH_GUEST ,NULL , vcpu_mask, &hv_vcpu->tlb_flush); ret_success:
arch/x86/kvm/vmx/nested.c +12 -5
@@ -1132,12 +1132,19 @@ static int nested_vmx_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3, bool ne/* * Unconditionally skip the TLB flush on fast CR3 switch, all TLB -* flushes are handled by nested_vmx_transition_tlb_flush(). See -* nested_vmx_transition_mmu_sync for details on skipping the MMU sync. +* flushes are handled by nested_vmx_transition_tlb_flush(). */ -if (!nested_ept) -kvm_mmu_new_pgd (vcpu, cr3, true, - !nested_vmx_transition_mmu_sync (vcpu)); +if (!nested_ept) { +kvm_mmu_new_pgd (vcpu, cr3, true, true); + +/* +* A TLB flush on VM-Enter/VM-Exit flushes all linear mappings +* across all PCIDs, i.e. all PGDs need to be synchronized. +* See nested_vmx_transition_mmu_sync() for more details. +*/ +if (nested_vmx_transition_mmu_sync (vcpu)) +kvm_make_request (KVM_REQ_TLB_FLUSH_GUEST , vcpu); + } vcpu->arch.cr3 = cr3;kvm_register_mark_available (vcpu,VCPU_EXREG_CR3 );
arch/x86/kvm/x86.c +1 -1
@@ -9022,7 +9022,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) }if (kvm_check_request (KVM_REQ_TLB_FLUSH_CURRENT , vcpu))kvm_vcpu_flush_tlb_current (vcpu); -if (kvm_check_request (KVM_REQ_HV_TLB_FLUSH , vcpu)) +if (kvm_check_request (KVM_REQ_TLB_FLUSH_GUEST , vcpu))kvm_vcpu_flush_tlb_guest (vcpu);if (kvm_check_request (KVM_REQ_REPORT_TPR_ACCESS , vcpu)) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 298/700 KVM: nVMX: Ensure 64-bit shift when checking VMFUNC bitmap
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit 0e75225dfa4c5d5d51291f54a3d2d5895bad38da ]
Use BIT_ULL() instead of an open-coded shift to check whether or not a function is enabled in L1's VMFUNC bitmap. This is a benign bug as KVM supports only bit 0, and will fail VM-Enter if any other bits are set, i.e. bits 63:32 are guaranteed to be zero.
Note, "function" is bounded by hardware as VMFUNC will #UD before taking a VM-Exit if the function is greater than 63.
Before:
if ((vmcs12->vm_function_control & (1 << function)) == 0)
0x000000000001a916 <+118>: mov $0x1,%eax
0x000000000001a91b <+123>: shl %cl,%eax
0x000000000001a91d <+125>: cltq
0x000000000001a91f <+127>: and 0x128(%rbx),%rax
After:
if (!(vmcs12->vm_function_control & BIT_ULL(function & 63)))
0x000000000001a955 <+117>: mov 0x128(%rbx),%rdx
0x000000000001a95c <+124>: bt %rax,%rdx
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx/nested.c +1 -1
@@ -5524,7 +5524,7 @@ static int handle_vmfunc(struct kvm_vcpu *vcpu) } vmcs12 =get_vmcs12 (vcpu); -if ((vmcs12->vm_function_control & (1 << function)) ==0 ) +if (!(vmcs12->vm_function_control &BIT_ULL (function))) goto fail;switch (function) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 299/700 KVM: nVMX: Dont clobber nested MMUs A/D status on EPTP switch
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit 272b0a998d084e7667284bdd2d0c675c6a2d11de ]
Drop bogus logic that incorrectly clobbers the accessed/dirty enabling status of the nested MMU on an EPTP switch. When nested EPT is enabled, walk_mmu points at L2's _legacy_ page tables, not L1's EPT for L2.
This is likely a benign bug, as mmu->ept_ad is never consumed (since the MMU is not a nested EPT MMU), and stuffing mmu_role.base.ad_disabled will never propagate into future shadow pages since the nested MMU isn't used to map anything, just to walk L2's page tables.
Note, KVM also does a full MMU reload, i.e. the guest_mmu will be recreated using the new EPTP, and thus any change in A/D enabling will be properly recognized in the relevant MMU.
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/nested.c | 7 ------- 1 file changed, 7 deletions(-)
arch/x86/kvm/vmx/nested.c +0 -7
@@ -5472,8 +5472,6 @@ static int nested_vmx_eptp_switching(struct kvm_vcpu *vcpu, {u32 index =kvm_rcx_read (vcpu);u64 new_eptp; -bool accessed_dirty; -struct kvm_mmu *mmu = vcpu->arch.walk_mmu;if (!nested_cpu_has_eptp_switching (vmcs12) || !nested_cpu_has_ept (vmcs12))
@@ -5482,13 +5480,10 @@ static int nested_vmx_eptp_switching(struct kvm_vcpu *vcpu,if (index >=VMFUNC_EPTP_ENTRIES )return 1 ; -if (kvm_vcpu_read_guest_page (vcpu, vmcs12->eptp_list_address >>PAGE_SHIFT , &new_eptp, index *8 ,8 ))return 1 ; - accessed_dirty = !!(new_eptp &VMX_EPTP_AD_ENABLE_BIT ); -/* * If the (L2) guest does a vmfunc to the currently * active ept pointer, we don't have to do anything else
@@ -5497,8 +5492,6 @@ static int nested_vmx_eptp_switching(struct kvm_vcpu *vcpu,if (!nested_vmx_check_eptp (vcpu, new_eptp))return 1 ; - mmu->ept_ad = accessed_dirty; - mmu->mmu_role.base.ad_disabled = !accessed_dirty; vmcs12->ept_pointer = new_eptp;kvm_make_request (KVM_REQ_MMU_RELOAD , vcpu);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 300/700 KVM: x86/mmu: Fix return value in tdp_mmu_map_handle_target_level()
In reply to Greg Kroah-HartmanFrom: Kai Huang <[email protected]>
[ Upstream commit 57a3e96d6d17ae5ac9861ef34af024a627f1c3bb ]
Currently tdp_mmu_map_handle_target_level() returns 0, which is RET_PF_RETRY, when page fault is actually fixed. This makes kvm_tdp_mmu_map() also return RET_PF_RETRY in this case, instead of RET_PF_FIXED. Fix by initializing ret to RET_PF_FIXED.
Note that kvm_mmu_page_fault() resumes guest on both RET_PF_RETRY and RET_PF_FIXED, which means in practice returning the two won't make difference, so this fix alone won't be necessary for stable tree.
Message-Id: <f9e8956223a586cd28c090879a8ff40f5eb6d609.1623717884.git.kai.huang@intel.com>
--- arch/x86/kvm/mmu/tdp_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/mmu/tdp_mmu.c +1 -1
@@ -745,7 +745,7 @@ static int tdp_mmu_map_handle_target_level(struct kvm_vcpu *vcpu, int write, kvm_pfn_t pfn, bool prefault) {u64 new_spte; -int ret =0 ; +int ret =RET_PF_FIXED ;int make_spte_ret =0 ;if (unlikely (is_noslot_pfn (pfn)))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 301/700 KVM: x86/mmu: Drop redundant trace_kvm_mmu_set_spte() in the TDP MMU
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit 3849e0924ef14a245aa292ecaa9accdc4792012c ]
Remove TDP MMU's call to trace_kvm_mmu_set_spte() that is done for both shadow-present SPTEs and MMIO SPTEs. It's fully redundant for the former, and unnecessary for the latter. This aligns TDP MMU tracing behavior with that of the legacy MMU.
Message-Id: <[email protected]>
--- arch/x86/kvm/mmu/tdp_mmu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kvm/mmu/tdp_mmu.c +2 -3
@@ -777,12 +777,11 @@ static int tdp_mmu_map_handle_target_level(struct kvm_vcpu *vcpu, int write,trace_mark_mmio_spte (rcu_dereference (iter->sptep), iter->gfn, new_spte); ret =RET_PF_EMULATE ; - }else + }else {trace_kvm_mmu_set_spte (iter->level, iter->gfn,rcu_dereference (iter->sptep)); + } -trace_kvm_mmu_set_spte (iter->level, iter->gfn, -rcu_dereference (iter->sptep));if (!prefault) vcpu->stat.pf_fixed++;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 302/700 KVM: x86/mmu: Fix pf_fixed count in tdp_mmu_map_handle_target_level()
In reply to Greg Kroah-HartmanFrom: Kai Huang <[email protected]>
[ Upstream commit 857f84743e4b78500afae010d866675642e18e90 ]
Currently pf_fixed is not increased when prefault is true. This is not correct, since prefault here really means "async page fault completed". In that case, the original page fault from the guest was morphed into as async page fault and pf_fixed was not increased. So when prefault indicates async page fault is completed, pf_fixed should be increased.
Additionally, currently pf_fixed is also increased even when page fault is spurious, while legacy MMU increases pf_fixed when page fault returns RET_PF_EMULATE or RET_PF_FIXED.
To fix above two issues, change to increase pf_fixed when return value is not RET_PF_SPURIOUS (RET_PF_RETRY has already been ruled out by reaching here).
More information:
https://lore.kernel.org/kvm/[email protected]/T/#mbb5f8083e58a2cd262231512b9211cbe70fc3bd5
Message-Id: <2ea8b7f5d4f03c99b32bc56fc982e1e4e3d3fc6b.1623717884.git.kai.huang@intel.com>
--- arch/x86/kvm/mmu/tdp_mmu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/kvm/mmu/tdp_mmu.c +5 -1
@@ -782,7 +782,11 @@ static int tdp_mmu_map_handle_target_level(struct kvm_vcpu *vcpu, int write, rcu_dereference(iter->sptep)); } -if (!prefault) +/* +* Increase pf_fixed in both RET_PF_EMULATE and RET_PF_FIXED to be +* consistent with legacy MMU behavior. +*/ +if (ret !=RET_PF_SPURIOUS ) vcpu->stat.pf_fixed++;return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 303/700 perf/arm-cmn: Fix invalid pointer when access dtc object sharing the same IRQ number
In reply to Greg Kroah-HartmanFrom: Tuan Phan <[email protected]>
[ Upstream commit 4e16f283edc289820e9b2d6f617ed8e514ee8396 ]
When multiple dtcs share the same IRQ number, the irq_friend which used to refer to dtc object gets calculated incorrect which leads to invalid pointer.
--- drivers/perf/arm-cmn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm-cmn.c +1 -1
@@ -1212,7 +1212,7 @@ static int arm_cmn_init_irqs(struct arm_cmn *cmn) irq = cmn->dtc[i].irq;for (j = i; j--; ) {if (cmn->dtc[j].irq == irq) { - cmn->dtc[j].irq_friend = j - i; + cmn->dtc[j].irq_friend = i - j; goto next; } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 304/700 KVM: arm64: Dont zero the cycle count register when PMCR_EL0.P is set
In reply to Greg Kroah-HartmanFrom: Alexandru Elisei <[email protected]>
[ Upstream commit 2a71fabf6a1bc9162a84e18d6ab991230ca4d588 ]
According to ARM DDI 0487G.a, page D13-3895, setting the PMCR_EL0.P bit to 1 has the following effect:
"Reset all event counters accessible in the current Exception level, not including PMCCNTR_EL0, to zero."
Similar behaviour is described for AArch32 on page G8-7022. Make it so.
--- arch/arm64/kvm/pmu-emul.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kvm/pmu-emul.c +1 -0
@@ -578,6 +578,7 @@ void kvm_pmu_handle_pmcr(struct kvm_vcpu *vcpu, u64 val)kvm_pmu_set_counter_value (vcpu,ARMV8_PMU_CYCLE_IDX ,0 );if (val &ARMV8_PMU_PMCR_P ) { + mask &= ~BIT (ARMV8_PMU_CYCLE_IDX );for_each_set_bit (i, &mask,32 )kvm_pmu_set_counter_value (vcpu, i,0 ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 305/700 regulator: hi655x: Fix pass wrong pointer to config.driver_data
In reply to Greg Kroah-HartmanFrom: Axel Lin <[email protected]>
[ Upstream commit 61eb1b24f9e4f4e0725aa5f8164a932c933f3339 ]
Current code sets config.driver_data to a zero initialized regulator which is obviously wrong. Fix it.
--- drivers/regulator/hi655x-regulator.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/regulator/hi655x-regulator.c +5 -11
@@ -72,7 +72,7 @@ enum hi655x_regulator_id {static int hi655x_is_enabled (struct regulator_dev *rdev) {unsigned int value =0 ; -struct hi655x_regulator *regulator =rdev_get_drvdata (rdev); +const struct hi655x_regulator *regulator =rdev_get_drvdata (rdev);regmap_read (rdev->regmap, regulator->status_reg, &value);return (value & rdev->desc->enable_mask);
@@ -80,7 +80,7 @@ static int hi655x_is_enabled(struct regulator_dev *rdev)static int hi655x_disable (struct regulator_dev *rdev) { -struct hi655x_regulator *regulator =rdev_get_drvdata (rdev); +const struct hi655x_regulator *regulator =rdev_get_drvdata (rdev);return regmap_write (rdev->regmap, regulator->disable_reg, rdev->desc->enable_mask);
@@ -169,7 +169,6 @@ static const struct hi655x_regulator regulators[] = {static int hi655x_regulator_probe (struct platform_device *pdev) {unsigned int i; -struct hi655x_regulator *regulator;struct hi655x_pmic *pmic;struct regulator_config config = { };struct regulator_dev *rdev;
@@ -180,22 +179,17 @@ static int hi655x_regulator_probe(struct platform_device *pdev)return -ENODEV ; } - regulator =devm_kzalloc (&pdev->dev,sizeof (*regulator),GFP_KERNEL ); -if (!regulator) -return -ENOMEM ; - -platform_set_drvdata (pdev, regulator); - config.dev = pdev->dev.parent; config.regmap = pmic->regmap; - config.driver_data = regulator;for (i =0 ; i <ARRAY_SIZE (regulators); i++) { + config.driver_data = (void *) ®ulators[i]; + rdev =devm_regulator_register (&pdev->dev, ®ulators[i].rdesc, &config);if (IS_ERR (rdev)) {dev_err (&pdev->dev,"failed to register regulator %s\n" , - regulator->rdesc.name); + regulators[i].rdesc.name);return PTR_ERR (rdev); } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 306/700 regulator: hi6421v600: Fix setting idle mode
In reply to Greg Kroah-HartmanFrom: Axel Lin <[email protected]>
[ Upstream commit 57c045bc727001c43b6a65adb0418aa7b3e6dbd0 ]
commit db27f8294cd7 changed eco_mode << (ffs(sreg->eco_mode_mask) - 1) to sreg->eco_mode_mask << (ffs(sreg->eco_mode_mask) - 1) which is wrong. Fix it by simply set val = sreg->eco_mode_mask.
In additional, sreg->eco_mode_mask can be 0 (LDO3, LDO33, LDO34). Return -EINVAL if idle mode is not supported when sreg->eco_mode_mask is 0.
While at it, also use unsigned int for reg_val/val which is the expected type for regmap_read and regmap_update_bits.
--- drivers/staging/hikey9xx/hi6421v600-regulator.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/hikey9xx/hi6421v600-regulator.c +6 -3
@@ -129,7 +129,7 @@ static unsigned int hi6421_spmi_regulator_get_mode(struct regulator_dev *rdev) {struct hi6421_spmi_reg_info *sreg =rdev_get_drvdata (rdev);struct hi6421_spmi_pmic *pmic = sreg->pmic; -u32 reg_val; +unsigned int reg_val;regmap_read (pmic->regmap, rdev->desc->enable_reg, ®_val);
@@ -144,14 +144,17 @@ static int hi6421_spmi_regulator_set_mode(struct regulator_dev *rdev, {struct hi6421_spmi_reg_info *sreg =rdev_get_drvdata (rdev);struct hi6421_spmi_pmic *pmic = sreg->pmic; -u32 val; +unsigned int val;switch (mode) {case REGULATOR_MODE_NORMAL : val =0 ;break ;case REGULATOR_MODE_IDLE : - val = sreg->eco_mode_mask << (ffs (sreg->eco_mode_mask) -1 ); +if (!sreg->eco_mode_mask) +return -EINVAL ; + + val = sreg->eco_mode_mask;break ;default :return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 307/700 btrfs: clear log tree recovering status if starting transaction fails
In reply to Greg Kroah-HartmanFrom: David Sterba <[email protected]>
[ Upstream commit 1aeb6b563aea18cd55c73cf666d1d3245a00f08c ]
When a log recovery is in progress, lots of operations have to take that into account, so we keep this status per tree during the operation. Long time ago error handling revamp patch 79787eaab461 ("btrfs: replace many BUG_ONs with proper error handling") removed clearing of the status in an error branch. Add it back as was intended in e02119d5a7b4 ("Btrfs:
Add a write ahead tree log to optimize synchronous operations").
There are probably no visible effects, log replay is done only during mount and if it fails all structures are cleared so the stale status won't be kept.
--- fs/btrfs/tree-log.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/tree-log.c +1 -0
@@ -6365,6 +6365,7 @@ next: error:if (wc.trans)btrfs_end_transaction (wc.trans); +clear_bit (BTRFS_FS_LOG_RECOVERING , &fs_info->flags);btrfs_free_path (path);return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 308/700 x86/sev: Make sure IRQs are disabled while GHCB is active
In reply to Greg Kroah-HartmanFrom: Joerg Roedel <[email protected]>
[ Upstream commit d187f217335dba2b49fc9002aab2004e04acddee ]
The #VC handler only cares about IRQs being disabled while the GHCB is active, as it must not be interrupted by something which could cause another #VC while it holds the GHCB (NMI is the exception for which the backup GHCB exits).
Make sure nothing interrupts the code path while the GHCB is active by making sure that callers of __sev_{get,put}_ghcb() have disabled interrupts upfront.
[ bp: Massage commit message. ]
--- arch/x86/kernel/sev-es.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
arch/x86/kernel/sev-es.c +22 -12
@@ -12,7 +12,6 @@#include <linux/sched/debug.h> /* For show_regs() */ #include <linux/percpu-defs.h> #include <linux/mem_encrypt.h> -#include <linux/lockdep.h> #include <linux/printk.h> #include <linux/mm_types.h> #include <linux/set_memory.h>
@@ -180,11 +179,19 @@ void noinstr __sev_es_ist_exit(void)this_cpu_write (cpu_tss_rw.x86_tss.ist[IST_INDEX_VC ], *(unsigned long *)ist); } -static __always_inline struct ghcb *sev_es_get_ghcb(struct ghcb_state *state) +/* +* Nothing shall interrupt this code path while holding the per-CPU +* GHCB. The backup GHCB is only for NMIs interrupting this path. +* +* Callers must disable local interrupts around it. +*/ +static noinstr struct ghcb *__sev_get_ghcb(struct ghcb_state *state) {struct sev_es_runtime_data *data;struct ghcb *ghcb; +WARN_ON (!irqs_disabled ()); + data =this_cpu_read (runtime_data); ghcb = &data->ghcb_page;
@@ -201,7 +208,9 @@ static __always_inline struct ghcb *sev_es_get_ghcb(struct ghcb_state *state) data->ghcb_active = false; data->backup_ghcb_active = false; +instrumentation_begin ();panic ("Unable to handle #VC exception! GHCB and Backup GHCB are already in use" ); +instrumentation_end (); }/* Mark backup_ghcb active before writing to it */
@@ -452,11 +461,13 @@ static enum es_result vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt/* Include code shared with pre-decompression boot stage */ #include "sev-es-shared.c" -static __always_inline void sev_es_put_ghcb(struct ghcb_state *state) +static noinstr void __sev_put_ghcb(struct ghcb_state *state) {struct sev_es_runtime_data *data;struct ghcb *ghcb; +WARN_ON (!irqs_disabled ()); + data =this_cpu_read (runtime_data); ghcb = &data->ghcb_page;
@@ -480,7 +491,7 @@ void noinstr __sev_es_nmi_complete(void)struct ghcb_state state;struct ghcb *ghcb; - ghcb =sev_es_get_ghcb (&state); + ghcb =__sev_get_ghcb (&state);vc_ghcb_invalidate (ghcb);ghcb_set_sw_exit_code (ghcb,SVM_VMGEXIT_NMI_COMPLETE );
@@ -490,7 +501,7 @@ void noinstr __sev_es_nmi_complete(void)sev_es_wr_ghcb_msr (__pa_nodebug (ghcb));VMGEXIT (); -sev_es_put_ghcb (&state); +__sev_put_ghcb (&state); }static u64 get_jump_table_addr (void )
@@ -502,7 +513,7 @@ static u64 get_jump_table_addr(void)local_irq_save (flags); - ghcb =sev_es_get_ghcb (&state); + ghcb =__sev_get_ghcb (&state);vc_ghcb_invalidate (ghcb);ghcb_set_sw_exit_code (ghcb,SVM_VMGEXIT_AP_JUMP_TABLE );
@@ -516,7 +527,7 @@ static u64 get_jump_table_addr(void) ghcb_sw_exit_info_2_is_valid(ghcb)) ret = ghcb->save.sw_exit_info_2; -sev_es_put_ghcb (&state); +__sev_put_ghcb (&state);local_irq_restore (flags);
@@ -641,7 +652,7 @@ static void sev_es_ap_hlt_loop(void)struct ghcb_state state;struct ghcb *ghcb; - ghcb =sev_es_get_ghcb (&state); + ghcb =__sev_get_ghcb (&state);while (true) {vc_ghcb_invalidate (ghcb);
@@ -658,7 +669,7 @@ static void sev_es_ap_hlt_loop(void)break ; } -sev_es_put_ghcb (&state); +__sev_put_ghcb (&state); }/*
@@ -1317,7 +1328,6 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication) } irq_state =irqentry_nmi_enter (regs); -lockdep_assert_irqs_disabled ();instrumentation_begin ();/*
@@ -1326,7 +1336,7 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)* keep the IRQs disabled to protect us against concurrent TLB flushes. */ - ghcb =sev_es_get_ghcb (&state); + ghcb =__sev_get_ghcb (&state);vc_ghcb_invalidate (ghcb); result =vc_init_em_ctxt (&ctxt, regs, error_code);
@@ -1334,7 +1344,7 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)if (result ==ES_OK ) result =vc_handle_exitcode (&ctxt, ghcb, error_code); -sev_es_put_ghcb (&state); +__sev_put_ghcb (&state);/* Done - now check the result */ switch (result) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 309/700 x86/sev: Split up runtime #VC handler for correct state tracking
In reply to Greg Kroah-HartmanFrom: Joerg Roedel <[email protected]>
[ Upstream commit be1a5408868af341f61f93c191b5e346ee88c82a ]
Split up the #VC handler code into a from-user and a from-kernel part. This allows clean and correct state tracking, as the #VC handler needs to enter NMI-state when raised from kernel mode and plain IRQ state when raised from user-mode.
--- arch/x86/entry/entry_64.S | 4 +- arch/x86/include/asm/idtentry.h | 29 +++---- arch/x86/kernel/sev-es.c | 148 +++++++++++++++++--------------- 3 files changed, 91 insertions(+), 90 deletions(-)
arch/x86/entry/entry_64.S +2 -2
@@ -506,7 +506,7 @@ SYM_CODE_START(\asmsym) movq %rsp, %rdi /* pt_regs pointer */ - call \cfunc + call kernel_\cfunc /* * No need to switch back to the IST stack. The current stack is either
@@ -517,7 +517,7 @@ SYM_CODE_START(\asmsym) /* Switch to the regular task stack */ .Lfrom_usermode_switch_stack_\@: - idtentry_body safe_stack_\cfunc, has_error_code=1 + idtentry_body user_\cfunc, has_error_code=1 _ASM_NOKPROBE(\asmsym) SYM_CODE_END(\asmsym)
arch/x86/include/asm/idtentry.h +10 -19
@@ -312,8 +312,8 @@ static __always_inline void __##func(struct pt_regs *regs)*/ #define DECLARE_IDTENTRY_VC (vector, func) \ DECLARE_IDTENTRY_RAW_ERRORCODE(vector, func); \ - __visible noinstr void ist_##func(struct pt_regs *regs, unsigned long error_code); \ - __visible noinstr void safe_stack_##func(struct pt_regs *regs, unsigned long error_code) + __visible noinstr void kernel_##func(struct pt_regs *regs, unsigned long error_code); \ + __visible noinstr void user_##func(struct pt_regs *regs, unsigned long error_code)/** * DEFINE_IDTENTRY_IST - Emit code for IST entry points
@@ -355,33 +355,24 @@ static __always_inline void __##func(struct pt_regs *regs)DEFINE_IDTENTRY_RAW_ERRORCODE (func)/** -* DEFINE_IDTENTRY_VC_SAFE_STACK - Emit code for VMM communication handler -which runs on a safe stack. +* DEFINE_IDTENTRY_VC_KERNEL - Emit code for VMM communication handler +when raised from kernel mode * @func: Function name of the entry point * * Maps to DEFINE_IDTENTRY_RAW_ERRORCODE */ -#define DEFINE_IDTENTRY_VC_SAFE_STACK (func) \ - DEFINE_IDTENTRY_RAW_ERRORCODE(safe_stack_##func) +#define DEFINE_IDTENTRY_VC_KERNEL (func) \ + DEFINE_IDTENTRY_RAW_ERRORCODE(kernel_##func)/** -* DEFINE_IDTENTRY_VC_IST - Emit code for VMM communication handler -which runs on the VC fall-back stack +* DEFINE_IDTENTRY_VC_USER - Emit code for VMM communication handler +when raised from user mode * @func: Function name of the entry point * * Maps to DEFINE_IDTENTRY_RAW_ERRORCODE */ -#define DEFINE_IDTENTRY_VC_IST (func) \ - DEFINE_IDTENTRY_RAW_ERRORCODE(ist_##func) - -/** -* DEFINE_IDTENTRY_VC - Emit code for VMM communication handler -* @func: Function name of the entry point -* -* Maps to DEFINE_IDTENTRY_RAW_ERRORCODE -*/ -#define DEFINE_IDTENTRY_VC (func) \ - DEFINE_IDTENTRY_RAW_ERRORCODE(func) +#define DEFINE_IDTENTRY_VC_USER (func) \ + DEFINE_IDTENTRY_RAW_ERRORCODE(user_##func)#else /* CONFIG_X86_64 */
arch/x86/kernel/sev-es.c +79 -69
203 lines not on this page · raw message
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 310/700 sched/rt: Fix RT utilization tracking during policy change
In reply to Greg Kroah-HartmanFrom: Vincent Donnefort <[email protected]>
[ Upstream commit fecfcbc288e9f4923f40fd23ca78a6acdc7fdf6c ]
RT keeps track of the utilization on a per-rq basis with the structure avg_rt. This utilization is updated during task_tick_rt(), put_prev_task_rt() and set_next_task_rt(). However, when the current running task changes its policy, set_next_task_rt() which would usually take care of updating the utilization when the rq starts running RT tasks, will not see a such change, leaving the avg_rt structure outdated. When that very same task will be dequeued later, put_prev_task_rt() will then update the utilization, based on a wrong last_update_time, leading to a huge spike in the RT utilization signal.
The signal would eventually recover from this issue after few ms. Even if no RT tasks are run, avg_rt is also updated in __update_blocked_others(). But as the CPU capacity depends partly on the avg_rt, this issue has nonetheless a significant impact on the scheduler.
Fix this issue by ensuring a load update when a running task changes its policy to RT.
--- kernel/sched/rt.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
kernel/sched/rt.c +12 -5
@@ -2331,13 +2331,20 @@ void __init init_sched_rt_class(void)static void switched_to_rt (struct rq *rq,struct task_struct *p) {/* -* If we are already running, then there's nothing -* that needs to be done. But if we are not running -* we may need to preempt the current running task. -* If that current running task is also an RT task +* If we are running, update the avg_rt tracking, as the running time +* will now on be accounted into the latter. +*/ +if (task_current (rq, p)) { +update_rt_rq_load_avg (rq_clock_pelt (rq), rq,0 ); +return ; + } + +/* +* If we are not running we may need to preempt the current +* running task. If that current running task is also an RT task * then see if we can move to another run queue. */ -if (task_on_rq_queued (p) && rq->curr != p) { +if (task_on_rq_queued (p)) {#ifdef CONFIG_SMP if (p->nr_cpus_allowed >1 && rq->rt.overloaded)rt_queue_push_tasks (rq);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 311/700 sched/rt: Fix Deadline utilization tracking during policy change
In reply to Greg Kroah-HartmanFrom: Vincent Donnefort <[email protected]>
[ Upstream commit d7d607096ae6d378b4e92d49946d22739c047d4c ]
DL keeps track of the utilization on a per-rq basis with the structure avg_dl. This utilization is updated during task_tick_dl(), put_prev_task_dl() and set_next_task_dl(). However, when the current running task changes its policy, set_next_task_dl() which would usually take care of updating the utilization when the rq starts running DL tasks, will not see a such change, leaving the avg_dl structure outdated. When that very same task will be dequeued later, put_prev_task_dl() will then update the utilization, based on a wrong last_update_time, leading to a huge spike in the DL utilization signal.
The signal would eventually recover from this issue after few ms. Even if no DL tasks are run, avg_dl is also updated in __update_blocked_others(). But as the CPU capacity depends partly on the avg_dl, this issue has nonetheless a significant impact on the scheduler.
Fix this issue by ensuring a load update when a running task changes its policy to DL.
--- kernel/sched/deadline.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/sched/deadline.c +2 -0
@@ -2486,6 +2486,8 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)check_preempt_curr_dl (rq, p,0 ); elseresched_curr (rq ); + }else { +update_dl_rq_load_avg (rq_clock_pelt (rq), rq,0 ); } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 312/700 sched/uclamp: Fix uclamp_tg_restrict()
In reply to Greg Kroah-HartmanFrom: Qais Yousef <[email protected]>
[ Upstream commit 0213b7083e81f4acd69db32cb72eb4e5f220329a ]
Now cpu.uclamp.min acts as a protection, we need to make sure that the uclamp request of the task is within the allowed range of the cgroup, that is it is clamp()'ed correctly by tg->uclamp[UCLAMP_MIN] and tg->uclamp[UCLAMP_MAX].
As reported by Xuewen [1] we can have some corner cases where there's inversion between uclamp requested by task (p) and the uclamp values of the taskgroup it's attached to (tg). Following table demonstrates 2 corner cases:
| p | tg | effective -----------+-----+------+----------- CASE 1 -----------+-----+------+----------- uclamp_min | 60% | 0% | 60% -----------+-----+------+----------- uclamp_max | 80% | 50% | 50% -----------+-----+------+----------- CASE 2 -----------+-----+------+----------- uclamp_min | 0% | 30% | 30% -----------+-----+------+----------- uclamp_max | 20% | 50% | 20% -----------+-----+------+-----------
With this fix we get:
| p | tg | effective -----------+-----+------+----------- CASE 1 -----------+-----+------+----------- uclamp_min | 60% | 0% | 50% -----------+-----+------+----------- uclamp_max | 80% | 50% | 50% -----------+-----+------+----------- CASE 2 -----------+-----+------+----------- uclamp_min | 0% | 30% | 30% -----------+-----+------+----------- uclamp_max | 20% | 50% | 30% -----------+-----+------+-----------
Additionally uclamp_update_active_tasks() must now unconditionally update both UCLAMP_MIN/MAX because changing the tg's UCLAMP_MAX for instance could have an impact on the effective UCLAMP_MIN of the tasks.
| p | tg | effective -----------+-----+------+----------- old -----------+-----+------+----------- uclamp_min | 60% | 0% | 50% -----------+-----+------+----------- uclamp_max | 80% | 50% | 50% -----------+-----+------+----------- *new* -----------+-----+------+----------- uclamp_min | 60% | 0% | *60%* -----------+-----+------+----------- uclamp_max | 80% |*70%* | *70%* -----------+-----+------+-----------
[1] https://lore.kernel.org/lkml/CAB8ipk_a6VFNjiEnHRHkUMBKbA+qzPQvhtNjJ_YNzQhqV_o8Zw@mail.gmail.com/
--- kernel/sched/core.c | 49 +++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 31 deletions(-)
kernel/sched/core.c +18 -31
@@ -1055,8 +1055,10 @@ static void uclamp_sync_util_min_rt_default(void)static inline struct uclamp_se uclamp_tg_restrict (struct task_struct *p,enum uclamp_id clamp_id) { +/* Copy by value as we could modify it */ struct uclamp_se uc_req = p->uclamp_req[clamp_id];#ifdef CONFIG_UCLAMP_TASK_GROUP +unsigned int tg_min, tg_max, value;/* * Tasks in autogroups or root task group will be
@@ -1067,23 +1069,11 @@ uclamp_tg_restrict(struct task_struct *p, enum uclamp_id clamp_id)if (task_group (p) == &root_task_group)return uc_req; -switch (clamp_id) { -case UCLAMP_MIN : { -struct uclamp_se uc_min =task_group (p)->uclamp[clamp_id]; -if (uc_req.value < uc_min.value) -return uc_min; -break ; - } -case UCLAMP_MAX : { -struct uclamp_se uc_max =task_group (p)->uclamp[clamp_id]; -if (uc_req.value > uc_max.value) -return uc_max; -break ; - } -default : -WARN_ON_ONCE (1 ); -break ; - } + tg_min =task_group (p)->uclamp[UCLAMP_MIN ].value; + tg_max =task_group (p)->uclamp[UCLAMP_MAX ].value; + value = uc_req.value; + value =clamp (value, tg_min, tg_max); +uclamp_se_set (&uc_req, value, false);#endif return uc_req;
@@ -1282,8 +1272,9 @@ static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p) }static inline void -uclamp_update_active (struct task_struct *p,enum uclamp_id clamp_id) +uclamp_update_active (struct task_struct *p) { +enum uclamp_id clamp_id;struct rq_flags rf;struct rq *rq;
@@ -1303,9 +1294,11 @@ uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id)* affecting a valid clamp bucket, the next time it's enqueued, * it will already see the updated clamp bucket value. */ -if (p->uclamp[clamp_id].active) { -uclamp_rq_dec_id (rq, p, clamp_id); -uclamp_rq_inc_id (rq, p, clamp_id); +for_each_clamp_id (clamp_id) { +if (p->uclamp[clamp_id].active) { +uclamp_rq_dec_id (rq, p, clamp_id); +uclamp_rq_inc_id (rq, p, clamp_id); + } }task_rq_unlock (rq, p, &rf);
@@ -1313,20 +1306,14 @@ uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id)#ifdef CONFIG_UCLAMP_TASK_GROUP static inline void -uclamp_update_active_tasks (struct cgroup_subsys_state *css, -unsigned int clamps) +uclamp_update_active_tasks (struct cgroup_subsys_state *css) { -enum uclamp_id clamp_id;struct css_task_iter it;struct task_struct *p;css_task_iter_start (css,0 , &it); -while ((p =css_task_iter_next (&it))) { -for_each_clamp_id (clamp_id) { -if ((0x1 << clamp_id) & clamps) -uclamp_update_active (p, clamp_id); - } - } +while ((p =css_task_iter_next (&it))) +uclamp_update_active (p);css_task_iter_end (&it); }
@@ -8826,7 +8813,7 @@ static void cpu_util_update_eff(struct cgroup_subsys_state *css) }/* Immediately update descendants RUNNABLE tasks */ -uclamp_update_active_tasks (css, clamps); +uclamp_update_active_tasks (css); } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 313/700 lockdep: Fix wait-type for empty stack
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit f8b298cc39f0619544c607eaef09fd0b2afd10f3 ]
Even the very first lock can violate the wait-context check, consider the various IRQ contexts.
--- kernel/locking/lockdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/locking/lockdep.c +1 -1
@@ -4692,7 +4692,7 @@ static int check_wait_context(struct task_struct *curr, struct held_lock *next)u8 curr_inner;int depth; -if (!curr->lockdep_depth || !next_inner || next->trylock) +if (!next_inner || next->trylock)return 0 ;if (!next_outer)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 314/700 lockdep/selftests: Fix selftests vs PROVE_RAW_LOCK_NESTING
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit c0c2c0dad6a06e0c05e9a52d65f932bd54364c97 ]
When PROVE_RAW_LOCK_NESTING=y many of the selftests FAILED because HARDIRQ context is out-of-bounds for spinlocks. Instead make the default hardware context the threaded hardirq context, which preserves the old locking rules.
The wait-type specific locking selftests will have a non-threaded HARDIRQ variant.
--- lib/locking-selftest.c | 1 + 1 file changed, 1 insertion(+)
lib/locking-selftest.c +1 -0
@@ -194,6 +194,7 @@ static void init_shared_classes(void)#define HARDIRQ_ENTER () \ local_irq_disable(); \ __irq_enter(); \ + lockdep_hardirq_threaded(); \ WARN_ON(!in_irq());#define HARDIRQ_EXIT () \
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 315/700 spi: spi-sun6i: Fix chipselect/clock bug
In reply to Greg Kroah-HartmanFrom: Mirko Vogt <mirko-dev|[email protected]>
[ Upstream commit 0d7993b234c9fad8cb6bec6adfaa74694ba85ecb ]
The current sun6i SPI implementation initializes the transfer too early, resulting in SCK going high before the transfer. When using an additional (gpio) chipselect with sun6i, the chipselect is asserted at a time when clock is high, making the SPI transfer fail.
This is due to SUN6I_GBL_CTL_BUS_ENABLE being written into SUN6I_GBL_CTL_REG at an early stage. Moving that to the transfer function, hence, right before the transfer starts, mitigates that problem.
--- drivers/spi/spi-sun6i.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi-sun6i.c +5 -1
@@ -379,6 +379,10 @@ static int sun6i_spi_transfer_one(struct spi_master *master, }sun6i_spi_write (sspi,SUN6I_CLK_CTL_REG , reg); +/* Finally enable the bus - doing so before might raise SCK to HIGH */ + reg =sun6i_spi_read (sspi,SUN6I_GBL_CTL_REG ); + reg |=SUN6I_GBL_CTL_BUS_ENABLE ; +sun6i_spi_write (sspi,SUN6I_GBL_CTL_REG , reg);/* Setup the transfer now... */ if (sspi->tx_buf)
@@ -504,7 +508,7 @@ static int sun6i_spi_runtime_resume(struct device *dev) }sun6i_spi_write (sspi,SUN6I_GBL_CTL_REG , -SUN6I_GBL_CTL_BUS_ENABLE |SUN6I_GBL_CTL_MASTER |SUN6I_GBL_CTL_TP ); +SUN6I_GBL_CTL_MASTER |SUN6I_GBL_CTL_TP );return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 316/700 crypto: nx - Fix RCU warning in nx842_OF_upd_status
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit 2a96726bd0ccde4f12b9b9a9f61f7b1ac5af7e10 ]
The function nx842_OF_upd_status triggers a sparse RCU warning when it directly dereferences the RCU-protected devdata. This appears to be an accident as there was another variable of the same name that was passed in from the caller.
After it was removed (because the main purpose of using it, to update the status member was itself removed) the global variable unintenionally stood in as its replacement.
This patch restores the devdata parameter.
--- drivers/crypto/nx/nx-842-pseries.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/crypto/nx/nx-842-pseries.c +5 -3
@@ -538,13 +538,15 @@ static int nx842_OF_set_defaults(struct nx842_devdata *devdata)* The status field indicates if the device is enabled when the status * is 'okay'. Otherwise the device driver will be disabled. * -* @prop - struct property point containing the maxsyncop for the update +* @devdata: struct nx842_devdata to use for dev_info +* @prop: struct property point containing the maxsyncop for the update * * Returns: * 0 - Device is available * -ENODEV - Device is not available */ -static int nx842_OF_upd_status (struct property *prop) +static int nx842_OF_upd_status (struct nx842_devdata *devdata, +struct property *prop) {const char *status = (const char *)prop->value;
@@ -758,7 +760,7 @@ static int nx842_OF_upd(struct property *new_prop) goto out;/* Perform property updates */ - ret =nx842_OF_upd_status (status); + ret =nx842_OF_upd_status (new_devdata, status);if (ret) goto error_out;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 317/700 psi: Fix race between psi_trigger_create/destroy
In reply to Greg Kroah-HartmanFrom: Zhaoyang Huang <[email protected]>
[ Upstream commit 8f91efd870ea5d8bc10b0fcc9740db51cd4c0c83 ]
Race detected between psi_trigger_destroy/create as shown below, which cause panic by accessing invalid psi_system->poll_wait->wait_queue_entry and psi_system->poll_timer->entry->next. Under this modification, the race window is removed by initialising poll_wait and poll_timer in group_init which are executed only once at beginning.
psi_trigger_destroy() psi_trigger_create()
mutex_lock(trigger_lock);
rcu_assign_pointer(poll_task, NULL);
mutex_unlock(trigger_lock);
mutex_lock(trigger_lock);
if (!rcu_access_pointer(group->poll_task)) {
timer_setup(poll_timer, poll_timer_fn, 0);
rcu_assign_pointer(poll_task, task);
}
mutex_unlock(trigger_lock); synchronize_rcu();
del_timer_sync(poll_timer); <-- poll_timer has been reinitialized by
psi_trigger_create()So, trigger_lock/RCU correctly protects destruction of group->poll_task but misses this race affecting poll_timer and poll_wait.
--- kernel/sched/psi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/sched/psi.c +6 -6
@@ -179,6 +179,8 @@ struct psi_group psi_system = {static void psi_avgs_work (struct work_struct *work); +static void poll_timer_fn (struct timer_list *t); +static void group_init (struct psi_group *group) {int cpu;
@@ -198,6 +200,8 @@ static void group_init(struct psi_group *group)memset (group->polling_total,0 ,sizeof (group->polling_total)); group->polling_next_update =ULLONG_MAX ; group->polling_until =0 ; +init_waitqueue_head (&group->poll_wait); +timer_setup (&group->poll_timer, poll_timer_fn,0 );rcu_assign_pointer (group->poll_task,NULL ); }
@@ -1142,9 +1146,7 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group,return ERR_CAST (task); }atomic_set (&group->poll_wakeup,0 ); -init_waitqueue_head (&group->poll_wait);wake_up_process (task); -timer_setup (&group->poll_timer, poll_timer_fn,0 );rcu_assign_pointer (group->poll_task, task); }
@@ -1196,6 +1198,7 @@ static void psi_trigger_destroy(struct kref *ref) group->poll_task, lockdep_is_held(&group->trigger_lock));rcu_assign_pointer (group->poll_task,NULL ); +del_timer (&group->poll_timer); } }
@@ -1208,17 +1211,14 @@ static void psi_trigger_destroy(struct kref *ref)*/ synchronize_rcu ();/* -* Destroy the kworker after releasing trigger_lock to prevent a +* Stop kthread 'psimon' after releasing trigger_lock to prevent a * deadlock while waiting for psi_poll_work to acquire trigger_lock */ if (task_to_destroy) {/* * After the RCU grace period has expired, the worker * can no longer be found through group->poll_task. -* But it might have been already scheduled before -* that - deschedule it cleanly before destroying it. */ -del_timer_sync (&group->poll_timer);kthread_stop (task_to_destroy); }kfree (t);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 318/700 KVM: selftests: fix triple fault if ept=0 in dirty_log_test
In reply to Greg Kroah-HartmanFrom: Hou Wenlong <[email protected]>
[ Upstream commit e5830fb13b8cad5e3bdf84f0f7a3dcb4f4d9bcbb ]
Commit 22f232d134e1 ("KVM: selftests: x86: Set supported CPUIDs on default VM") moved vcpu_set_cpuid into vm_create_with_vcpus, but dirty_log_test doesn't use it to create vm. So vcpu's CPUIDs is not set, the guest's pa_bits in kvm would be smaller than the value queried by userspace.
However, the dirty track memory slot is in the highest GPA, the reserved bits in gpte would be set with wrong pa_bits. For shadow paging, page fault would fail in permission_fault and be injected into guest. Since guest doesn't have idt, it finally leads to vm_exit for triple fault.
Move vcpu_set_cpuid into vm_vcpu_add_default to set supported CPUIDs on default vcpu, since almost all tests need it.
Message-Id: <411ea2173f89abce56fc1fca5af913ed9c5a89c9.1624351343.git.houwenlong93@linux.alibaba.com>
--- tools/testing/selftests/kvm/lib/kvm_util.c | 4 ---- tools/testing/selftests/kvm/lib/x86_64/processor.c | 3 +++ tools/testing/selftests/kvm/steal_time.c | 2 -- tools/testing/selftests/kvm/x86_64/set_boot_cpu_id.c | 2 -- 4 files changed, 3 insertions(+), 8 deletions(-)
tools/testing/selftests/kvm/lib/kvm_util.c +0 -4
@@ -310,10 +310,6 @@ struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus,uint32_t vcpuid = vcpuids ? vcpuids[i] : i;vm_vcpu_add_default (vm, vcpuid, guest_code); - -#ifdef __x86_64__ -vcpu_set_cpuid (vm, vcpuid,kvm_get_supported_cpuid ()); -#endif }return vm;
tools/testing/selftests/kvm/lib/x86_64/processor.c +3 -0
@@ -600,6 +600,9 @@ void vm_vcpu_add_default(struct kvm_vm *vm, uint32_t vcpuid, void *guest_code)/* Setup the MP state */ mp_state.mp_state =0 ;vcpu_set_mp_state (vm, vcpuid, &mp_state); + +/* Setup supported CPUIDs */ +vcpu_set_cpuid (vm, vcpuid,kvm_get_supported_cpuid ()); }/*
tools/testing/selftests/kvm/steal_time.c +0 -2
@@ -73,8 +73,6 @@ static void steal_time_init(struct kvm_vm *vm)for (i =0 ; i <NR_VCPUS ; ++i) {int ret; -vcpu_set_cpuid (vm, i,kvm_get_supported_cpuid ()); -/* ST_GPA_BASE is identity mapped */ st_gva[i] = (void *)(ST_GPA_BASE + i *STEAL_TIME_SIZE );sync_global_to_guest (vm, st_gva[i]);
tools/testing/selftests/kvm/x86_64/set_boot_cpu_id.c +0 -2
@@ -106,8 +106,6 @@ static void add_x86_vcpu(struct kvm_vm *vm, uint32_t vcpuid, bool bsp_code)vm_vcpu_add_default (vm, vcpuid, guest_bsp_vcpu); elsevm_vcpu_add_default (vm ,vcpuid ,guest_not_bsp_vcpu ); - -vcpu_set_cpuid (vm, vcpuid,kvm_get_supported_cpuid ()); }static void run_vm_bsp (uint32_t bsp_vcpu)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 319/700 KVM: selftests: Remove errant asm/barrier.h include to fix arm64 build
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit ecc3a92c6f4953c134a9590c762755e6593f507c ]
Drop an unnecessary include of asm/barrier.h from dirty_log_test.c to allow the test to build on arm64. arm64, s390, and x86 all build cleanly without the include (PPC and MIPS aren't supported in KVM's selftests).
arm64's barrier.h includes linux/kasan-checks.h, which is not copied into tools/.
In file included from ../../../../tools/include/asm/barrier.h:8,
from dirty_log_test.c:19:
.../arm64/include/asm/barrier.h:12:10: fatal error: linux/kasan-checks.h: No such file or directory 12 | #include <linux/kasan-checks.h>
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Message-Id: <[email protected]>
--- tools/testing/selftests/kvm/dirty_log_test.c | 1 - 1 file changed, 1 deletion(-)
tools/testing/selftests/kvm/dirty_log_test.c +0 -1
@@ -16,7 +16,6 @@#include <errno.h> #include <linux/bitmap.h> #include <linux/bitops.h> -#include <asm/barrier.h> #include <linux/atomic.h> #include "kvm_util.h"
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 320/700 media: video-mux: Skip dangling endpoints
In reply to Greg Kroah-HartmanFrom: Philipp Zabel <[email protected]>
[ Upstream commit 95778c2d0979618e3349b1d2324ec282a5a6adbf ]
i.MX6 device tree include files contain dangling endpoints for the board device tree writers' convenience. These are still included in many existing device trees.
Treat dangling endpoints as non-existent to support them.
--- drivers/media/platform/video-mux.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/media/platform/video-mux.c +9 -1
@@ -362,7 +362,7 @@ static int video_mux_async_register(struct video_mux *vmux,for (i =0 ; i < num_input_pads; i++) {struct v4l2_async_subdev *asd; -struct fwnode_handle *ep; +struct fwnode_handle *ep, *remote_ep; ep = fwnode_graph_get_endpoint_by_id( dev_fwnode(vmux->subdev.dev), i, 0,
@@ -370,6 +370,14 @@ static int video_mux_async_register(struct video_mux *vmux,if (!ep)continue ; +/* Skip dangling endpoints for backwards compatibility */ + remote_ep =fwnode_graph_get_remote_endpoint (ep); +if (!remote_ep) { +fwnode_handle_put (ep); +continue ; + } +fwnode_handle_put (remote_ep); + asd =v4l2_async_notifier_add_fwnode_remote_subdev ( &vmux->notifier, ep, struct v4l2_async_subdev);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 321/700 media: mtk-vpu: on suspend, read/write regs only if vpu is running
In reply to Greg Kroah-HartmanFrom: Dafna Hirschfeld <[email protected]>
[ Upstream commit 11420749c6b4b237361750de3d5b5579175f8622 ]
If the vpu is not running, we should not rely on VPU_IDLE_REG value. In this case, the suspend cb should only unprepare the clock. This fixes a system-wide suspend to ram failure:
[ 273.073363] PM: suspend entry (deep) [ 273.410502] mtk-msdc 11230000.mmc: phase: [map:ffffffff] [maxlen:32] [final:10] [ 273.455926] Filesystems sync: 0.378 seconds [ 273.589707] Freezing user space processes ... (elapsed 0.003 seconds) done. [ 273.600104] OOM killer disabled. [ 273.603409] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 273.613361] mwifiex_sdio mmc2:0001:1: None of the WOWLAN triggers enabled [ 274.784952] mtk_vpu 10020000.vpu: vpu idle timeout [ 274.789764] PM: dpm_run_callback(): platform_pm_suspend+0x0/0x70 returns -5 [ 274.796740] mtk_vpu 10020000.vpu: PM: failed to suspend: error -5 [ 274.802842] PM: Some devices failed to suspend, or early wake event detected [ 275.426489] OOM killer enabled. [ 275.429718] Restarting tasks ... [ 275.435765] done. [ 275.447510] PM: suspend exit
--- drivers/media/platform/mtk-vpu/mtk_vpu.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/platform/mtk-vpu/mtk_vpu.c +6 -0
@@ -987,6 +987,12 @@ static int mtk_vpu_suspend(struct device *dev)return ret; } +if (!vpu_running (vpu)) { +vpu_clock_disable (vpu); +clk_unprepare (vpu->clk); +return 0 ; + } +mutex_lock (&vpu->vpu_mutex);/* disable vpu timer interrupt */ vpu_cfg_writel(vpu, vpu_cfg_readl(vpu, VPU_INT_STATUS) | VPU_IDLE_STATE,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 322/700 EDAC/aspeed: Use proper format string for printing resource
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 2e2f16d5cdb33e5f6fc53b7ad66c9f456d5f2950 ]
On ARMv7, resource_size_t can be 64-bit, which breaks printing it as %x:
drivers/edac/aspeed_edac.c: In function 'init_csrows':
drivers/edac/aspeed_edac.c:257:28: error: format '%x' expects argument of \
type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long \
long unsigned int'} [-Werror=format=]
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page \
r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",Use the special %pR format string to pretty-print the entire resource instead.
--- drivers/edac/aspeed_edac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/aspeed_edac.c +2 -2
@@ -254,8 +254,8 @@ static int init_csrows(struct mem_ctl_info *mci)return rc; } -dev_dbg (mci->pdev,"dt: /memory node resources: first page r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n" , - r.start,resource_size (&r),PAGE_SHIFT ); +dev_dbg (mci->pdev,"dt: /memory node resources: first page %pR, PAGE_SHIFT macro=0x%x\n" , + &r,PAGE_SHIFT ); csrow->first_page = r.start >>PAGE_SHIFT ; nr_pages =resource_size (&r) >>PAGE_SHIFT ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 323/700 PM / devfreq: Add missing error code in devfreq_add_device()
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 18b380ed61f892ed06838d1f1a5124d966292ed3 ]
Set err code in the error path before jumping to the end of the function.
--- drivers/devfreq/devfreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/devfreq/devfreq.c +1 -0
@@ -822,6 +822,7 @@ struct devfreq *devfreq_add_device(struct device *dev,if (devfreq->profile->timer <0 || devfreq->profile->timer >=DEVFREQ_TIMER_NUM ) {mutex_unlock (&devfreq->lock); + err = -EINVAL ; goto err_dev; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 324/700 ACPI: PM / fan: Put fan device IDs into separate header file
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit b9370dceabb7841c5e65ce4ee4405b9db5231fc4 ]
The ACPI fan device IDs are shared between the fan driver and the device power management code. The former is modular, so it needs to include the table of device IDs for module autoloading and the latter needs that list to avoid attaching the generic ACPI PM domain to fan devices (which doesn't make sense) possibly before the fan driver module is loaded.
Unfortunately, that requires the list of fan device IDs to be updated in two places which is prone to mistakes, so put it into a symbol definition in a separate header file so there is only one copy of it in case it needs to be updated again in the future.
--- drivers/acpi/device_pm.c | 6 ++---- drivers/acpi/fan.c | 7 +++---- drivers/acpi/fan.h | 13 +++++++++++++ 3 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 drivers/acpi/fan.h
drivers/acpi/device_pm.c +2 -4
@@ -20,6 +20,7 @@#include <linux/pm_runtime.h> #include <linux/suspend.h> +#include "fan.h" #include "internal.h" /**
@@ -1307,10 +1308,7 @@ int acpi_dev_pm_attach(struct device *dev, bool power_on)* with the generic ACPI PM domain. */ static const struct acpi_device_id special_pm_ids[] = { - {"PNP0C0B" , },/* Generic ACPI fan */ - {"INT3404" , },/* Fan */ - {"INTC1044" , },/* Fan for Tiger Lake generation */ - {"INTC1048" , },/* Fan for Alder Lake generation */ +ACPI_FAN_DEVICE_IDS , {} };struct acpi_device *adev =ACPI_COMPANION (dev);
drivers/acpi/fan.c +3 -4
@@ -16,6 +16,8 @@#include <linux/platform_device.h> #include <linux/sort.h> +#include "fan.h" +MODULE_AUTHOR ("Paul Diefenbaugh" );MODULE_DESCRIPTION ("ACPI Fan Driver" );MODULE_LICENSE ("GPL" );
@@ -24,10 +26,7 @@ static int acpi_fan_probe(struct platform_device *pdev);static int acpi_fan_remove (struct platform_device *pdev);static const struct acpi_device_id fan_device_ids[] = { - {"PNP0C0B" ,0 }, - {"INT3404" ,0 }, - {"INTC1044" ,0 }, - {"INTC1048" ,0 }, +ACPI_FAN_DEVICE_IDS , {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, fan_device_ids);
drivers/acpi/fan.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* +* ACPI fan device IDs are shared between the fan driver and the device power +* management code. +* +* Add new device IDs before the generic ACPI fan one. +*/ +#define ACPI_FAN_DEVICE_IDS \ + {"INT3404", },/* Fan */ \ + {"INTC1044", }, /* Fan for Tiger Lake generation */ \ + {"INTC1048", }, /* Fan for Alder Lake generation */ \ + {"PNP0C0B", } /* Generic ACPI fan */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 325/700 block: avoid double io accounting for flush request
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit 84da7acc3ba53af26f15c4b0ada446127b7a7836 ]
For flush request, rq->end_io() may be called two times, one is from timeout handling(blk_mq_check_expired()), another is from normal completion(__blk_mq_end_request()).
Move blk_account_io_flush() after flush_rq->ref drops to zero, so io accounting can be done just once for flush request.
--- block/blk-flush.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
block/blk-flush.c +1 -2
@@ -219,8 +219,6 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)unsigned long flags =0 ;struct blk_flush_queue *fq =blk_get_flush_queue (q, flush_rq->mq_ctx); -blk_account_io_flush (flush_rq); -/* release the tag's ownership to the req cloned from */ spin_lock_irqsave (&fq->mq_flush_lock, flags);
@@ -230,6 +228,7 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)return ; } +blk_account_io_flush (flush_rq);/* * Flush request has to be marked as IDLE when it is really ended * because its .end_io() is called from timeout code path too for
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 326/700 x86/hyperv: fix logical processor creation
In reply to Greg Kroah-HartmanFrom: Praveen Kumar <[email protected]>
[ Upstream commit 450605c28d571eddca39a65fdbc1338add44c6d9 ]
Microsoft Hypervisor expects the logical processor index to be the same as CPU's index during logical processor creation. Using cpu_physical_id confuses hypervisor's scheduler. That causes the root partition not boot when core scheduler is used.
This patch removes the call to cpu_physical_id and uses the CPU index directly for bringing up logical processor. This scheme works for both classic scheduler and core scheduler.
--- arch/x86/kernel/cpu/mshyperv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mshyperv.c +1 -1
@@ -245,7 +245,7 @@ static void __init hv_smp_prepare_cpus(unsigned int max_cpus)for_each_present_cpu (i) {if (i ==0 )continue ; - ret =hv_call_add_logical_proc (numa_cpu_node (i), i,cpu_physical_id (i)); + ret =hv_call_add_logical_proc (numa_cpu_node (i), i, i);BUG_ON (ret); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 327/700 nvme-pci: look for StorageD3Enable on companion ACPI device instead
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
[ Upstream commit e21e0243e7b0f1c2a21d21f4d115f7b37175772a ]
The documentation around the StorageD3Enable property hints that it should be made on the PCI device. This is where newer AMD systems set the property and it's required for S0i3 support.
So rather than look for nodes of the root port only present on Intel systems, switch to the companion ACPI device for all systems. David Box from Intel indicated this should work on Intel as well.
--- drivers/nvme/host/pci.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-)
drivers/nvme/host/pci.c +1 -23
@@ -2834,10 +2834,7 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)#ifdef CONFIG_ACPI static bool nvme_acpi_storage_d3 (struct pci_dev *dev) { -struct acpi_device *adev; -struct pci_dev *root; -acpi_handle handle; -acpi_status status; +struct acpi_device *adev =ACPI_COMPANION (&dev->dev);u8 val;/*
@@ -2845,28 +2842,9 @@ static bool nvme_acpi_storage_d3(struct pci_dev *dev)* must use D3 to support deep platform power savings during * suspend-to-idle. */ - root =pcie_find_root_port (dev); -if (!root) -return false; - adev =ACPI_COMPANION (&root->dev);if (!adev)return false; - -/* -* The property is defined in the PXSX device for South complex ports -* and in the PEGP device for North complex ports. -*/ - status =acpi_get_handle (adev->handle,"PXSX" , &handle); -if (ACPI_FAILURE (status)) { - status =acpi_get_handle (adev->handle,"PEGP" , &handle); -if (ACPI_FAILURE (status)) -return false; - } - -if (acpi_bus_get_device (handle, &adev)) -return false; -if (fwnode_property_read_u8 (acpi_fwnode_handle (adev),"StorageD3Enable" , &val))return false;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 328/700 ACPI: tables: FPDT: Add missing acpi_put_table() in acpi_init_fpdt()
In reply to Greg Kroah-HartmanFrom: Jing Xiangfeng <[email protected]>
[ Upstream commit dd9eaa23e72572d4f1c03f2e5d2e14a5b5793e79 ]
acpi_init_fpdt() forgets to call acpi_put_table() in an error path.
Add the missing function call to fix it.
--- drivers/acpi/acpi_fpdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/acpi_fpdt.c +3 -1
@@ -240,8 +240,10 @@ static int __init acpi_init_fpdt(void)return 0 ; fpdt_kobj =kobject_create_and_add ("fpdt" , acpi_kobj); -if (!fpdt_kobj) +if (!fpdt_kobj) { +acpi_put_table (header);return -ENOMEM ; + }while (offset < header->length) { subtable = (void *)header + offset;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 329/700 ACPI: sysfs: Fix a buffer overrun problem with description_show()
In reply to Greg Kroah-HartmanFrom: Krzysztof Wilczyński <[email protected]>
[ Upstream commit 888be6067b97132c3992866bbcf647572253ab3f ]
Currently, a device description can be obtained using ACPI, if the _STR method exists for a particular device, and then exposed to the userspace via a sysfs object as a string value.
If the _STR method is available for a given device then the data (usually a Unicode string) is read and stored in a buffer (of the ACPI_TYPE_BUFFER type) with a pointer to said buffer cached in the struct acpi_device_pnp for later access.
The description_show() function is responsible for exposing the device description to the userspace via a corresponding sysfs object and internally calls the utf16s_to_utf8s() function with a pointer to the buffer that contains the Unicode string so that it can be converted from UTF16 encoding to UTF8 and thus allowing for the value to be safely stored and later displayed.
When invoking the utf16s_to_utf8s() function, the description_show() function also sets a limit of the data that can be saved into a provided buffer as a result of the character conversion to be a total of PAGE_SIZE, and upon completion, the utf16s_to_utf8s() function returns an integer value denoting the number of bytes that have been written into the provided buffer.
Following the execution of the utf16s_to_utf8s() a newline character will be added at the end of the resulting buffer so that when the value is read in the userspace through the sysfs object then it would include newline making it more accessible when working with the sysfs file system in the shell, etc. Normally, this wouldn't be a problem, but if the function utf16s_to_utf8s() happens to return the number of bytes written to be precisely PAGE_SIZE, then we would overrun the buffer and write the newline character outside the allotted space which can have undefined consequences or result in a failure.
To fix this buffer overrun, ensure that there always is enough space left for the newline character to be safely appended.
--- drivers/acpi/device_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/device_sysfs.c +1 -1
@@ -446,7 +446,7 @@ static ssize_t description_show(struct device *dev, (wchar_t *)acpi_dev->pnp.str_obj->buffer.pointer, acpi_dev->pnp.str_obj->buffer.length,UTF16_LITTLE_ENDIAN , buf, - PAGE_SIZE); + PAGE_SIZE - 1); buf[result++] ='\n' ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 330/700 mark pstore-blk as broken
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit d07f3b081ee632268786601f55e1334d1f68b997 ]
pstore-blk just pokes directly into the pagecache for the block device without going through the file operations for that by faking up it's own file operations that do not match the block device ones.
As this breaks the control of the block layer of it's page cache, and even now just works by accident only the best thing is to just disable this driver.
--- fs/pstore/Kconfig | 1 + 1 file changed, 1 insertion(+)
fs/pstore/Kconfig +1 -0
@@ -173,6 +173,7 @@ config PSTORE_BLK tristate "Log panic/oops to a block device" depends on PSTORE depends on BLOCK + depends on BROKEN select PSTORE_ZONE default n help
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 331/700 md: revert io stats accounting
In reply to Greg Kroah-HartmanFrom: Guoqing Jiang <[email protected]>
[ Upstream commit ad3fc798800fb7ca04c1dfc439dba946818048d8 ]
The commit 41d2d848e5c0 ("md: improve io stats accounting") could cause double fault problem per the report [1], and also it is not correct to change ->bi_end_io if md don't own it, so let's revert it.
And io stats accounting will be replemented in later commits.
[1]. https://lore.kernel.org/linux-raid/[email protected]/T/#t
--- drivers/md/md.c | 45 --------------------------------------------- drivers/md/md.h | 1 - 2 files changed, 46 deletions(-)
drivers/md/md.c +0 -45
@@ -441,30 +441,6 @@ check_suspended: }EXPORT_SYMBOL (md_handle_request); -struct md_io { -struct mddev *mddev; -bio_end_io_t *orig_bi_end_io; -void *orig_bi_private; -struct block_device *orig_bi_bdev; -unsigned long start_time; -}; - -static void md_end_io (struct bio *bio) -{ -struct md_io *md_io = bio->bi_private; -struct mddev *mddev = md_io->mddev; - -bio_end_io_acct_remapped (bio, md_io->start_time, md_io->orig_bi_bdev); - - bio->bi_end_io = md_io->orig_bi_end_io; - bio->bi_private = md_io->orig_bi_private; - -mempool_free (md_io, &mddev->md_io_pool); - -if (bio->bi_end_io) - bio->bi_end_io (bio); -} -static blk_qc_t md_submit_bio (struct bio *bio) {const int rw =bio_data_dir (bio);
@@ -489,21 +465,6 @@ static blk_qc_t md_submit_bio(struct bio *bio)return BLK_QC_T_NONE ; } -if (bio->bi_end_io != md_end_io) { -struct md_io *md_io; - - md_io =mempool_alloc (&mddev->md_io_pool,GFP_NOIO ); - md_io->mddev = mddev; - md_io->orig_bi_end_io = bio->bi_end_io; - md_io->orig_bi_private = bio->bi_private; - md_io->orig_bi_bdev = bio->bi_bdev; - - bio->bi_end_io = md_end_io; - bio->bi_private = md_io; - - md_io->start_time =bio_start_io_acct (bio); - } -/* bio could be mergeable after passing to underlayer */ bio->bi_opf &= ~REQ_NOMERGE ;
@@ -5614,7 +5575,6 @@ static void md_free(struct kobject *ko)bioset_exit (&mddev->bio_set);bioset_exit (&mddev->sync_set); -mempool_exit (&mddev->md_io_pool);kfree (mddev); }
@@ -5710,11 +5670,6 @@ static int md_alloc(dev_t dev, char *name)*/ mddev->hold_active =UNTIL_STOP ; - error =mempool_init_kmalloc_pool (&mddev->md_io_pool,BIO_POOL_SIZE , -sizeof (struct md_io )); -if (error) - goto abort; - error = -ENOMEM ; mddev->queue =blk_alloc_queue (NUMA_NO_NODE );if (!mddev->queue)
drivers/md/md.h +0 -1
@@ -487,7 +487,6 @@ struct mddev {struct bio_set sync_set;/* for sync operations like * metadata and bitmap writes */ -mempool_t md_io_pool;/* Generic flush handling. * The last to finish preflush schedules a worker to submit
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 332/700 clocksource/drivers/timer-ti-dm: Save and restore timer TIOCP_CFG
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 9517c577f9f722270584cfb1a7b4e1354e408658 ]
As we are using cpu_pm to save and restore context, we must also save and restore the timer sysconfig register TIOCP_CFG. This is needed because we are not calling PM runtime functions at all with cpu_pm.
--- drivers/clocksource/timer-ti-dm.c | 6 ++++++ include/clocksource/timer-ti-dm.h | 1 + 2 files changed, 7 insertions(+)
drivers/clocksource/timer-ti-dm.c +6 -0
@@ -78,6 +78,9 @@ static void omap_dm_timer_write_reg(struct omap_dm_timer *timer, u32 reg,static void omap_timer_restore_context (struct omap_dm_timer *timer) { +__omap_dm_timer_write (timer,OMAP_TIMER_OCP_CFG_OFFSET , + timer->context.ocp_cfg,0 ); +omap_dm_timer_write_reg (timer,OMAP_TIMER_WAKEUP_EN_REG , timer->context.twer); omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG,
@@ -95,6 +98,9 @@ static void omap_timer_restore_context(struct omap_dm_timer *timer)static void omap_timer_save_context (struct omap_dm_timer *timer) { + timer->context.ocp_cfg = +__omap_dm_timer_read (timer,OMAP_TIMER_OCP_CFG_OFFSET ,0 ); + timer->context.tclr =omap_dm_timer_read_reg (timer,OMAP_TIMER_CTRL_REG ); timer->context.twer =
include/clocksource/timer-ti-dm.h +1 -0
@@ -74,6 +74,7 @@#define OMAP_TIMER_ERRATA_I103_I767 0x80000000struct timer_regs { +u32 ocp_cfg;u32 tidr;u32 tier;u32 twer;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 333/700 extcon: extcon-max8997: Fix IRQ freeing at error path
In reply to Greg Kroah-HartmanFrom: Matti Vaittinen <[email protected]>
[ Upstream commit 610bdc04830a864115e6928fc944f1171dfff6f3 ]
If reading MAX8997_MUIC_REG_STATUS1 fails at probe the driver exits without freeing the requested IRQs.
Free the IRQs prior returning if reading the status fails.
--- drivers/extcon/extcon-max8997.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/extcon/extcon-max8997.c +1 -1
@@ -729,7 +729,7 @@ static int max8997_muic_probe(struct platform_device *pdev) 2, info->status);if (ret) {dev_err (info->dev,"failed to read MUIC register\n" ); -return ret; + goto err_irq; } cable_type =max8997_muic_get_cable_type (info,MAX8997_CABLE_GROUP_ADC , &attached);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 334/700 ACPI: APEI: fix synchronous external aborts in user-mode
In reply to Greg Kroah-HartmanFrom: Xiaofei Tan <[email protected]>
[ Upstream commit ccb5ecdc2ddeaff744ee075b54cdff8a689e8fa7 ]
Before commit 8fcc4ae6faf8 ("arm64: acpi: Make apei_claim_sea() synchronise with APEI's irq work"), do_sea() would unconditionally signal the affected task from the arch code. Since that change, the GHES driver sends the signals.
This exposes a problem as errors the GHES driver doesn't understand or doesn't handle effectively are silently ignored. It will cause the errors get taken again, and circulate endlessly. User-space task get stuck in this loop.
Existing firmware on Kunpeng9xx systems reports cache errors with the 'ARM Processor Error' CPER records.
Do memory failure handling for ARM Processor Error Section just like for Memory Error Section.
--- drivers/acpi/apei/ghes.c | 81 +++++++++++++++++++++++++++++++--------- 1 file changed, 64 insertions(+), 17 deletions(-)
drivers/acpi/apei/ghes.c +64 -17
@@ -441,28 +441,35 @@ static void ghes_kick_task_work(struct callback_head *head)gen_pool_free (ghes_estatus_pool, (unsigned long )estatus_node, node_len); } -static bool ghes_handle_memory_failure (struct acpi_hest_generic_data *gdata, -int sev) +static bool ghes_do_memory_failure (u64 physical_addr,int flags) {unsigned long pfn; -int flags =-1 ; -int sec_sev =ghes_severity (gdata->error_severity); -struct cper_sec_mem_err *mem_err =acpi_hest_get_payload (gdata);if (!IS_ENABLED (CONFIG_ACPI_APEI_MEMORY_FAILURE ))return false; -if (!(mem_err->validation_bits &CPER_MEM_VALID_PA )) -return false; - - pfn = mem_err->physical_addr >>PAGE_SHIFT ; + pfn =PHYS_PFN (physical_addr);if (!pfn_valid (pfn)) { pr_warn_ratelimited(FW_WARN GHES_PFX"Invalid address in generic error data: %#llx\n" , - mem_err->physical_addr); + physical_addr);return false; } +memory_failure_queue (pfn, flags); +return true; +} + +static bool ghes_handle_memory_failure (struct acpi_hest_generic_data *gdata, +int sev) +{ +int flags =-1 ; +int sec_sev =ghes_severity (gdata->error_severity); +struct cper_sec_mem_err *mem_err =acpi_hest_get_payload (gdata); + +if (!(mem_err->validation_bits &CPER_MEM_VALID_PA )) +return false; +/* iff following two events can be handled properly by now */ if (sec_sev ==GHES_SEV_CORRECTED && (gdata->flags &CPER_SEC_ERROR_THRESHOLD_EXCEEDED ))
@@ -470,14 +477,56 @@ static bool ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata,if (sev ==GHES_SEV_RECOVERABLE && sec_sev ==GHES_SEV_RECOVERABLE ) flags =0 ; -if (flags !=-1 ) { -memory_failure_queue (pfn, flags); -return true; - } +if (flags !=-1 ) +return ghes_do_memory_failure (mem_err->physical_addr, flags);return false; } +static bool ghes_handle_arm_hw_error (struct acpi_hest_generic_data *gdata,int sev) +{ +struct cper_sec_proc_arm *err =acpi_hest_get_payload (gdata); +bool queued = false; +int sec_sev, i; +char *p; + +log_arm_hw_error (err); + + sec_sev =ghes_severity (gdata->error_severity); +if (sev !=GHES_SEV_RECOVERABLE || sec_sev !=GHES_SEV_RECOVERABLE ) +return false; + + p = (char *)(err +1 ); +for (i =0 ; i < err->err_info_num; i++) { +struct cper_arm_err_info *err_info = (struct cper_arm_err_info *)p; +bool is_cache = (err_info->type ==CPER_ARM_CACHE_ERROR ); +bool has_pa = (err_info->validation_bits &CPER_ARM_INFO_VALID_PHYSICAL_ADDR ); +const char *error_type ="unknown error" ; + +/* +* The field (err_info->error_info & BIT(26)) is fixed to set to +* 1 in some old firmware of HiSilicon Kunpeng920. We assume that +* firmware won't mix corrected errors in an uncorrected section, +* and don't filter out 'corrected' error here. +*/ +if (is_cache && has_pa) { + queued =ghes_do_memory_failure (err_info->physical_fault_addr,0 ); + p += err_info->length; +continue ; + } + +if (err_info->type <ARRAY_SIZE (cper_proc_error_type_strs)) + error_type = cper_proc_error_type_strs[err_info->type]; + + pr_warn_ratelimited(FW_WARN GHES_PFX +"Unhandled processor error type: %s\n" , + error_type); + p += err_info->length; + } + +return queued; +} +/* * PCIe AER errors need to be sent to the AER driver for reporting and * recovery. The GHES severities map to the following AER severities and
@@ -605,9 +654,7 @@ static bool ghes_do_proc(struct ghes *ghes,ghes_handle_aer (gdata); }else if (guid_equal (sec_type, &CPER_SEC_PROC_ARM )) { -struct cper_sec_proc_arm *err =acpi_hest_get_payload (gdata); - -log_arm_hw_error (err); + queued =ghes_handle_arm_hw_error (gdata, sev); }else {void *err =acpi_hest_get_payload (gdata);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 335/700 EDAC/igen6: fix core dependency
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 0a9ece9ba154dd6205709108180952c55e630833 ]
igen6_edac needs mce_register()/unregister() functions, so it should depend on X86_MCE (or X86_MCE_INTEL).
That change prevents these build errors:
ld: drivers/edac/igen6_edac.o: in function `igen6_remove':
igen6_edac.c:(.text+0x494): undefined reference to `mce_unregister_decode_chain'
ld: drivers/edac/igen6_edac.o: in function `igen6_probe':
igen6_edac.c:(.text+0xf5b): undefined reference to `mce_register_decode_chain'
--- drivers/edac/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/edac/Kconfig +2 -1
@@ -270,7 +270,8 @@ config EDAC_PND2 config EDAC_IGEN6 tristate "Intel client SoC Integrated MC" - depends on PCI && X86_64 && PCI_MMCONFIG && ARCH_HAVE_NMI_SAFE_CMPXCHG + depends on PCI && PCI_MMCONFIG && ARCH_HAVE_NMI_SAFE_CMPXCHG + depends on X64_64 && X86_MCE_INTEL help Support for error detection and correction on the Intel client SoC Integrated Memory Controller using In-Band ECC IP.
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 336/700 blk-wbt: introduce a new disable state to prevent false positive by rwb_enabled()
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
[ Upstream commit 1d0903d61e9645c6330b94247b96dd873dfc11c8 ]
Now that we disable wbt by simply zero out rwb->wb_normal in wbt_disable_default() when switch elevator to bfq, but it's not safe because it will become false positive if we change queue depth. If it become false positive between wbt_wait() and wbt_track() when submit write request, it will lead to drop rqw->inflight to -1 in wbt_done(), which will end up trigger IO hung. Fix this issue by introduce a new state which mean the wbt was disabled.
--- block/blk-wbt.c | 5 +++-- block/blk-wbt.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
block/blk-wbt.c +3 -2
@@ -77,7 +77,8 @@ enum {static inline bool rwb_enabled (struct rq_wb *rwb) { -return rwb && rwb->wb_normal !=0 ; +return rwb && rwb->enable_state !=WBT_STATE_OFF_DEFAULT && + rwb->wb_normal !=0 ; }static void wb_timestamp (struct rq_wb *rwb,unsigned long *var)
@@ -702,7 +703,7 @@ void wbt_disable_default(struct request_queue *q) rwb =RQWB (rqos);if (rwb->enable_state ==WBT_STATE_ON_DEFAULT ) {blk_stat_deactivate (rwb->cb); - rwb->wb_normal =0 ; + rwb->enable_state =WBT_STATE_OFF_DEFAULT ; } }EXPORT_SYMBOL_GPL (wbt_disable_default);
block/blk-wbt.h +1 -0
@@ -34,6 +34,7 @@ enum {enum {WBT_STATE_ON_DEFAULT =1 ,WBT_STATE_ON_MANUAL =2 , +WBT_STATE_OFF_DEFAULT };struct rq_wb {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 337/700 blk-wbt: make sure throttle is enabled properly
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
[ Upstream commit 76a8040817b4b9c69b53f9b326987fa891b4082a ]
After commit a79050434b45 ("blk-rq-qos: refactor out common elements of blk-wbt"), if throttle was disabled by wbt_disable_default(), we could not enable again, fix this by set enable_state back to WBT_STATE_ON_DEFAULT.
--- block/blk-wbt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
block/blk-wbt.c +5 -1
@@ -637,9 +637,13 @@ void wbt_set_write_cache(struct request_queue *q, bool write_cache_on)void wbt_enable_default (struct request_queue *q) {struct rq_qos *rqos =wbt_rq_qos (q); +/* Throttling already enabled? */ -if (rqos) +if (rqos) { +if (RQWB (rqos)->enable_state ==WBT_STATE_OFF_DEFAULT ) +RQWB (rqos)->enable_state =WBT_STATE_ON_DEFAULT ;return ; + }/* Queue not registered? Maybe shutting down... */ if (!blk_queue_registered (q))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 338/700 ACPI: bgrt: Fix CFI violation
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit f37ccf8fce155d08ae2a4fb3db677911ced0c21a ]
clang's Control Flow Integrity requires that every indirect call has a valid target, which is based on the type of the function pointer. The *_show() functions in this file are written as if they will be called from dev_attr_show(); however, they will be called from sysfs_kf_seq_show() because the files were created by sysfs_create_group() and the sysfs ops are based on kobj_sysfs_ops because of kobject_add_and_create(). Because the *_show() functions do not match the type of the show() member in struct kobj_attribute, there is a CFI violation.
$ cat /sys/firmware/acpi/bgrt/{status,type,version,{x,y}offset}}
1
0
1
522
307$ dmesg | grep "CFI failure" [ 267.761825] CFI failure (target: type_show.d5e1ad21498a5fd14edbc5c320906598.cfi_jt+0x0/0x8): [ 267.762246] CFI failure (target: xoffset_show.d5e1ad21498a5fd14edbc5c320906598.cfi_jt+0x0/0x8): [ 267.762584] CFI failure (target: status_show.d5e1ad21498a5fd14edbc5c320906598.cfi_jt+0x0/0x8): [ 267.762973] CFI failure (target: yoffset_show.d5e1ad21498a5fd14edbc5c320906598.cfi_jt+0x0/0x8): [ 267.763330] CFI failure (target: version_show.d5e1ad21498a5fd14edbc5c320906598.cfi_jt+0x0/0x8):
Convert these functions to the type of the show() member in struct kobj_attribute so that there is no more CFI violation. Because these functions are all so similar, combine them into a macro.
--- drivers/acpi/bgrt.c | 57 ++++++++++++++------------------------------- 1 file changed, 18 insertions(+), 39 deletions(-)
drivers/acpi/bgrt.c +18 -39
@@ -15,40 +15,19 @@static void *bgrt_image;static struct kobject *bgrt_kobj; -static ssize_t version_show (struct device *dev, -struct device_attribute *attr,char *buf) -{ -return snprintf (buf,PAGE_SIZE ,"%d\n" , bgrt_tab.version); -} -static DEVICE_ATTR_RO (version); - -static ssize_t status_show (struct device *dev, -struct device_attribute *attr,char *buf) -{ -return snprintf (buf,PAGE_SIZE ,"%d\n" , bgrt_tab.status); -} -static DEVICE_ATTR_RO (status); - -static ssize_t type_show (struct device *dev, -struct device_attribute *attr,char *buf) -{ -return snprintf (buf,PAGE_SIZE ,"%d\n" , bgrt_tab.image_type); -} -static DEVICE_ATTR_RO (type); - -static ssize_t xoffset_show (struct device *dev, -struct device_attribute *attr,char *buf) -{ -return snprintf (buf,PAGE_SIZE ,"%d\n" , bgrt_tab.image_offset_x); -} -static DEVICE_ATTR_RO (xoffset); - -static ssize_t yoffset_show (struct device *dev, -struct device_attribute *attr,char *buf) -{ -return snprintf (buf,PAGE_SIZE ,"%d\n" , bgrt_tab.image_offset_y); -} -static DEVICE_ATTR_RO (yoffset); +#define BGRT_SHOW (_name, _member) \ + static ssize_t _name##_show(struct kobject *kobj, \ + struct kobj_attribute *attr, char *buf) \ + { \ + return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab._member); \ + } \ + struct kobj_attribute bgrt_attr_##_name = __ATTR_RO(_name) + +BGRT_SHOW (version, version); +BGRT_SHOW (status, status); +BGRT_SHOW (type, image_type); +BGRT_SHOW (xoffset, image_offset_x); +BGRT_SHOW (yoffset, image_offset_y);static ssize_t image_read (struct file *file,struct kobject *kobj,struct bin_attribute *attr,char *buf,loff_t off,size_t count)
@@ -60,11 +39,11 @@ static ssize_t image_read(struct file *file, struct kobject *kobj, static BIN_ATTR_RO(image, 0); /* size gets filled in later */static struct attribute *bgrt_attributes[] = { - &dev_attr_version.attr, - &dev_attr_status.attr, - &dev_attr_type.attr, - &dev_attr_xoffset.attr, - &dev_attr_yoffset.attr, + &bgrt_attr_version.attr, + &bgrt_attr_status.attr, + &bgrt_attr_type.attr, + &bgrt_attr_xoffset.attr, + &bgrt_attr_yoffset.attr,NULL , };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 339/700 cpufreq: Make cpufreq_online() call driver->offline() on errors
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit 3b7180573c250eb6e2a7eec54ae91f27472332ea ]
In the CPU removal path the ->offline() callback provided by the driver is always invoked before ->exit(), but in the cpufreq_online() error path it is not, so ->exit() is expected to somehow know the context in which it has been called and act accordingly.
That is less than straightforward, so make cpufreq_online() invoke the driver's ->offline() callback, if present, on errors before ->exit() too.
This only potentially affects intel_pstate.
--- drivers/cpufreq/cpufreq.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/cpufreq/cpufreq.c +10 -1
@@ -1370,9 +1370,14 @@ static int cpufreq_online(unsigned int cpu) goto out_free_policy; } +/* +* The initialization has succeeded and the policy is online. +* If there is a problem with its frequency table, take it +* offline and drop it. +*/ ret =cpufreq_table_validate_and_sort (policy);if (ret) - goto out_exit_policy; + goto out_offline_policy;/* related_cpus should at least include policy->cpus. */ cpumask_copy (policy->related_cpus, policy->cpus);
@@ -1518,6 +1523,10 @@ out_destroy_policy:up_write (&policy->rwsem); +out_offline_policy: +if (cpufreq_driver->offline) + cpufreq_driver->offline (policy); + out_exit_policy:if (cpufreq_driver->exit) cpufreq_driver->exit (policy);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 340/700 PM / devfreq: passive: Fix get_target_freq when not using required-opp
In reply to Greg Kroah-HartmanFrom: Chanwoo Choi <[email protected]>
[ Upstream commit 8c37d01e1a86073d15ea7084390fba58d9a1665f ]
The 86ad9a24f21e ("PM / devfreq: Add required OPPs support to passive governor") supported the required-opp property for using devfreq passive governor. But, 86ad9a24f21e has caused the problem on use-case when required-opp is not used such as exynos-bus.c devfreq driver. So that fix the get_target_freq of passive governor for supporting the case of when required-opp is not used.
--- drivers/devfreq/governor_passive.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/devfreq/governor_passive.c +2 -1
@@ -65,7 +65,7 @@ static int devfreq_passive_get_target_freq(struct devfreq *devfreq,dev_pm_opp_put (p_opp);if (IS_ERR (opp)) -return PTR_ERR (opp); + goto no_required_opp; *freq =dev_pm_opp_get_freq (opp);dev_pm_opp_put (opp);
@@ -73,6 +73,7 @@ static int devfreq_passive_get_target_freq(struct devfreq *devfreq,return 0 ; } +no_required_opp:/* * Get the OPP table's index of decided frequency by governor * of parent device.
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 341/700 block: fix trace completion for chained bio
In reply to Greg Kroah-HartmanFrom: Edward Hsieh <[email protected]>
[ Upstream commit 60b6a7e6a0f4382cd689f9afdac816964fec2921 ]
For chained bio, trace_block_bio_complete in bio_endio is currently called only by the parent bio once upon all chained bio completed. However, the sector and size for the parent bio are modified in bio_split. Therefore, the size and sector of the complete events might not match the queue events in blktrace.
The original fix of bio completion trace <fbbaf700e7b1> ("block: trace completion of all bios.") wants multiple complete events to correspond to one queue event but missed this.
The issue can be reproduced by md/raid5 read with bio cross chunks.
To fix, move trace completion into the loop for every chained bio to call.
--- block/bio.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
block/bio.c +6 -7
@@ -1412,8 +1412,7 @@ static inline bool bio_remaining_done(struct bio *bio)* * bio_endio() can be called several times on a bio that has been chained * using bio_chain(). The ->bi_end_io() function will only be called the -* last time. At this point the BLK_TA_COMPLETE tracing event will be -* generated if BIO_TRACE_COMPLETION is set. +* last time. **/ void bio_endio (struct bio *bio) {
@@ -1426,6 +1425,11 @@ again:if (bio->bi_bdev)rq_qos_done_bio (bio->bi_bdev->bd_disk->queue, bio); +if (bio->bi_bdev &&bio_flagged (bio,BIO_TRACE_COMPLETION )) { +trace_block_bio_complete (bio->bi_bdev->bd_disk->queue, bio); +bio_clear_flag (bio,BIO_TRACE_COMPLETION ); + } +/* * Need to have a real endio function for chained bios, otherwise * various corner cases will break (like stacking block devices that
@@ -1439,11 +1443,6 @@ again: goto again; } -if (bio->bi_bdev &&bio_flagged (bio,BIO_TRACE_COMPLETION )) { -trace_block_bio_complete (bio->bi_bdev->bd_disk->queue, bio); -bio_clear_flag (bio,BIO_TRACE_COMPLETION ); - } -blk_throtl_bio_endio (bio);/* release cgroup info */ bio_uninit (bio);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 342/700 blk-mq: update hctx->dispatch_busy in case of real scheduler
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit cb9516be7708a2a18ec0a19fe3a225b5b3bc92c7 ]
Commit 6e6fcbc27e77 ("blk-mq: support batching dispatch in case of io") starts to support io batching submission by using hctx->dispatch_busy.
However, blk_mq_update_dispatch_busy() isn't changed to update hctx->dispatch_busy in that commit, so fix the issue by updating hctx->dispatch_busy in case of real scheduler.
--- block/blk-mq.c | 3 --- 1 file changed, 3 deletions(-)
block/blk-mq.c +0 -3
@@ -1223,9 +1223,6 @@ static void blk_mq_update_dispatch_busy(struct blk_mq_hw_ctx *hctx, bool busy) {unsigned int ewma; -if (hctx->queue->elevator) -return ; - ewma = hctx->dispatch_busy;if (!ewma && !busy)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 343/700 ocfs2: fix snprintf() checking
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 54e948c60cc843b6e84dc44496edc91f51d2a28e ]
The snprintf() function returns the number of bytes which would have been printed if the buffer was large enough. In other words it can return ">= remain" but this code assumes it returns "== remain".
The run time impact of this bug is not very severe. The next iteration through the loop would trigger a WARN() when we pass a negative limit to snprintf(). We would then return success instead of -E2BIG.
The kernel implementation of snprintf() will never return negatives so there is no need to check and I have deleted that dead code.
--- fs/ocfs2/filecheck.c | 6 +----- fs/ocfs2/stackglue.c | 8 ++------ 2 files changed, 3 insertions(+), 11 deletions(-)
fs/ocfs2/filecheck.c +1 -5
@@ -328,11 +328,7 @@ static ssize_t ocfs2_filecheck_attr_show(struct kobject *kobj, ret =snprintf (buf + total, remain,"%lu\t\t%u\t%s\n" , p->fe_ino, p->fe_done,ocfs2_filecheck_error (p->fe_status)); -if (ret <0 ) { - total = ret; -break ; - } -if (ret == remain) { +if (ret >= remain) {/* snprintf() didn't fit */ total = -E2BIG ;break ;
fs/ocfs2/stackglue.c +2 -6
@@ -502,11 +502,7 @@ static ssize_t ocfs2_loaded_cluster_plugins_show(struct kobject *kobj,list_for_each_entry (p, &ocfs2_stack_list, sp_list) { ret =snprintf (buf, remain,"%s\n" , p->sp_name); -if (ret <0 ) { - total = ret; -break ; - } -if (ret == remain) { +if (ret >= remain) {/* snprintf() didn't fit */ total = -E2BIG ;break ;
@@ -533,7 +529,7 @@ static ssize_t ocfs2_active_cluster_plugin_show(struct kobject *kobj,if (active_stack) { ret =snprintf (buf,PAGE_SIZE ,"%s\n" , active_stack->sp_name); -if (ret ==PAGE_SIZE ) +if (ret >=PAGE_SIZE ) ret = -E2BIG ; }spin_unlock (&ocfs2_stack_lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 344/700 dax: fix ENOMEM handling in grab_mapping_entry()
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 1a14e3779dd58c16b30e56558146e5cc850ba8b0 ]
grab_mapping_entry() has a bug in handling of ENOMEM condition. Suppose we have a PMD entry at index i which we are downgrading to a PTE entry. grab_mapping_entry() will set pmd_downgrade to true, lock the entry, clear the entry in xarray, and decrement mapping->nrpages. The it will call:
entry = dax_make_entry(pfn_to_pfn_t(0), flags); dax_lock_entry(xas, entry);
which inserts new PTE entry into xarray. However this may fail allocating the new node. We handle this by:
if (xas_nomem(xas, mapping_gfp_mask(mapping) & ~__GFP_HIGHMEM)) goto retry;
however pmd_downgrade stays set to true even though 'entry' returned from get_unlocked_entry() will be NULL now. And we will go again through the downgrade branch. This is mostly harmless except that mapping->nrpages is decremented again and we temporarily have an invalid entry stored in xarray. Fix the problem by setting pmd_downgrade to false each time we lookup the entry we work with so that it matches the entry we found.
--- fs/dax.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/dax.c +2 -1
@@ -488,10 +488,11 @@ static void *grab_mapping_entry(struct xa_state *xas, struct address_space *mapping, unsigned int order) {unsigned long index = xas->xa_index; -bool pmd_downgrade = false;/* splitting PMD entry into PTE entries? */ +bool pmd_downgrade;/* splitting PMD entry into PTE entries? */ void *entry; retry: + pmd_downgrade = false;xas_lock_irq (xas); entry =get_unlocked_entry (xas, order);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 345/700 mm/debug_vm_pgtable: ensure THP availability via has_transparent_hugepage()
In reply to Greg Kroah-HartmanFrom: Anshuman Khandual <[email protected]>
[ Upstream commit 65ac1a60a57e2c55f2ac37f27095f6b012295e81 ]
On certain platforms, THP support could not just be validated via the build option CONFIG_TRANSPARENT_HUGEPAGE. Instead has_transparent_hugepage() also needs to be called upon to verify THP runtime support. Otherwise the debug test will just run into unusable THP helpers like in the case of a 4K hash config on powerpc platform [1]. This just moves all pfn_pmd() and pfn_pud() after THP runtime validation with has_transparent_hugepage() which prevents the mentioned problem.
[1] https://bugzilla.kernel.org/show_bug.cgi?id=213069
--- mm/debug_vm_pgtable.c | 63 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 12 deletions(-)
mm/debug_vm_pgtable.c +51 -12
@@ -146,13 +146,14 @@ static void __init pte_savedwrite_tests(unsigned long pfn, pgprot_t prot)static void __init pmd_basic_tests (unsigned long pfn,int idx) {pgprot_t prot = protection_map[idx]; -pmd_t pmd =pfn_pmd (pfn, prot);unsigned long val = idx, *ptr = &val; +pmd_t pmd;if (!has_transparent_hugepage ())return ;pr_debug ("Validating PMD basic (%pGv)\n" , ptr); + pmd =pfn_pmd (pfn, prot);/* * This test needs to be executed after the given page table entry
@@ -185,7 +186,7 @@ static void __init pmd_advanced_tests(struct mm_struct *mm, unsigned long pfn, unsigned long vaddr, pgprot_t prot, pgtable_t pgtable) { - pmd_t pmd = pfn_pmd(pfn, prot); + pmd_t pmd;if (!has_transparent_hugepage ())return ;
@@ -232,9 +233,14 @@ static void __init pmd_advanced_tests(struct mm_struct *mm,static void __init pmd_leaf_tests (unsigned long pfn,pgprot_t prot) { -pmd_t pmd =pfn_pmd (pfn, prot); +pmd_t pmd; + +if (!has_transparent_hugepage ()) +return ;pr_debug ("Validating PMD leaf\n" ); + pmd =pfn_pmd (pfn, prot); +/* * PMD based THP is a leaf entry. */
@@ -267,12 +273,16 @@ static void __init pmd_huge_tests(pmd_t *pmdp, unsigned long pfn, pgprot_t prot)static void __init pmd_savedwrite_tests (unsigned long pfn,pgprot_t prot) { -pmd_t pmd =pfn_pmd (pfn, prot); +pmd_t pmd;if (!IS_ENABLED (CONFIG_NUMA_BALANCING ))return ; +if (!has_transparent_hugepage ()) +return ; +pr_debug ("Validating PMD saved write\n" ); + pmd =pfn_pmd (pfn, prot);WARN_ON (!pmd_savedwrite (pmd_mk_savedwrite (pmd_clear_savedwrite (pmd))));WARN_ON (pmd_savedwrite (pmd_clear_savedwrite (pmd_mk_savedwrite (pmd)))); }
@@ -281,13 +291,14 @@ static void __init pmd_savedwrite_tests(unsigned long pfn, pgprot_t prot)static void __init pud_basic_tests (struct mm_struct *mm,unsigned long pfn,int idx) {pgprot_t prot = protection_map[idx]; -pud_t pud =pfn_pud (pfn, prot);unsigned long val = idx, *ptr = &val; +pud_t pud;if (!has_transparent_hugepage ())return ;pr_debug ("Validating PUD basic (%pGv)\n" , ptr); + pud =pfn_pud (pfn, prot);/* * This test needs to be executed after the given page table entry
@@ -323,7 +334,7 @@ static void __init pud_advanced_tests(struct mm_struct *mm, unsigned long pfn, unsigned long vaddr, pgprot_t prot) { - pud_t pud = pfn_pud(pfn, prot); + pud_t pud;if (!has_transparent_hugepage ())return ;
@@ -332,6 +343,7 @@ static void __init pud_advanced_tests(struct mm_struct *mm,/* Align the address wrt HPAGE_PUD_SIZE */ vaddr &=HPAGE_PUD_MASK ; + pud =pfn_pud (pfn, prot);set_pud_at (mm, vaddr, pudp, pud);pudp_set_wrprotect (mm, vaddr, pudp); pud =READ_ONCE (*pudp);
@@ -370,9 +382,13 @@ static void __init pud_advanced_tests(struct mm_struct *mm,static void __init pud_leaf_tests (unsigned long pfn,pgprot_t prot) { -pud_t pud =pfn_pud (pfn, prot); +pud_t pud; + +if (!has_transparent_hugepage ()) +return ;pr_debug ("Validating PUD leaf\n" ); + pud =pfn_pud (pfn, prot);/* * PUD based THP is a leaf entry. */
@@ -654,12 +670,16 @@ static void __init pte_protnone_tests(unsigned long pfn, pgprot_t prot)#ifdef CONFIG_TRANSPARENT_HUGEPAGE static void __init pmd_protnone_tests (unsigned long pfn,pgprot_t prot) { -pmd_t pmd =pmd_mkhuge (pfn_pmd (pfn, prot)); +pmd_t pmd;if (!IS_ENABLED (CONFIG_NUMA_BALANCING ))return ; +if (!has_transparent_hugepage ()) +return ; +pr_debug ("Validating PMD protnone\n" ); + pmd =pmd_mkhuge (pfn_pmd (pfn, prot));WARN_ON (!pmd_protnone (pmd));WARN_ON (!pmd_present (pmd)); }
@@ -679,18 +699,26 @@ static void __init pte_devmap_tests(unsigned long pfn, pgprot_t prot)#ifdef CONFIG_TRANSPARENT_HUGEPAGE static void __init pmd_devmap_tests (unsigned long pfn,pgprot_t prot) { -pmd_t pmd =pfn_pmd (pfn, prot); +pmd_t pmd; + +if (!has_transparent_hugepage ()) +return ;pr_debug ("Validating PMD devmap\n" ); + pmd =pfn_pmd (pfn, prot);WARN_ON (!pmd_devmap (pmd_mkdevmap (pmd))); }#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD static void __init pud_devmap_tests (unsigned long pfn,pgprot_t prot) { -pud_t pud =pfn_pud (pfn, prot); +pud_t pud; + +if (!has_transparent_hugepage ()) +return ;pr_debug ("Validating PUD devmap\n" ); + pud =pfn_pud (pfn, prot);WARN_ON (!pud_devmap (pud_mkdevmap (pud))); }#else /* !CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */
@@ -733,25 +761,33 @@ static void __init pte_swap_soft_dirty_tests(unsigned long pfn, pgprot_t prot)#ifdef CONFIG_TRANSPARENT_HUGEPAGE static void __init pmd_soft_dirty_tests (unsigned long pfn,pgprot_t prot) { -pmd_t pmd =pfn_pmd (pfn, prot); +pmd_t pmd;if (!IS_ENABLED (CONFIG_MEM_SOFT_DIRTY ))return ; +if (!has_transparent_hugepage ()) +return ; +pr_debug ("Validating PMD soft dirty\n" ); + pmd =pfn_pmd (pfn, prot);WARN_ON (!pmd_soft_dirty (pmd_mksoft_dirty (pmd)));WARN_ON (pmd_soft_dirty (pmd_clear_soft_dirty (pmd))); }static void __init pmd_swap_soft_dirty_tests (unsigned long pfn,pgprot_t prot) { -pmd_t pmd =pfn_pmd (pfn, prot); +pmd_t pmd;if (!IS_ENABLED (CONFIG_MEM_SOFT_DIRTY ) || !IS_ENABLED (CONFIG_ARCH_ENABLE_THP_MIGRATION ))return ; +if (!has_transparent_hugepage ()) +return ; +pr_debug ("Validating PMD swap soft dirty\n" ); + pmd =pfn_pmd (pfn, prot);WARN_ON (!pmd_swp_soft_dirty (pmd_swp_mksoft_dirty (pmd)));WARN_ON (pmd_swp_soft_dirty (pmd_swp_clear_soft_dirty (pmd))); }
@@ -780,6 +816,9 @@ static void __init pmd_swap_tests(unsigned long pfn, pgprot_t prot)swp_entry_t swp;pmd_t pmd; +if (!has_transparent_hugepage ()) +return ; +pr_debug ("Validating PMD swap\n" ); pmd =pfn_pmd (pfn, prot); swp =__pmd_to_swp_entry (pmd);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 346/700 mm: mmap_lock: use local locks instead of disabling preemption
In reply to Greg Kroah-HartmanFrom: Nicolas Saenz Julienne <[email protected]>
[ Upstream commit 832b50725373e8c46781b7d4db104ec9cf564a6b ]
mmap_lock will explicitly disable/enable preemption upon manipulating its local CPU variables. This is to be expected, but in this case, it doesn't play well with PREEMPT_RT. The preemption disabled code section also takes a spin-lock. Spin-locks in RT systems will try to schedule, which is exactly what we're trying to avoid.
To mitigate this, convert the explicit preemption handling to local_locks. Which are RT aware, and will disable migration instead of preemption when PREEMPT_RT=y.
The faulty call trace looks like the following:
__mmap_lock_do_trace_*()
preempt_disable()
get_mm_memcg_path()
cgroup_path()
kernfs_path_from_node()
spin_lock_irqsave() /* Scheduling while atomic! */--- mm/mmap_lock.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
mm/mmap_lock.c +22 -11
@@ -11,6 +11,7 @@#include <linux/rcupdate.h> #include <linux/smp.h> #include <linux/trace_events.h> +#include <linux/local_lock.h> EXPORT_TRACEPOINT_SYMBOL (mmap_lock_start_locking);EXPORT_TRACEPOINT_SYMBOL (mmap_lock_acquire_returned);
@@ -39,21 +40,30 @@ static int reg_refcount; /* Protected by reg_lock. */*/ #define CONTEXT_COUNT 4 -static DEFINE_PER_CPU(char __rcu *, memcg_path_buf); +struct memcg_path { +local_lock_t lock; +char __rcu *buf; +local_t buf_idx; +}; +static DEFINE_PER_CPU(struct memcg_path, memcg_paths) = { + .lock =INIT_LOCAL_LOCK (lock), + .buf_idx =LOCAL_INIT (0 ), +}; +static char **tmp_bufs; -static DEFINE_PER_CPU(int, memcg_path_buf_idx);/* Called with reg_lock held. */ static void free_memcg_path_bufs (void ) { +struct memcg_path *memcg_path;int cpu;char **old = tmp_bufs;for_each_possible_cpu (cpu) { - *(old++) =rcu_dereference_protected ( -per_cpu (memcg_path_buf, cpu), + memcg_path =per_cpu_ptr (&memcg_paths, cpu); + *(old++) =rcu_dereference_protected (memcg_path->buf,lockdep_is_held (®_lock)); -rcu_assign_pointer (per_cpu (memcg_path_buf, cpu),NULL ); +rcu_assign_pointer (memcg_path->buf,NULL ); }/* Wait for inflight memcg_path_buf users to finish. */
@@ -88,7 +98,7 @@ int trace_mmap_lock_reg(void) new =kmalloc (MEMCG_PATH_BUF_SIZE *CONTEXT_COUNT ,GFP_KERNEL );if (new ==NULL ) goto out_fail_free; -rcu_assign_pointer (per_cpu (memcg_path_buf, cpu), new); +rcu_assign_pointer (per_cpu_ptr (&memcg_paths, cpu)->buf, new);/* Don't need to wait for inflights, they'd have gotten NULL. */ }
@@ -122,23 +132,24 @@ out:static inline char *get_memcg_path_buf (void ) { +struct memcg_path *memcg_path =this_cpu_ptr (&memcg_paths);char *buf;int idx;rcu_read_lock (); - buf =rcu_dereference (*this_cpu_ptr (&memcg_path_buf)); + buf =rcu_dereference (memcg_path->buf);if (buf ==NULL ) {rcu_read_unlock ();return NULL ; } - idx =this_cpu_add_return (memcg_path_buf_idx,MEMCG_PATH_BUF_SIZE ) - + idx =local_add_return (MEMCG_PATH_BUF_SIZE , &memcg_path->buf_idx) -MEMCG_PATH_BUF_SIZE ;return &buf[idx]; }static inline void put_memcg_path_buf (void ) { -this_cpu_sub (memcg_path_buf_idx,MEMCG_PATH_BUF_SIZE ); +local_sub (MEMCG_PATH_BUF_SIZE , &this_cpu_ptr (&memcg_paths)->buf_idx);rcu_read_unlock (); }
@@ -179,14 +190,14 @@ out:#define TRACE_MMAP_LOCK_EVENT (type, mm, ...) \ do { \ const char *memcg_path; \ - preempt_disable(); \ + local_lock(&memcg_paths.lock); \ memcg_path = get_mm_memcg_path(mm); \ trace_mmap_lock_##type(mm, \ memcg_path != NULL ? memcg_path : "", \ ##__VA_ARGS__); \ if (likely(memcg_path != NULL)) \ put_memcg_path_buf(); \ - preempt_enable(); \ + local_unlock(&memcg_paths.lock); \ } while (0)#else /* !CONFIG_MEMCG */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 347/700 swap: fix do_swap_page() race with swapoff
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit 2799e77529c2a25492a4395db93996e3dacd762d ]
When I was investigating the swap code, I found the below possible race window:
CPU 1 CPU 2
----- -----do_swap_page
if (data_race(si->flags & SWP_SYNCHRONOUS_IO)
swap_readpage
if (data_race(sis->flags & SWP_FS_OPS)) {
swapoff
..
p->swap_file = NULL;
..
struct file *swap_file = sis->swap_file;
struct address_space *mapping = swap_file->f_mapping;[oops!]Note that for the pages that are swapped in through swap cache, this isn't an issue. Because the page is locked, and the swap entry will be marked with SWAP_HAS_CACHE, so swapoff() can not proceed until the page has been unlocked.
Fix this race by using get/put_swap_device() to guard against concurrent swapoff.
--- include/linux/swap.h | 9 +++++++++ mm/memory.c | 11 +++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-)
include/linux/swap.h +9 -0
@@ -504,6 +504,15 @@ static inline struct swap_info_struct *swp_swap_info(swp_entry_t entry)return NULL ; } +static inline struct swap_info_struct *get_swap_device (swp_entry_t entry) +{ +return NULL ; +} + +static inline void put_swap_device (struct swap_info_struct *si) +{ +} +#define swap_address_space (entry) (NULL)#define get_nr_swap_pages () 0L#define total_swap_pages 0L
mm/memory.c +9 -2
@@ -3310,6 +3310,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) {struct vm_area_struct *vma = vmf->vma;struct page *page =NULL , *swapcache; +struct swap_info_struct *si =NULL ;swp_entry_t entry;pte_t pte;int locked;
@@ -3337,14 +3338,16 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) goto out; } +/* Prevent swapoff from happening to us. */ + si =get_swap_device (entry); +if (unlikely (!si)) + goto out;delayacct_set_flag (DELAYACCT_PF_SWAPIN ); page =lookup_swap_cache (entry, vma, vmf->address); swapcache = page;if (!page) { -struct swap_info_struct *si =swp_swap_info (entry); -if (data_race (si->flags &SWP_SYNCHRONOUS_IO ) &&__swap_count (entry) ==1 ) {/* skip swapcache */
@@ -3515,6 +3518,8 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) unlock:pte_unmap_unlock (vmf->pte, vmf->ptl); out: +if (si) +put_swap_device (si);return ret; out_nomap:pte_unmap_unlock (vmf->pte, vmf->ptl);
@@ -3526,6 +3531,8 @@ out_release:unlock_page (swapcache);put_page (swapcache); } +if (si) +put_swap_device (si);return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 348/700 mm/shmem: fix shmem_swapin() race with swapoff
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit 2efa33fc7f6ec94a3a538c1a264273c889be2b36 ]
When I was investigating the swap code, I found the below possible race window:
CPU 1 CPU 2
----- -----shmem_swapin
swap_cluster_readahead
if (likely(si->flags & (SWP_BLKDEV | SWP_FS_OPS))) {
swapoff
..
si->swap_file = NULL;
..
struct inode *inode = si->swap_file->f_mapping->host;[oops!]Close this race window by using get/put_swap_device() to guard against concurrent swapoff.
--- mm/shmem.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
mm/shmem.c +13 -1
@@ -1696,7 +1696,8 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index,struct address_space *mapping = inode->i_mapping;struct shmem_inode_info *info =SHMEM_I (inode);struct mm_struct *charge_mm = vma ? vma->vm_mm : current->mm; -struct page *page; +struct swap_info_struct *si; +struct page *page =NULL ;swp_entry_t swap;int error;
@@ -1704,6 +1705,12 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index, swap =radix_to_swp_entry (*pagep); *pagep =NULL ; +/* Prevent swapoff from happening to us. */ + si =get_swap_device (swap); +if (!si) { + error =EINVAL ; + goto failed; + }/* Look it up and read it in.. */ page =lookup_swap_cache (swap,NULL ,0 );if (!page) {
@@ -1765,6 +1772,8 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index,swap_free (swap); *pagep = page; +if (si) +put_swap_device (si);return 0 ; failed:if (!shmem_confirm_swap (mapping, index, swap))
@@ -1775,6 +1784,9 @@ unlock:put_page (page); } +if (si) +put_swap_device (si); +return error; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 349/700 mm: memcg/slab: properly set up gfp flags for objcg pointer array
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
[ Upstream commit 41eb5df1cbc9b302fc263ad7c9f38cfc38b4df61 ]
Patch series "mm: memcg/slab: Fix objcg pointer array handling problem", v4.
Since the merging of the new slab memory controller in v5.9, the page structure stores a pointer to objcg pointer array for slab pages. When the slab has no used objects, it can be freed in free_slab() which will call kfree() to free the objcg pointer array in memcg_alloc_page_obj_cgroups(). If it happens that the objcg pointer array is the last used object in its slab, that slab may then be freed which may caused kfree() to be called again.
With the right workload, the slab cache may be set up in a way that allows the recursive kfree() calling loop to nest deep enough to cause a kernel stack overflow and panic the system. In fact, we have a reproducer that can cause kernel stack overflow on a s390 system involving kmalloc-rcl-256 and kmalloc-rcl-128 slabs with the following kfree() loop recursively called 74 times:
[ 285.520739] [<000000000ec432fc>] kfree+0x4bc/0x560 [ 285.520740] [<000000000ec43466>] __free_slab+0xc6/0x228 [ 285.520741] [<000000000ec41fc2>] __slab_free+0x3c2/0x3e0 [ 285.520742] [<000000000ec432fc>] kfree+0x4bc/0x560 : While investigating this issue, I
also found an issue on the allocation side. If the objcg pointer array happen to come from the same slab or a circular dependency linkage is formed with multiple slabs, those affected slabs can never be freed again.
This patch series addresses these two issues by introducing a new set of kmalloc-cg-<n> caches split from kmalloc-<n> caches. The new set will only contain non-reclaimable and non-dma objects that are accounted in memory cgroups whereas the old set are now for unaccounted objects only. By making this split, all the objcg pointer arrays will come from the kmalloc-<n> caches, but those caches will never hold any objcg pointer array. As a result, deeply nested kfree() call and the unfreeable slab problems are now gone.
This patch (of 4):
Since the merging of the new slab memory controller in v5.9, the page structure may store a pointer to obj_cgroup pointer array for slab pages. Currently, only the __GFP_ACCOUNT bit is masked off. However, the array is not readily reclaimable and doesn't need to come from the DMA buffer. So those GFP bits should be masked off as well.
Do the flag bit clearing at memcg_alloc_page_obj_cgroups() to make sure that it is consistently applied no matter where it is called.
--- mm/memcontrol.c | 8 ++++++++ mm/slab.h | 1 - 2 files changed, 8 insertions(+), 1 deletion(-)
mm/memcontrol.c +8 -0
@@ -2906,6 +2906,13 @@ static void commit_charge(struct page *page, struct mem_cgroup *memcg) }#ifdef CONFIG_MEMCG_KMEM +/* +* The allocated objcg pointers array is not accounted directly. +* Moreover, it should not come from DMA buffer and is not readily +* reclaimable. So those GFP bits should be masked off. +*/ +#define OBJCGS_CLEAR_MASK (__GFP_DMA | __GFP_RECLAIMABLE | __GFP_ACCOUNT) +int memcg_alloc_page_obj_cgroups (struct page *page,struct kmem_cache *s,gfp_t gfp,bool new_page) {
@@ -2913,6 +2920,7 @@ int memcg_alloc_page_obj_cgroups(struct page *page, struct kmem_cache *s,unsigned long memcg_data;void *vec; + gfp &= ~OBJCGS_CLEAR_MASK ; vec =kcalloc_node (objects,sizeof (struct obj_cgroup *), gfp,page_to_nid (page));if (!vec)
mm/slab.h +0 -1
@@ -309,7 +309,6 @@ static inline void memcg_slab_post_alloc_hook(struct kmem_cache *s,if (!memcg_kmem_enabled () || !objcg)return ; - flags &= ~__GFP_ACCOUNT;for (i =0 ; i < size; i++) {if (likely (p[i])) { page =virt_to_head_page (p[i]);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 350/700 mm/page_alloc: fix counting of managed_pages
In reply to Greg Kroah-HartmanFrom: Liu Shixin <[email protected]>
[ Upstream commit f7ec104458e00d27a190348ac3a513f3df3699a4 ]
commit f63661566fad ("mm/page_alloc.c: clear out zone->lowmem_reserve[] if the zone is empty") clears out zone->lowmem_reserve[] if zone is empty. But when zone is not empty and sysctl_lowmem_reserve_ratio[i] is set to zero, zone_managed_pages(zone) is not counted in the managed_pages either. This is inconsistent with the description of lowmem_reserve, so fix it.
--- mm/page_alloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
mm/page_alloc.c +6 -6
@@ -7894,14 +7894,14 @@ static void setup_per_zone_lowmem_reserve(void)unsigned long managed_pages =0 ;for (j = i +1 ; j <MAX_NR_ZONES ; j++) { -if (clear) { - zone->lowmem_reserve[j] =0 ; - }else { -struct zone *upper_zone = &pgdat->node_zones[j]; +struct zone *upper_zone = &pgdat->node_zones[j]; + + managed_pages +=zone_managed_pages (upper_zone); - managed_pages +=zone_managed_pages (upper_zone); +if (clear) + zone->lowmem_reserve[j] =0 ; +else zone->lowmem_reserve[j] = managed_pages / ratio; - } } } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 351/700 xfrm: xfrm_state_mtu should return at least 1280 for ipv6
In reply to Greg Kroah-HartmanFrom: Sabrina Dubroca <[email protected]>
[ Upstream commit b515d2637276a3810d6595e10ab02c13bfd0b63a ]
Jianwen reported that IPv6 Interoperability tests are failing in an IPsec case where one of the links between the IPsec peers has an MTU of 1280. The peer generates a packet larger than this MTU, the router replies with a "Packet too big" message indicating an MTU of 1280. When the peer tries to send another large packet, xfrm_state_mtu returns 1280 - ipsec_overhead, which causes ip6_setup_cork to fail with EINVAL.
We can fix this by forcing xfrm_state_mtu to return IPV6_MIN_MTU when IPv6 is used. After going through IPsec, the packet will then be fragmented to obey the actual network's PMTU, just before leaving the host.
Currently, TFC padding is capped to PMTU - overhead to avoid
fragementation: after padding and encapsulation, we still fit within the PMTU. That behavior is preserved in this patch.
--- include/net/xfrm.h | 1 + net/ipv4/esp4.c | 2 +- net/ipv6/esp6.c | 2 +- net/xfrm/xfrm_state.c | 14 ++++++++++++-- 4 files changed, 15 insertions(+), 4 deletions(-)
include/net/xfrm.h +1 -0
@@ -1546,6 +1546,7 @@ void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si);void xfrm_spd_getinfo (struct net *net,struct xfrmk_spdinfo *si);u32 xfrm_replay_seqhi (struct xfrm_state *x,__be32 net_seq);int xfrm_init_replay (struct xfrm_state *x); +u32 __xfrm_state_mtu (struct xfrm_state *x,int mtu);u32 xfrm_state_mtu (struct xfrm_state *x,int mtu);int __xfrm_init_state (struct xfrm_state *x,bool init_replay,bool offload);int xfrm_init_state (struct xfrm_state *x);
net/ipv4/esp4.c +1 -1
@@ -673,7 +673,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst (skb);u32 padto; - padto =min (x->tfcpad,xfrm_state_mtu (x, dst->child_mtu_cached)); + padto =min (x->tfcpad,__xfrm_state_mtu (x, dst->child_mtu_cached));if (skb->len < padto) esp.tfclen = padto - skb->len; }
net/ipv6/esp6.c +1 -1
@@ -708,7 +708,7 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst (skb);u32 padto; - padto =min (x->tfcpad,xfrm_state_mtu (x, dst->child_mtu_cached)); + padto =min (x->tfcpad,__xfrm_state_mtu (x, dst->child_mtu_cached));if (skb->len < padto) esp.tfclen = padto - skb->len; }
net/xfrm/xfrm_state.c +12 -2
@@ -2518,7 +2518,7 @@ void xfrm_state_delete_tunnel(struct xfrm_state *x) }EXPORT_SYMBOL (xfrm_state_delete_tunnel); -u32 xfrm_state_mtu (struct xfrm_state *x,int mtu) +u32 __xfrm_state_mtu (struct xfrm_state *x,int mtu) {const struct xfrm_type *type =READ_ONCE (x->type);struct crypto_aead *aead;
@@ -2549,7 +2549,17 @@ u32 xfrm_state_mtu(struct xfrm_state *x, int mtu)return ((mtu - x->props.header_len -crypto_aead_authsize (aead) - net_adj) & ~(blksize -1 )) + net_adj -2 ; } -EXPORT_SYMBOL_GPL (xfrm_state_mtu); +EXPORT_SYMBOL_GPL (__xfrm_state_mtu); + +u32 xfrm_state_mtu (struct xfrm_state *x,int mtu) +{ + mtu =__xfrm_state_mtu (x, mtu); + +if (x->props.family ==AF_INET6 && mtu <IPV6_MIN_MTU ) +return IPV6_MIN_MTU ; + +return mtu; +}int __xfrm_init_state (struct xfrm_state *x,bool init_replay,bool offload) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 352/700 drm/bridge/sii8620: fix dependency on extcon
In reply to Greg Kroah-HartmanFrom: Robert Foss <[email protected]>
[ Upstream commit 08319adbdde15ef7cee1970336f63461254baa2a ]
The DRM_SIL_SII8620 kconfig has a weak imply dependency on EXTCON, which causes issues when sii8620 is built as a builtin and EXTCON is built as a module.
The symptoms are 'undefined reference' errors caused by the symbols in EXTCON not being available to the sii8620 driver.
--- drivers/gpu/drm/bridge/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/Kconfig +1 -1
@@ -143,7 +143,7 @@ config DRM_SIL_SII8620 tristate "Silicon Image SII8620 HDMI/MHL bridge" depends on OF select DRM_KMS_HELPER - imply EXTCON + select EXTCON depends on RC_CORE || !RC_CORE help Silicon Image SII8620 HDMI/MHL bridge chip driver.
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 353/700 drm/bridge: Fix the stop condition of drm_bridge_chain_pre_enable()
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit bab5cca7e609952b069a550e39fe4893149fb658 ]
The drm_bridge_chain_pre_enable() is not the proper opposite of drm_bridge_chain_post_disable(). It continues along the chain to _before_ the starting bridge. Let's fix that.
--- drivers/gpu/drm/drm_bridge.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_bridge.c +3 -0
@@ -522,6 +522,9 @@ void drm_bridge_chain_pre_enable(struct drm_bridge *bridge)list_for_each_entry_reverse (iter, &encoder->bridge_chain, chain_node) {if (iter->funcs->pre_enable) iter->funcs->pre_enable (iter); + +if (iter == bridge) +break ; } }EXPORT_SYMBOL (drm_bridge_chain_pre_enable);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 354/700 drm/amd/dc: Fix a missing check bug in dm_dp_mst_detect()
In reply to Greg Kroah-HartmanFrom: Yingjie Wang <[email protected]>
[ Upstream commit 655c0ed19772d92c9665ed08bdc5202acc096dda ]
In dm_dp_mst_detect(), We should check whether or not @connector has been unregistered from userspace. If the connector is unregistered, we should return disconnected status.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +3 -0
@@ -270,6 +270,9 @@ dm_dp_mst_detect(struct drm_connector *connector,struct amdgpu_dm_connector *aconnector =to_amdgpu_dm_connector (connector);struct amdgpu_dm_connector *master = aconnector->mst_port; +if (drm_connector_is_unregistered (connector)) +return connector_status_disconnected; +return drm_dp_mst_detect_port (connector, ctx, &master->mst_mgr, aconnector->port); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 355/700 drm/ast: Fix missing conversions to managed API
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 9ea172a9a3f4a7c5e876469509fc18ddefc7d49d ]
The commit 7cbb93d89838 ("drm/ast: Use managed pci functions") converted a few PCI accessors to the managed API and dropped the manual pci_iounmap() calls, but it seems to have forgotten converting pci_iomap() to the managed one. It resulted in the leftover resources after the driver unbind. Let's fix them.
--- drivers/gpu/drm/ast/ast_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/ast/ast_main.c +2 -2
@@ -413,7 +413,7 @@ struct ast_private *ast_device_create(const struct drm_driver *drv,pci_set_drvdata (pdev, dev); - ast->regs =pci_iomap (pdev,1 ,0 ); + ast->regs =pcim_iomap (pdev,1 ,0 );if (!ast->regs)return ERR_PTR (-EIO );
@@ -429,7 +429,7 @@ struct ast_private *ast_device_create(const struct drm_driver *drv,/* "map" IO regs if the above hasn't done so already */ if (!ast->ioregs) { - ast->ioregs =pci_iomap (pdev,2 ,0 ); + ast->ioregs =pcim_iomap (pdev,2 ,0 );if (!ast->ioregs)return ERR_PTR (-EIO ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 356/700 video: fbdev: imxfb: Fix an error message
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 767d724a160eb1cd00c86fb8c2e21fa1ab3c37ac ]
'ret' is known to be 0 here.
No error code is available, so just remove it from the error message.
--- drivers/video/fbdev/imxfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/imxfb.c +1 -1
@@ -992,7 +992,7 @@ static int imxfb_probe(struct platform_device *pdev) info->screen_buffer =dma_alloc_wc (&pdev->dev, fbi->map_size, &fbi->map_dma,GFP_KERNEL );if (!info->screen_buffer) { -dev_err (&pdev->dev,"Failed to allocate video RAM: %d\n" , ret); +dev_err (&pdev->dev,"Failed to allocate video RAM\n" ); ret = -ENOMEM ; goto failed_map; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 357/700 drm/imx: ipuv3-plane: do not advertise YUV formats on planes without CSC
In reply to Greg Kroah-HartmanFrom: Philipp Zabel <[email protected]>
[ Upstream commit 06841148c570832d4d247b0f6befc1922a84120b ]
Only planes that are displayed via the Display Processor (DP) path support color space conversion. Limit formats on planes that are shown via the direct Display Controller (DC) path to RGB.
--- drivers/gpu/drm/imx/ipuv3-plane.c | 41 ++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-)
drivers/gpu/drm/imx/ipuv3-plane.c +37 -4
@@ -35,7 +35,7 @@ static inline struct ipu_plane *to_ipu_plane(struct drm_plane *p) return container_of(p, struct ipu_plane, base); } -static const uint32_t ipu_plane_formats[] = { +static const uint32_t ipu_plane_all_formats[] = {DRM_FORMAT_ARGB1555 ,DRM_FORMAT_XRGB1555 ,DRM_FORMAT_ABGR1555 ,
@@ -72,6 +72,31 @@ static const uint32_t ipu_plane_formats[] = { DRM_FORMAT_BGRX8888_A8, }; +static const uint32_t ipu_plane_rgb_formats[] = { +DRM_FORMAT_ARGB1555 , +DRM_FORMAT_XRGB1555 , +DRM_FORMAT_ABGR1555 , +DRM_FORMAT_XBGR1555 , +DRM_FORMAT_RGBA5551 , +DRM_FORMAT_BGRA5551 , +DRM_FORMAT_ARGB4444 , +DRM_FORMAT_ARGB8888 , +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_ABGR8888 , +DRM_FORMAT_XBGR8888 , +DRM_FORMAT_RGBA8888 , +DRM_FORMAT_RGBX8888 , +DRM_FORMAT_BGRA8888 , +DRM_FORMAT_BGRX8888 , +DRM_FORMAT_RGB565 , +DRM_FORMAT_RGB565_A8 , +DRM_FORMAT_BGR565_A8 , +DRM_FORMAT_RGB888_A8 , +DRM_FORMAT_BGR888_A8 , +DRM_FORMAT_RGBX8888_A8 , +DRM_FORMAT_BGRX8888_A8 , +}; +static const uint64_t ipu_format_modifiers[] = {DRM_FORMAT_MOD_LINEAR ,DRM_FORMAT_MOD_INVALID
@@ -822,16 +847,24 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,struct ipu_plane *ipu_plane;const uint64_t *modifiers = ipu_format_modifiers;unsigned int zpos = (type ==DRM_PLANE_TYPE_PRIMARY ) ?0 :1 ; +unsigned int format_count; +const uint32_t *formats;int ret;DRM_DEBUG_KMS ("channel %d, dp flow %d, possible_crtcs=0x%x\n" , dma, dp, possible_crtcs); +if (dp ==IPU_DP_FLOW_SYNC_BG || dp ==IPU_DP_FLOW_SYNC_FG ) { + formats = ipu_plane_all_formats; + format_count =ARRAY_SIZE (ipu_plane_all_formats); + }else { + formats = ipu_plane_rgb_formats; + format_count =ARRAY_SIZE (ipu_plane_rgb_formats); + } ipu_plane = drmm_universal_plane_alloc(dev, struct ipu_plane, base, possible_crtcs, &ipu_plane_funcs, - ipu_plane_formats, -ARRAY_SIZE (ipu_plane_formats), - modifiers, type,NULL ); + formats, format_count, modifiers, + type,NULL );if (IS_ERR (ipu_plane)) {DRM_ERROR ("failed to allocate and initialize %s plane\n" , zpos ?"overlay" :"primary" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 358/700 drm/imx: ipuv3-plane: fix PRG modifiers after drm managed resource conversion
In reply to Greg Kroah-HartmanFrom: Lucas Stach <[email protected]>
[ Upstream commit 17b9a94656fe19aef3647c4f93d93be51697ceb1 ]
The conversion to drm managed resources introduced two bugs: the plane is now always initialized with the linear-only list, while the list with the Vivante GPU modifiers should have been used when the PRG/PRE engines are present. This masked another issue, as ipu_plane_format_mod_supported() is now called before the private plane data is set up, so if a non-linear modifier is supplied in the plane modifier list, we run into a NULL pointer dereference checking for the PRG presence. To fix this just remove the check from this function, as we know that it will only be called with a non-linear modifier, if the plane init code has already determined that the PRG/PRE is present.
--- drivers/gpu/drm/imx/ipuv3-plane.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/gpu/drm/imx/ipuv3-plane.c +9 -7
@@ -345,10 +345,11 @@ static bool ipu_plane_format_mod_supported(struct drm_plane *plane,if (modifier ==DRM_FORMAT_MOD_LINEAR )return true; -/* without a PRG there are no supported modifiers */ -if (!ipu_prg_present (ipu)) -return false; - +/* +* Without a PRG the possible modifiers list only includes the linear +* modifier, so we always take the early return from this function and +* only end up here if the PRG is present. +*/ return ipu_prg_format_supported (ipu, format, modifier); }
@@ -861,6 +862,10 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, formats = ipu_plane_rgb_formats; format_count =ARRAY_SIZE (ipu_plane_rgb_formats); } + +if (ipu_prg_present (ipu)) + modifiers = pre_format_modifiers; + ipu_plane = drmm_universal_plane_alloc(dev, struct ipu_plane, base, possible_crtcs, &ipu_plane_funcs, formats, format_count, modifiers,
@@ -875,9 +880,6 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, ipu_plane->dma = dma; ipu_plane->dp_flow = dp; -if (ipu_prg_present (ipu)) - modifiers = pre_format_modifiers; -drm_plane_helper_add (&ipu_plane->base, &ipu_plane_helper_funcs);if (dp ==IPU_DP_FLOW_SYNC_BG || dp ==IPU_DP_FLOW_SYNC_FG )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 359/700 net: mvpp2: Put fwnode in error case during ->probe()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 71f0891c84dfdc448736082ab0a00acd29853896 ]
In each iteration fwnode_for_each_available_child_node() bumps a reference counting of a loop variable followed by dropping in on a next iteration,
Since in error case the loop is broken, we have to drop a reference count by ourselves. Do it for port_fwnode in error case during ->probe().
--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +2 -0
@@ -7589,6 +7589,8 @@ static int mvpp2_probe(struct platform_device *pdev)return 0 ; err_port_probe: +fwnode_handle_put (port_fwnode); + i =0 ;fwnode_for_each_available_child_node (fwnode, port_fwnode) {if (priv->port_list[i])
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 360/700 net: pch_gbe: Propagate error from devm_gpio_request_one()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 9e3617a7b84512bf96c04f9cf82d1a7257d33794 ]
If GPIO controller is not available yet we need to defer the probe of GBE until provider will become available.
While here, drop GPIOF_EXPORT because it's deprecated and may not be available.
--- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +7 -3
@@ -2531,9 +2531,13 @@ static int pch_gbe_probe(struct pci_dev *pdev, adapter->pdev = pdev; adapter->hw.back = adapter; adapter->hw.reg =pcim_iomap_table (pdev)[PCH_GBE_PCI_BAR ]; + adapter->pdata = (struct pch_gbe_privdata *)pci_id->driver_data; -if (adapter->pdata && adapter->pdata->platform_init) - adapter->pdata->platform_init (pdev); +if (adapter->pdata && adapter->pdata->platform_init) { + ret = adapter->pdata->platform_init (pdev); +if (ret) + goto err_free_netdev; + } adapter->ptp_pdev = pci_get_domain_bus_and_slot(pci_domain_nr(adapter->pdev->bus),
@@ -2628,7 +2632,7 @@ err_free_netdev:*/ static int pch_gbe_minnow_platform_init (struct pci_dev *pdev) { -unsigned long flags =GPIOF_DIR_OUT |GPIOF_INIT_HIGH |GPIOF_EXPORT ; +unsigned long flags =GPIOF_OUT_INIT_HIGH ;unsigned gpio =MINNOW_PHY_RESET_GPIO ;int ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 361/700 pinctrl: renesas: r8a7796: Add missing bias for PRESET# pin
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 2cee31cd49733e89dfedf4f68a56839fc2e42040 ]
R-Car Gen3 Hardware Manual Errata for Rev. 0.52 of Nov 30, 2016, added the configuration bit for bias pull-down control for the PRESET# pin on R-Car M3-W. Add driver support for controlling pull-down on this pin.
--- drivers/pinctrl/renesas/pfc-r8a7796.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/renesas/pfc-r8a7796.c +2 -1
@@ -68,6 +68,7 @@PIN_NOGP_CFG (QSPI1_MOSI_IO0 ,"QSPI1_MOSI_IO0" , fn,CFG_FLAGS ), \PIN_NOGP_CFG (QSPI1_SPCLK ,"QSPI1_SPCLK" , fn,CFG_FLAGS ), \PIN_NOGP_CFG (QSPI1_SSL ,"QSPI1_SSL" , fn,CFG_FLAGS ), \ +PIN_NOGP_CFG (PRESET_N ,"PRESET#" , fn,SH_PFC_PIN_CFG_PULL_DOWN ),\PIN_NOGP_CFG (RPC_INT_N ,"RPC_INT#" , fn,CFG_FLAGS ), \PIN_NOGP_CFG (RPC_RESET_N ,"RPC_RESET#" , fn,CFG_FLAGS ), \ PIN_NOGP_CFG(RPC_WP_N, "RPC_WP#", fn, CFG_FLAGS), \
@@ -6191,7 +6192,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = { [ 4] = RCAR_GP_PIN(6, 29), /* USB30_OVC */ [ 5] = RCAR_GP_PIN(6, 30), /* GP6_30 */ [ 6] = RCAR_GP_PIN(6, 31), /* GP6_31 */ - [ 7] = SH_PFC_PIN_NONE, + [ 7] = PIN_PRESET_N, /* PRESET# */ [ 8] = SH_PFC_PIN_NONE, [ 9] = SH_PFC_PIN_NONE, [10] = SH_PFC_PIN_NONE,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 362/700 pinctrl: renesas: r8a77990: JTAG pins do not have pull-down capabilities
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 702a5fa2fe4d7e7f28fed92a170b540acfff9d34 ]
Hence remove the SH_PFC_PIN_CFG_PULL_DOWN flags from their pin descriptions.
--- drivers/pinctrl/renesas/pfc-r8a77990.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/renesas/pfc-r8a77990.c +4 -4
@@ -54,10 +54,10 @@PIN_NOGP_CFG (FSCLKST_N ,"FSCLKST_N" , fn,CFG_FLAGS ), \PIN_NOGP_CFG (MLB_REF ,"MLB_REF" , fn,CFG_FLAGS ), \PIN_NOGP_CFG (PRESETOUT_N ,"PRESETOUT_N" , fn,CFG_FLAGS ), \ -PIN_NOGP_CFG (TCK ,"TCK" , fn,CFG_FLAGS ), \ -PIN_NOGP_CFG (TDI ,"TDI" , fn,CFG_FLAGS ), \ -PIN_NOGP_CFG (TMS ,"TMS" , fn,CFG_FLAGS ), \ -PIN_NOGP_CFG (TRST_N ,"TRST_N" , fn,CFG_FLAGS ) +PIN_NOGP_CFG (TCK ,"TCK" , fn,SH_PFC_PIN_CFG_PULL_UP ), \ +PIN_NOGP_CFG (TDI ,"TDI" , fn,SH_PFC_PIN_CFG_PULL_UP ), \ +PIN_NOGP_CFG (TMS ,"TMS" , fn,SH_PFC_PIN_CFG_PULL_UP ), \ +PIN_NOGP_CFG (TRST_N ,"TRST_N" , fn,SH_PFC_PIN_CFG_PULL_UP )/* * F_() : just information
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 363/700 RDMA/hns: Remove the condition of light load for posting DWQE
In reply to Greg Kroah-HartmanFrom: Yixian Liu <[email protected]>
[ Upstream commit 591f762b2750c628df9412d1c795b56e83a34b3e ]
Even in the case of heavy load, direct WQE can still be posted. The hardware will decide whether to drop the DWQE or not. Thus, the limit needs to be removed.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -2
@@ -750,8 +750,7 @@ out: qp->sq.head += nreq; qp->next_sge = sge_idx; -if (nreq ==1 && qp->sq.head == qp->sq.tail +1 && - (qp->en_flags &HNS_ROCE_QP_CAP_DIRECT_WQE )) +if (nreq ==1 && (qp->en_flags &HNS_ROCE_QP_CAP_DIRECT_WQE ))write_dwqe (hr_dev, qp, wqe);else update_sq_db (hr_dev, qp);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 364/700 drm/vmwgfx: Mark a surface gpu-dirty after the SVGA3dCmdDXGenMips command
In reply to Greg Kroah-HartmanFrom: Thomas Hellstrom <[email protected]>
[ Upstream commit 75156a887b6cea6e09d83ec19f4ebfd7c86265f0 ]
The SVGA3dCmdDXGenMips command uses a shader-resource view to access the underlying surface. Normally accesses using that view-type are not dirtying the underlying surface, but that particular command is an exception.
Mark the surface gpu-dirty after a SVGA3dCmdDXGenMips command has been submitted.
This fixes the piglit getteximage-formats test run with SVGA_FORCE_COHERENT=1
--- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +16 -4
@@ -2759,12 +2759,24 @@ static int vmw_cmd_dx_genmips(struct vmw_private *dev_priv, {VMW_DECLARE_CMD_VAR (*cmd, SVGA3dCmdDXGenMips) =container_of (header,typeof (*cmd), header); -struct vmw_resource *ret; +struct vmw_resource *view; +struct vmw_res_cache_entry *rcache; - ret =vmw_view_id_val_add (sw_context, vmw_view_sr, - cmd->body.shaderResourceViewId); + view =vmw_view_id_val_add (sw_context, vmw_view_sr, + cmd->body.shaderResourceViewId); +if (IS_ERR (view)) +return PTR_ERR (view); -return PTR_ERR_OR_ZERO (ret); +/* +* Normally the shader-resource view is not gpu-dirtying, but for +* this particular command it is... +* So mark the last looked-up surface, which is the surface +* the view points to, gpu-dirty. +*/ + rcache = &sw_context->res_cache[vmw_res_surface]; +vmw_validation_res_set_dirty (sw_context->ctx, rcache->private, +VMW_RES_DIRTY_SET ); +return 0 ; }/**
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 365/700 drm/vmwgfx: Fix cpu updates of coherent multisample surfaces
In reply to Greg Kroah-HartmanFrom: Thomas Hellstrom <[email protected]>
[ Upstream commit 88509f698c4e38e287e016e86a0445547824135c ]
In cases where the dirty linear memory range spans multiple sample sheets in a surface, the dirty surface region is incorrectly computed. To do this correctly and in an optimized fashion we would have to compute the dirty region of each sample sheet and compute the union of those regions.
But assuming that cpu writing to a multisample surface is rather a corner case than a common case, just set the dirty region to the full surface.
This fixes OpenGL piglit errors with SVGA_FORCE_COHERENT=1 and the piglit test:
fbo-depthstencil blit default_fb -samples=2 -auto
--- .../drm/vmwgfx/device_include/svga3d_surfacedefs.h | 8 ++++++-- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 13 +++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/device_include/svga3d_surfacedefs.h +6 -2
@@ -1467,6 +1467,7 @@ struct svga3dsurface_cache {/** * struct svga3dsurface_loc - Surface location +* @sheet: The multisample sheet. * @sub_resource: Surface subresource. Defined as layer * num_mip_levels + * mip_level. * @x: X coordinate.
@@ -1474,6 +1475,7 @@ struct svga3dsurface_cache {* @z: Z coordinate. */ struct svga3dsurface_loc { +u32 sheet;u32 sub_resource;u32 x, y, z; };
@@ -1566,8 +1568,8 @@ svga3dsurface_get_loc(const struct svga3dsurface_cache *cache,u32 layer;int i; -if (offset >= cache->sheet_bytes) - offset %= cache->sheet_bytes; + loc->sheet = offset / cache->sheet_bytes; + offset -= loc->sheet * cache->sheet_bytes; layer = offset / cache->mip_chain_bytes; offset -= layer * cache->mip_chain_bytes;
@@ -1631,6 +1633,7 @@ svga3dsurface_min_loc(const struct svga3dsurface_cache *cache,u32 sub_resource, struct svga3dsurface_loc *loc) { + loc->sheet = 0; loc->sub_resource = sub_resource; loc->x = loc->y = loc->z =0 ; }
@@ -1652,6 +1655,7 @@ svga3dsurface_max_loc(const struct svga3dsurface_cache *cache,const struct drm_vmw_size *size;u32 mip; + loc->sheet =0 ; loc->sub_resource = sub_resource +1 ; mip = sub_resource % cache->num_mip_levels; size = &cache->mip[mip].size;
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +13 -0
@@ -1801,6 +1801,19 @@ static void vmw_surface_tex_dirty_range_add(struct vmw_resource *res,svga3dsurface_get_loc (cache, &loc2, end -1 );svga3dsurface_inc_loc (cache, &loc2); +if (loc1.sheet != loc2.sheet) { +u32 sub_res; + +/* +* Multiple multisample sheets. To do this in an optimized +* fashion, compute the dirty region for each sheet and the +* resulting union. Since this is not a common case, just dirty +* the whole surface. +*/ +for (sub_res =0 ; sub_res < dirty->num_subres; ++sub_res) +vmw_subres_dirty_full (dirty, sub_res); +return ; + }if (loc1.sub_resource +1 == loc2.sub_resource) {/* Dirty range covers a single sub-resource */ vmw_subres_dirty_add (dirty, &loc1, &loc2);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 366/700 net: qrtr: ns: Fix error return code in qrtr_ns_init()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit a49e72b3bda73d36664a084e47da9727a31b8095 ]
Fix to return a negative error code -ENOMEM from the error handling case instead of 0, as done elsewhere in this function.
--- net/qrtr/ns.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/qrtr/ns.c +3 -1
@@ -775,8 +775,10 @@ int qrtr_ns_init(void) } qrtr_ns.workqueue =alloc_workqueue ("qrtr_ns_handler" ,WQ_UNBOUND ,1 ); -if (!qrtr_ns.workqueue) +if (!qrtr_ns.workqueue) { + ret = -ENOMEM ; goto err_sock; + } qrtr_ns.sock->sk->sk_data_ready = qrtr_ns_data_ready;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 367/700 clk: meson: g12a: fix gp0 and hifi ranges
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit bc794f8c56abddf709f1f84fcb2a3c9e7d9cc9b4 ]
While some SoC samples are able to lock with a PLL factor of 55, others samples can't. ATM, a minimum of 60 appears to work on all the samples I have tried.
Even with 60, it sometimes takes a long time for the PLL to eventually lock. The documentation says that the minimum rate of these PLLs DCO should be 3GHz, a factor of 125. Let's use that to be on the safe side.
With factor range changed, the PLL seems to lock quickly (enough) so far. It is still unclear if the range was the only reason for the delay.
--- drivers/clk/meson/g12a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/g12a.c +1 -1
@@ -1603,7 +1603,7 @@ static struct clk_regmap g12b_cpub_clk_trace = { };static const struct pll_mult_range g12a_gp0_pll_mult_range = { - .min =55 , + .min =125 , .max =255 , };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 368/700 drm/amd/display: fix potential gpu reset deadlock
In reply to Greg Kroah-HartmanFrom: Roman Li <[email protected]>
[ Upstream commit cf8b92a75646735136053ce51107bfa8cfc23191 ]
[Why]
In gpu reset dc_lock acquired in dm_suspend(). Asynchronously handle_hpd_rx_irq can also be called through amdgpu_dm_irq_suspend->flush_work, which also tries to acquire dc_lock. That causes a deadlock.
[How]
Check if amdgpu executing reset before acquiring dc_lock.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -2
@@ -2624,13 +2624,15 @@ static void handle_hpd_rx_irq(void *param) } } -mutex_lock (&adev->dm.dc_lock); +if (!amdgpu_in_reset (adev)) +mutex_lock (&adev->dm.dc_lock);#ifdef CONFIG_DRM_AMD_DC_HDCP result =dc_link_handle_hpd_rx_irq (dc_link, &hpd_irq_data,NULL );#else result =dc_link_handle_hpd_rx_irq (dc_link,NULL ,NULL );#endif -mutex_unlock (&adev->dm.dc_lock); +if (!amdgpu_in_reset (adev)) +mutex_unlock (&adev->dm.dc_lock); out:if (result && !is_mst_root_connector) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 369/700 drm/amd/display: Avoid HPD IRQ in GPU reset state
In reply to Greg Kroah-HartmanFrom: Zhan Liu <[email protected]>
[ Upstream commit 509b9a5b4865dee723296f143695a7774fc96c4a ]
[Why]
If GPU is in reset state, force enabling link will cause unexpected behaviour.
[How]
Avoid handling HPD IRQ when GPU is in reset state.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -2
@@ -2624,15 +2624,15 @@ static void handle_hpd_rx_irq(void *param) } } -if (!amdgpu_in_reset (adev)) +if (!amdgpu_in_reset (adev)) {mutex_lock (&adev->dm.dc_lock);#ifdef CONFIG_DRM_AMD_DC_HDCP result =dc_link_handle_hpd_rx_irq (dc_link, &hpd_irq_data,NULL );#else result =dc_link_handle_hpd_rx_irq (dc_link,NULL ,NULL );#endif -if (!amdgpu_in_reset (adev))mutex_unlock (&adev->dm.dc_lock); + } out:if (result && !is_mst_root_connector) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 370/700 drm/amd/display: take dc_lock in short pulse handler only
In reply to Greg Kroah-HartmanFrom: Aurabindo Pillai <[email protected]>
[ Upstream commit d2aa1356834d845ffdac0d8c01b58aa60d1bdc65 ]
[Why]
Conditions that end up modifying the global dc state must be locked. However, during mst allocate payload sequence, lock is already taken. With StarTech 1.2 DP hub, we get an HPD RX interrupt for a reason other than to indicate down reply availability right after sending payload allocation. The handler again takes dc lock before calling the dc's HPD RX handler. Due to this contention, the DRM thread which waits for MST down reply never gets a chance to finish its waiting successfully and ends up timing out. Once the lock is released, the hpd rx handler fires and goes ahead to read from the MST HUB, but now its too late and the HUB doesnt lightup all displays since DRM lacks error handling when payload allocation fails.
[How]
Take lock only if there is a change in link status or if automated test pattern bit is set. The latter fixes the null pointer dereference when running certain DP Link Layer Compliance test.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 19 +++++++++++++++++-- .../gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +- .../gpu/drm/amd/display/dc/inc/dc_link_dp.h | 4 ++++ 3 files changed, 22 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +17 -2
@@ -28,6 +28,7 @@#include "dm_services_types.h" #include "dc.h" +#include "dc_link_dp.h" #include "dc/inc/core_types.h" #include "dal_asic_id.h" #include "dmub/dmub_srv.h"
@@ -2598,6 +2599,7 @@ static void handle_hpd_rx_irq(void *param)enum dc_connection_type new_connection_type = dc_connection_none;struct amdgpu_device *adev =drm_to_adev (dev);union hpd_irq_data hpd_irq_data; +bool lock_flag =0 ;memset (&hpd_irq_data,0 ,sizeof (hpd_irq_data));
@@ -2624,15 +2626,28 @@ static void handle_hpd_rx_irq(void *param) } } -if (!amdgpu_in_reset (adev)) { +/* +* TODO: We need the lock to avoid touching DC state while it's being +* modified during automated compliance testing, or when link loss +* happens. While this should be split into subhandlers and proper +* interfaces to avoid having to conditionally lock like this in the +* outer layer, we need this workaround temporarily to allow MST +* lightup in some scenarios to avoid timeout. +*/ +if (!amdgpu_in_reset (adev) && + (hpd_rx_irq_check_link_loss_status (dc_link, &hpd_irq_data) || + hpd_irq_data.bytes.device_service_irq.bits.AUTOMATED_TEST)) {mutex_lock (&adev->dm.dc_lock); + lock_flag =1 ; + } +#ifdef CONFIG_DRM_AMD_DC_HDCP result =dc_link_handle_hpd_rx_irq (dc_link, &hpd_irq_data,NULL );#else result =dc_link_handle_hpd_rx_irq (dc_link,NULL ,NULL );#endif +if (!amdgpu_in_reset (adev) && lock_flag)mutex_unlock (&adev->dm.dc_lock); - } out:if (result && !is_mst_root_connector) {
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
@@ -1918,7 +1918,7 @@ enum dc_status read_hpd_rx_irq_data(return retval; } -static bool hpd_rx_irq_check_link_loss_status ( +bool hpd_rx_irq_check_link_loss_status (struct dc_link *link,union hpd_irq_data *hpd_irq_dpcd_data) {
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +4 -0
@@ -63,6 +63,10 @@ bool perform_link_training_with_retries(struct pipe_ctx *pipe_ctx, enum signal_type signal); +bool hpd_rx_irq_check_link_loss_status ( +struct dc_link *link, +union hpd_irq_data *hpd_irq_dpcd_data); +bool is_mst_supported (struct dc_link *link);bool detect_dp_sink_caps (struct dc_link *link);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 371/700 net: ftgmac100: add missing error return code in ftgmac100_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 52af13a41489d7bbc1932d17583eff6e5fffc820 ]
The variables will be free on path err_phy_connect, it should return error code, or it will cause double free when calling ftgmac100_remove().
--- drivers/net/ethernet/faraday/ftgmac100.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/faraday/ftgmac100.c +5 -1
@@ -1830,14 +1830,17 @@ static int ftgmac100_probe(struct platform_device *pdev)if (np &&of_get_property (np,"use-ncsi" ,NULL )) {if (!IS_ENABLED (CONFIG_NET_NCSI )) {dev_err (&pdev->dev,"NCSI stack not enabled\n" ); + err = -EINVAL ; goto err_phy_connect; }dev_info (&pdev->dev,"Using NCSI interface\n" ); priv->use_ncsi = true; priv->ndev =ncsi_register_dev (netdev, ftgmac100_ncsi_handler); -if (!priv->ndev) +if (!priv->ndev) { + err = -EINVAL ; goto err_phy_connect; + } }else if (np &&of_get_property (np,"phy-handle" ,NULL )) {struct phy_device *phy;
@@ -1856,6 +1859,7 @@ static int ftgmac100_probe(struct platform_device *pdev) &ftgmac100_adjust_link);if (!phy) {dev_err (&pdev->dev,"Failed to connect to phy\n" ); + err = -EINVAL ; goto err_phy_connect; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 372/700 drm/vc4: crtc: Pass the drm_atomic_state to config_pv
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit c6883985d46319e0d4f159de8932b09ff93e877d ]
The vc4_crtc_config_pv will need to access the drm_atomic_state structure and its only parent function, vc4_crtc_atomic_enable already has access to it. Let's pass it as a parameter.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/vc4/vc4_crtc.c +4 -4
@@ -305,7 +305,7 @@ static void vc4_crtc_pixelvalve_reset(struct drm_crtc *crtc)CRTC_WRITE (PV_CONTROL ,CRTC_READ (PV_CONTROL ) |PV_CONTROL_FIFO_CLR ); } -static void vc4_crtc_config_pv (struct drm_crtc *crtc) +static void vc4_crtc_config_pv (struct drm_crtc *crtc,struct drm_atomic_state *state) {struct drm_device *dev = crtc->dev;struct vc4_dev *vc4 =to_vc4_dev (dev);
@@ -313,8 +313,8 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc)struct vc4_encoder *vc4_encoder =to_vc4_encoder (encoder);struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc);const struct vc4_pv_data *pv_data =vc4_crtc_to_vc4_pv_data (vc4_crtc); -struct drm_crtc_state *state = crtc->state; -struct drm_display_mode *mode = &state->adjusted_mode; +struct drm_crtc_state *crtc_state = crtc->state; +struct drm_display_mode *mode = &crtc_state->adjusted_mode;bool interlace = mode->flags &DRM_MODE_FLAG_INTERLACE ;u32 pixel_rep = (mode->flags &DRM_MODE_FLAG_DBLCLK ) ?2 :1 ; bool is_dsi = (vc4_encoder->type == VC4_ENCODER_TYPE_DSI0 ||
@@ -539,7 +539,7 @@ static void vc4_crtc_atomic_enable(struct drm_crtc *crtc,if (vc4_encoder->pre_crtc_configure) vc4_encoder->pre_crtc_configure (encoder, state); -vc4_crtc_config_pv (crtc); +vc4_crtc_config_pv (crtc, state);CRTC_WRITE (PV_CONTROL ,CRTC_READ (PV_CONTROL ) |PV_CONTROL_EN );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 373/700 drm/vc4: crtc: Fix vc4_get_crtc_encoder logic
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 5a184d959d5a5a66b377cb5cd4c95a80388e0c88 ]
The vc4_get_crtc_encoder function currently only works when the connector->state->crtc pointer is set, which is only true when the connector is currently enabled.
However, we use it as part of the disable path as well, and our lookup will fail in that case, resulting in it returning a null pointer we can't act on.
We can access the connector that used to be connected to that crtc though using the old connector state in the disable path.
Since we want to support both the enable and disable path, we can support it by passing the state accessor variant as a function pointer, together with the atomic state.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/gpu/drm/vc4/vc4_crtc.c +16 -5
@@ -279,14 +279,22 @@ static u32 vc4_crtc_get_fifo_full_level_bits(struct vc4_crtc *vc4_crtc,* allows drivers to push pixels to more than one encoder from the * same CRTC. */ -static struct drm_encoder *vc4_get_crtc_encoder (struct drm_crtc *crtc) +static struct drm_encoder *vc4_get_crtc_encoder (struct drm_crtc *crtc, +struct drm_atomic_state *state, +struct drm_connector_state *(*get_state)(struct drm_atomic_state *state, +struct drm_connector *connector)) {struct drm_connector *connector;struct drm_connector_list_iter conn_iter;drm_connector_list_iter_begin (crtc->dev, &conn_iter);drm_for_each_connector_iter (connector, &conn_iter) { -if (connector->state->crtc == crtc) { +struct drm_connector_state *conn_state =get_state (state, connector); + +if (!conn_state) +continue ; + +if (conn_state->crtc == crtc) {drm_connector_list_iter_end (&conn_iter);return connector->encoder; }
@@ -309,7 +317,8 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, struct drm_atomic_state *s {struct drm_device *dev = crtc->dev;struct vc4_dev *vc4 =to_vc4_dev (dev); -struct drm_encoder *encoder =vc4_get_crtc_encoder (crtc); +struct drm_encoder *encoder =vc4_get_crtc_encoder (crtc, state, + drm_atomic_get_new_connector_state);struct vc4_encoder *vc4_encoder =to_vc4_encoder (encoder);struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc);const struct vc4_pv_data *pv_data =vc4_crtc_to_vc4_pv_data (vc4_crtc);
@@ -424,7 +433,8 @@ static int vc4_crtc_disable(struct drm_crtc *crtc, struct drm_atomic_state *state, unsigned int channel) { -struct drm_encoder *encoder =vc4_get_crtc_encoder (crtc); +struct drm_encoder *encoder =vc4_get_crtc_encoder (crtc, state, + drm_atomic_get_old_connector_state);struct vc4_encoder *vc4_encoder =to_vc4_encoder (encoder);struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc);struct drm_device *dev = crtc->dev;
@@ -524,7 +534,8 @@ static void vc4_crtc_atomic_enable(struct drm_crtc *crtc, {struct drm_device *dev = crtc->dev;struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc); -struct drm_encoder *encoder =vc4_get_crtc_encoder (crtc); +struct drm_encoder *encoder =vc4_get_crtc_encoder (crtc, state, + drm_atomic_get_new_connector_state);struct vc4_encoder *vc4_encoder =to_vc4_encoder (encoder);require_hvs_enabled (dev);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 374/700 drm/vc4: crtc: Lookup the encoder from the register at boot
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit b601c16b7ba8f3bb7a7e773b238da6b63657fa1d ]
At boot, we can't rely on the vc4_get_crtc_encoder since we don't have a state yet and thus will not be able to figure out which connector is attached to our CRTC.
However, we have a muxing bit in the CRTC register we can use to get the encoder currently connected to the pixelvalve. We can thus read that register, lookup the associated register through the vc4_pv_data structure, and then pass it to vc4_crtc_disable so that we can perform the proper operations.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 38 ++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-)
drivers/gpu/drm/vc4/vc4_crtc.c +34 -4
@@ -430,11 +430,10 @@ static void require_hvs_enabled(struct drm_device *dev) }static int vc4_crtc_disable (struct drm_crtc *crtc, +struct drm_encoder *encoder,struct drm_atomic_state *state,unsigned int channel) { -struct drm_encoder *encoder =vc4_get_crtc_encoder (crtc, state, - drm_atomic_get_old_connector_state);struct vc4_encoder *vc4_encoder =to_vc4_encoder (encoder);struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc);struct drm_device *dev = crtc->dev;
@@ -475,10 +474,29 @@ static int vc4_crtc_disable(struct drm_crtc *crtc,return 0 ; } +static struct drm_encoder *vc4_crtc_get_encoder_by_type (struct drm_crtc *crtc, +enum vc4_encoder_type type) +{ +struct drm_encoder *encoder; + +drm_for_each_encoder (encoder, crtc->dev) { +struct vc4_encoder *vc4_encoder =to_vc4_encoder (encoder); + +if (vc4_encoder->type == type) +return encoder; + } + +return NULL ; +} +int vc4_crtc_disable_at_boot (struct drm_crtc *crtc) {struct drm_device *drm = crtc->dev;struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc); +enum vc4_encoder_type encoder_type; +const struct vc4_pv_data *pv_data; +struct drm_encoder *encoder; +unsigned encoder_sel;int channel; if (!(of_device_is_compatible(vc4_crtc->pdev->dev.of_node,
@@ -497,7 +515,17 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc)if (channel <0 )return 0 ; -return vc4_crtc_disable (crtc,NULL , channel); + encoder_sel =VC4_GET_FIELD (CRTC_READ (PV_CONTROL ),PV_CONTROL_CLK_SELECT ); +if (WARN_ON (encoder_sel !=0 )) +return 0 ; + + pv_data =vc4_crtc_to_vc4_pv_data (vc4_crtc); + encoder_type = pv_data->encoder_types[encoder_sel]; + encoder =vc4_crtc_get_encoder_by_type (crtc, encoder_type); +if (WARN_ON (!encoder)) +return 0 ; + +return vc4_crtc_disable (crtc, encoder,NULL , channel); } static void vc4_crtc_atomic_disable(struct drm_crtc *crtc,
@@ -506,6 +534,8 @@ static void vc4_crtc_atomic_disable(struct drm_crtc *crtc,struct drm_crtc_state *old_state =drm_atomic_get_old_crtc_state (state, crtc);struct vc4_crtc_state *old_vc4_state =to_vc4_crtc_state (old_state); +struct drm_encoder *encoder =vc4_get_crtc_encoder (crtc, state, + drm_atomic_get_old_connector_state);struct drm_device *dev = crtc->dev;require_hvs_enabled (dev);
@@ -513,7 +543,7 @@ static void vc4_crtc_atomic_disable(struct drm_crtc *crtc,/* Disable vblank irq handling before crtc is disabled. */ drm_crtc_vblank_off (crtc); -vc4_crtc_disable (crtc, state, old_vc4_state->assigned_channel); +vc4_crtc_disable (crtc, encoder, state, old_vc4_state->assigned_channel);/* * Make sure we issue a vblank event after disabling the CRTC if
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 375/700 drm: rockchip: set alpha_en to 0 if it is not used
In reply to Greg Kroah-HartmanFrom: Alex Bee <[email protected]>
[ Upstream commit 046e0db975695540c9d9898cdbf0b60533d28afb ]
alpha_en should be set to 0 if it is not used, i.e. to disable alpha blending if it was enabled before and should be disabled now.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1 -0
@@ -1013,6 +1013,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,VOP_WIN_SET (vop, win, alpha_en,1 ); }else {VOP_WIN_SET (vop, win, src_alpha_ctl,SRC_ALPHA_EN (0 )); +VOP_WIN_SET (vop, win, alpha_en,0 ); }VOP_WIN_SET (vop, win, enable,1 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 376/700 drm/rockchip: cdn-dp-core: add missing clk_disable_unprepare() on error in cdn_dp_grf_write()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit ae41d925c75b53798f289c69ee8d9f7d36432f6d ]
After calling clk_prepare_enable(), clk_disable_unprepare() need be called when calling regmap_write() failed.
--- drivers/gpu/drm/rockchip/cdn-dp-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/rockchip/cdn-dp-core.c +1 -0
@@ -73,6 +73,7 @@ static int cdn_dp_grf_write(struct cdn_dp_device *dp, ret =regmap_write (dp->grf, reg, val);if (ret) {DRM_DEV_ERROR (dp->dev,"Could not write to GRF: %d\n" , ret); +clk_disable_unprepare (dp->grf_clk);return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 377/700 drm/rockchip: dsi: move all lane config except LCDC mux to bind()
In reply to Greg Kroah-HartmanFrom: Thomas Hebb <[email protected]>
[ Upstream commit 43c2de1002d2b70fb5941fa14e97a34e3dc214d4 ]
When we first enable the DSI encoder, we currently program some per-chip configuration that we look up in rk3399_chip_data based on the device tree compatible we match. This data configures various parameters of the MIPI lanes, including on RK3399 whether DSI1 is slaved to DSI0 in a dual-mode configuration. It also selects which LCDC (i.e. VOP) to scan out from.
This causes a problem in RK3399 dual-mode configurations, though: panel prepare() callbacks run before the encoder gets enabled and expect to be able to write commands to the DSI bus, but the bus isn't fully functional until the lane and master/slave configuration have been programmed. As a result, dual-mode panels (and possibly others too) fail to turn on when the rockchipdrm driver is initially loaded.
Because the LCDC mux is the only thing we don't know until enable time (and is the only thing that can ever change), we can actually move most of the initialization to bind() and get it out of the way early. That's what this change does. (Rockchip's 4.4 BSP kernel does it in mode_set(), which also avoids the issue, but bind() seems like the more correct place to me.)
Tested on a Google Scarlet board (Acer Chromebook Tab 10), which has a Kingdisplay KD097D04 dual-mode panel. Prior to this change, the panel's backlight would turn on but no image would appear when initially loading rockchipdrm. If I kept rockchipdrm loaded and reloaded the panel driver, it would come on. With this change, the panel successfully turns on during initial rockchipdrm load as expected.
--- .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-)
drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +28 -8
@@ -692,13 +692,8 @@ static const struct dw_mipi_dsi_phy_ops dw_mipi_dsi_rockchip_phy_ops = { .get_timing = dw_mipi_dsi_phy_get_timing, }; -static void dw_mipi_dsi_rockchip_config (struct dw_mipi_dsi_rockchip *dsi, -int mux) +static void dw_mipi_dsi_rockchip_config (struct dw_mipi_dsi_rockchip *dsi) { -if (dsi->cdata->lcdsel_grf_reg) -regmap_write (dsi->grf_regmap, dsi->cdata->lcdsel_grf_reg, - mux ? dsi->cdata->lcdsel_lit : dsi->cdata->lcdsel_big); -if (dsi->cdata->lanecfg1_grf_reg)regmap_write (dsi->grf_regmap, dsi->cdata->lanecfg1_grf_reg, dsi->cdata->lanecfg1);
@@ -712,6 +707,13 @@ static void dw_mipi_dsi_rockchip_config(struct dw_mipi_dsi_rockchip *dsi, dsi->cdata->enable); } +static void dw_mipi_dsi_rockchip_set_lcdsel (struct dw_mipi_dsi_rockchip *dsi, +int mux) +{ +regmap_write (dsi->grf_regmap, dsi->cdata->lcdsel_grf_reg, + mux ? dsi->cdata->lcdsel_lit : dsi->cdata->lcdsel_big); +} + static int dw_mipi_dsi_encoder_atomic_check(struct drm_encoder *encoder, struct drm_crtc_state *crtc_state,
@@ -767,9 +769,9 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder *encoder)return ; } -dw_mipi_dsi_rockchip_config (dsi, mux); +dw_mipi_dsi_rockchip_set_lcdsel (dsi, mux);if (dsi->slave) -dw_mipi_dsi_rockchip_config (dsi->slave, mux); +dw_mipi_dsi_rockchip_set_lcdsel (dsi->slave, mux);clk_disable_unprepare (dsi->grf_clk); }
@@ -923,6 +925,24 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev,return ret; } +/* +* With the GRF clock running, write lane and dual-mode configurations +* that won't change immediately. If we waited until enable() to do +* this, things like panel preparation would not be able to send +* commands over DSI. +*/ + ret =clk_prepare_enable (dsi->grf_clk); +if (ret) { +DRM_DEV_ERROR (dsi->dev,"Failed to enable grf_clk: %d\n" , ret); +return ret; + } + +dw_mipi_dsi_rockchip_config (dsi); +if (dsi->slave) +dw_mipi_dsi_rockchip_config (dsi->slave); + +clk_disable_unprepare (dsi->grf_clk); + ret =rockchip_dsi_drm_create_encoder (dsi, drm_dev);if (ret) {DRM_DEV_ERROR (dev,"Failed to create drm encoder\n" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 378/700 drm/rockchip: lvds: Fix an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 3dfa159f6b0c054eb63673fbf643a5f2cc862e63 ]
'ret' is know to be 0 a this point. Checking the return value of 'phy_init()' and 'phy_set_mode()' was intended instead.
So add the missing assignments.
--- drivers/gpu/drm/rockchip/rockchip_lvds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/rockchip_lvds.c +2 -2
@@ -499,11 +499,11 @@ static int px30_lvds_probe(struct platform_device *pdev,if (IS_ERR (lvds->dphy))return PTR_ERR (lvds->dphy); -phy_init (lvds->dphy); + ret =phy_init (lvds->dphy);if (ret)return ret; -phy_set_mode (lvds->dphy,PHY_MODE_LVDS ); + ret =phy_set_mode (lvds->dphy,PHY_MODE_LVDS );if (ret)return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 379/700 drm/rockchip: cdn-dp: fix sign extension on an int multiply for a u64 result
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit ce0cb93a5adb283f577cd4661f511047b5e39028 ]
The variable bit_per_pix is a u8 and is promoted in the multiplication to an int type and then sign extended to a u64. If the result of the int multiplication is greater than 0x7fffffff then the upper 32 bits will be set to 1 as a result of the sign extension. Avoid this by casting tu_size_reg to u64 to avoid sign extension and also a potential overflow.
--- drivers/gpu/drm/rockchip/cdn-dp-reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/rockchip/cdn-dp-reg.c +1 -1
@@ -658,7 +658,7 @@ int cdn_dp_config_video(struct cdn_dp_device *dp)*/ do { tu_size_reg += 2; - symbol = tu_size_reg * mode->clock * bit_per_pix; + symbol = (u64)tu_size_reg * mode->clock * bit_per_pix; do_div(symbol, dp->max_lanes * link_rate * 8); rem = do_div(symbol, 1000); if (tu_size_reg > 64) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 380/700 mptcp: fix pr_debug in mptcp_token_new_connect
In reply to Greg Kroah-HartmanFrom: Jianguo Wu <[email protected]>
[ Upstream commit 2f1af441fd5dd5caf0807bb19ce9bbf9325ce534 ]
After commit 2c5ebd001d4f ("mptcp: refactor token container"), pr_debug() is called before mptcp_crypto_key_gen_sha() in mptcp_token_new_connect(), so the output local_key, token and idsn are 0, like:
MPTCP: ssk=00000000f6b3c4a2, local_key=0, token=0, idsn=0
Move pr_debug() after mptcp_crypto_key_gen_sha().
--- net/mptcp/token.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/mptcp/token.c +3 -3
@@ -156,9 +156,6 @@ int mptcp_token_new_connect(struct sock *sk)int retries =TOKEN_MAX_RETRIES ;struct token_bucket *bucket; -pr_debug ("ssk=%p, local_key=%llu, token=%u, idsn=%llu\n" , - sk, subflow->local_key, subflow->token, subflow->idsn); - again:mptcp_crypto_key_gen_sha (&subflow->local_key, &subflow->token, &subflow->idsn);
@@ -172,6 +169,9 @@ again: goto again; } +pr_debug ("ssk=%p, local_key=%llu, token=%u, idsn=%llu\n" , + sk, subflow->local_key, subflow->token, subflow->idsn); +WRITE_ONCE (msk->token, subflow->token);__sk_nulls_add_node_rcu ((struct sock *)msk, &bucket->msk_chain); bucket->chain_len++;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 381/700 mptcp: generate subflow hmac after mptcp_finish_join()
In reply to Greg Kroah-HartmanFrom: Jianguo Wu <[email protected]>
[ Upstream commit 0a4d8e96e4fd687af92b961d5cdcea0fdbde05fe ]
For outgoing subflow join, when recv SYNACK, in subflow_finish_connect(), the mptcp_finish_join() may return false in some cases, and send a RESET to remote, and no local hmac is required.
So generate subflow hmac after mptcp_finish_join().
--- net/mptcp/subflow.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/mptcp/subflow.c +3 -3
@@ -409,15 +409,15 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) goto do_reset; } +if (!mptcp_finish_join (sk)) + goto do_reset; +subflow_generate_hmac (subflow->local_key, subflow->remote_key, subflow->local_nonce, subflow->remote_nonce, hmac);memcpy (subflow->hmac, hmac,MPTCPOPT_HMAC_LEN ); -if (!mptcp_finish_join (sk)) - goto do_reset; - subflow->mp_join =1 ;MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_JOINSYNACKRX );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 382/700 RDMA/srp: Fix a recently introduced memory leak
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 7ec2e27a3afff64c96bfe7a77685c33619db84be ]
Only allocate a memory registration list if it will be used and if it will be freed.
--- drivers/infiniband/ulp/srp/ib_srp.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +6 -7
@@ -998,7 +998,6 @@ static int srp_alloc_req_data(struct srp_rdma_ch *ch)struct srp_device *srp_dev = target->srp_host->srp_dev;struct ib_device *ibdev = srp_dev->dev;struct srp_request *req; -void *mr_list;dma_addr_t dma_addr;int i, ret = -ENOMEM ;
@@ -1009,12 +1008,12 @@ static int srp_alloc_req_data(struct srp_rdma_ch *ch)for (i =0 ; i < target->req_ring_size; ++i) { req = &ch->req_ring[i]; - mr_list =kmalloc_array (target->mr_per_cmd,sizeof (void *), -GFP_KERNEL ); -if (!mr_list) - goto out; -if (srp_dev->use_fast_reg) - req->fr_list = mr_list; +if (srp_dev->use_fast_reg) { + req->fr_list =kmalloc_array (target->mr_per_cmd, +sizeof (void *),GFP_KERNEL ); +if (!req->fr_list) + goto out; + } req->indirect_desc =kmalloc (target->indirect_size,GFP_KERNEL );if (!req->indirect_desc) goto out;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 383/700 RDMA/rtrs-clt: Check state of the rtrs_clt_sess before reading its stats
In reply to Greg Kroah-HartmanFrom: Md Haris Iqbal <[email protected]>
[ Upstream commit 41db63a7efe1c8c2dd282c1849a6ebfbbedbaf67 ]
When get_next_path_min_inflight is called to select the next path, it iterates over the list of available rtrs_clt_sess (paths). It then reads the number of inflight IOs for that path to select one which has the least inflight IO.
But it may so happen that rtrs_clt_sess (path) is no longer in the connected state because closing or error recovery paths can change the status of the rtrs_clt_Sess.
For example, the client sent the heart-beat and did not get the response, it would change the session status and stop IO processing. The added checking of this patch can prevent accessing the broken path and generating duplicated error messages.
It is ok if the status is changed after checking the status because the error recovery path does not free memory and only tries to reconnection. And also it is ok if the session is closed after checking the status because closing the session changes the session status and flush all IO beforing free memory. If the session is being accessed for IO processing, the closing session will wait.
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +3 -0
@@ -805,6 +805,9 @@ static struct rtrs_clt_sess *get_next_path_min_inflight(struct path_it *it)int inflight;list_for_each_entry_rcu (sess, &clt->paths_list, s.entry) { +if (unlikely (READ_ONCE (sess->state) !=RTRS_CLT_CONNECTED )) +continue ; +if (unlikely (!list_empty (raw_cpu_ptr (sess->mp_skip_entry))))continue ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 384/700 RDMA/rtrs: Do not reset hb_missed_max after re-connection
In reply to Greg Kroah-HartmanFrom: Gioh Kim <[email protected]>
[ Upstream commit 64bce1ee978491a779eb31098b21c57d4e431d6a ]
When re-connecting, it resets hb_missed_max to 0. Before the first re-connecting, client will trigger re-connection when it gets hb-ack more than 5 times. But after the first re-connecting, clients will do re-connection whenever it does not get hb-ack because hb_missed_max is 0.
There is no need to reset hb_missed_max when re-connecting. hb_missed_max should be kept until closing the session.
--- drivers/infiniband/ulp/rtrs/rtrs.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/ulp/rtrs/rtrs.c +0 -1
@@ -373,7 +373,6 @@ void rtrs_stop_hb(struct rtrs_sess *sess) {cancel_delayed_work_sync (&sess->hb_dwork); sess->hb_missed_cnt =0 ; - sess->hb_missed_max =0 ; }EXPORT_SYMBOL_GPL (rtrs_stop_hb);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 385/700 RDMA/rtrs-srv: Fix memory leak of unfreed rtrs_srv_stats object
In reply to Greg Kroah-HartmanFrom: Gioh Kim <[email protected]>
[ Upstream commit 2371c40354509746e4a4dad09a752e027a30f148 ]
When closing a session, currently the rtrs_srv_stats object in the closing session is freed by kobject release. But if it failed to create a session by various reasons, it must free the rtrs_srv_stats object directly because kobject is not created yet.
This problem is found by kmemleak as below:
1. One client machine maps /dev/nullb0 with session name 'bla':
root@test1:~# echo "sessname=bla path=ip:192.168.122.190 \ device_path=/dev/nullb0" > /sys/devices/virtual/rnbd-client/ctl/map_device
2. Another machine failed to create a session with the same name 'bla':
root@test2:~# echo "sessname=bla path=ip:192.168.122.190 \ device_path=/dev/nullb1" > /sys/devices/virtual/rnbd-client/ctl/map_device -bash: echo: write error: Connection reset by peer
3. The kmemleak on server machine reported an error:
unreferenced object 0xffff888033cdc800 (size 128):
comm "kworker/2:1", pid 83, jiffies 4295086585 (age 2508.680s) hex dump (first 32 bytes):
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 ................
backtrace:
[<00000000a72903b2>] __alloc_sess+0x1d4/0x1250 [rtrs_server]
[<00000000d1e5321e>] rtrs_srv_rdma_cm_handler+0xc31/0xde0 [rtrs_server]
[<00000000bb2f6e7e>] cma_ib_req_handler+0xdc5/0x2b50 [rdma_cm]
[<00000000e896235d>] cm_process_work+0x2d/0x100 [ib_cm]
[<00000000b6866c5f>] cm_req_handler+0x11bc/0x1c40 [ib_cm]
[<000000005f5dd9aa>] cm_work_handler+0xe65/0x3cf2 [ib_cm]
[<00000000610151e7>] process_one_work+0x4bc/0x980
[<00000000541e0f77>] worker_thread+0x78/0x5c0
[<00000000423898ca>] kthread+0x191/0x1e0
[<000000005a24b239>] ret_from_fork+0x3a/0x50--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +1 -0
@@ -1477,6 +1477,7 @@ static void free_sess(struct rtrs_srv_sess *sess)kobject_del (&sess->kobj);kobject_put (&sess->kobj); }else { +kfree (sess->stats);kfree (sess); } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 386/700 RDMA/rtrs-srv: Fix memory leak when having multiple sessions
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit 6bb97a2c1aa5278a30d49abb6186d50c34c207e2 ]
Gioh notice memory leak below
unreferenced object 0xffff8880acda2000 (size 2048):
comm "kworker/4:1", pid 77, jiffies 4295062871 (age 1270.730s) hex dump (first 32 bytes):
00 20 da ac 80 88 ff ff 00 20 da ac 80 88 ff ff . ....... ......
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000e85d85b5>] rtrs_srv_rdma_cm_handler+0x8e5/0xa90 [rtrs_server]
[<00000000e31a988a>] cma_ib_req_handler+0xdc5/0x2b50 [rdma_cm]
[<000000000eb02c5b>] cm_process_work+0x2d/0x100 [ib_cm]
[<00000000e1650ca9>] cm_req_handler+0x11bc/0x1c40 [ib_cm]
[<000000009c28818b>] cm_work_handler+0xe65/0x3cf2 [ib_cm]
[<000000002b53eaa1>] process_one_work+0x4bc/0x980
[<00000000da3499fb>] worker_thread+0x78/0x5c0
[<00000000167127a4>] kthread+0x191/0x1e0
[<0000000060802104>] ret_from_fork+0x3a/0x50unreferenced object 0xffff88806d595d90 (size 8):
comm "kworker/4:1H", pid 131, jiffies 4295062972 (age 1269.720s) hex dump (first 8 bytes):
62 6c 61 00 6b 6b 6b a5 bla.kkk.
backtrace:
[<000000004447d253>] kstrdup+0x2e/0x60
[<0000000047259793>] kobject_set_name_vargs+0x2f/0xb0
[<00000000c2ee3bc8>] dev_set_name+0xab/0xe0
[<000000002b6bdfb1>] rtrs_srv_create_sess_files+0x260/0x290 [rtrs_server]
[<0000000075d87bd7>] rtrs_srv_info_req_done+0x71b/0x960 [rtrs_server]
[<00000000ccdf1bb5>] __ib_process_cq+0x94/0x100 [ib_core]
[<00000000cbcb60cb>] ib_cq_poll_work+0x32/0xc0 [ib_core]
[<000000002b53eaa1>] process_one_work+0x4bc/0x980
[<00000000da3499fb>] worker_thread+0x78/0x5c0
[<00000000167127a4>] kthread+0x191/0x1e0
[<0000000060802104>] ret_from_fork+0x3a/0x50
unreferenced object 0xffff88806d6bb100 (size 256):
comm "kworker/4:1H", pid 131, jiffies 4295062972 (age 1269.720s)
hex dump (first 32 bytes):
00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00 .....N..........
ff ff ff ff ff ff ff ff 00 59 4d 86 ff ff ff ff .........YM.....
backtrace:
[<00000000a18a11e4>] device_add+0x74d/0xa00
[<00000000a915b95f>] rtrs_srv_create_sess_files.cold+0x49/0x1fe [rtrs_server]
[<0000000075d87bd7>] rtrs_srv_info_req_done+0x71b/0x960 [rtrs_server]
[<00000000ccdf1bb5>] __ib_process_cq+0x94/0x100 [ib_core]
[<00000000cbcb60cb>] ib_cq_poll_work+0x32/0xc0 [ib_core]
[<000000002b53eaa1>] process_one_work+0x4bc/0x980
[<00000000da3499fb>] worker_thread+0x78/0x5c0
[<00000000167127a4>] kthread+0x191/0x1e0
[<0000000060802104>] ret_from_fork+0x3a/0x50The problem is we increase device refcount by get_device in process_info_req for each path, but only does put_deice for last path, which lead to memory leak.
To fix it, it also calls put_device when dev_ref is not 0.
--- drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +1 -0
@@ -211,6 +211,7 @@ rtrs_srv_destroy_once_sysfs_root_folders(struct rtrs_srv_sess *sess)device_del (&srv->dev);put_device (&srv->dev); }else { +put_device (&srv->dev);mutex_unlock (&srv->paths_mutex); } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 387/700 RDMA/rtrs-clt: Check if the queue_depth has changed during a reconnection
In reply to Greg Kroah-HartmanFrom: Md Haris Iqbal <[email protected]>
[ Upstream commit 5b73b799c25c68a4703cd6c5ac4518006d9865b8 ]
The queue_depth is a module parameter for rtrs_server. It is used on the client side to determing the queue_depth of the request queue for the RNBD virtual block device.
During a reconnection event for an already mapped device, in case the rtrs_server module queue_depth has changed, fail the reconnect attempt.
Also stop further auto reconnection attempts. A manual reconnect via sysfs has to be triggerred.
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +15 -4
@@ -1716,7 +1716,19 @@ static int rtrs_rdma_conn_established(struct rtrs_clt_con *con, queue_depth);return -ECONNRESET ; } -if (!sess->rbufs || sess->queue_depth < queue_depth) { +if (sess->queue_depth >0 && queue_depth != sess->queue_depth) { +rtrs_err (clt,"Error: queue depth changed\n" ); + +/* +* Stop any more reconnection attempts +*/ + sess->reconnect_attempts =-1 ; +rtrs_err (clt, +"Disabling auto-reconnect. Trigger a manual reconnect after issue is resolved\n" ); +return -ECONNRESET ; + } + +if (!sess->rbufs) {kfree (sess->rbufs); sess->rbufs =kcalloc (queue_depth,sizeof (*sess->rbufs),GFP_KERNEL );
@@ -1730,7 +1742,7 @@ static int rtrs_rdma_conn_established(struct rtrs_clt_con *con, sess->chunk_size = sess->max_io_size + sess->max_hdr_size;/* -* Global queue depth and IO size is always a minimum. +* Global IO size is always a minimum. * If while a reconnection server sends us a value a bit * higher - client does not care and uses cached minimum. *
@@ -1738,8 +1750,7 @@ static int rtrs_rdma_conn_established(struct rtrs_clt_con *con,* connections in parallel, use lock. */ mutex_lock (&clt->paths_mutex); - clt->queue_depth =min_not_zero (sess->queue_depth, - clt->queue_depth); + clt->queue_depth = sess->queue_depth; clt->max_io_size =min_not_zero (sess->max_io_size, clt->max_io_size);mutex_unlock (&clt->paths_mutex);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 388/700 RDMA/rtrs-clt: Fix memory leak of not-freed sess->stats and stats->pcpu_stats
In reply to Greg Kroah-HartmanFrom: Gioh Kim <[email protected]>
[ Upstream commit 7ecd7e290bee0ab9cf75b79a367a4cc113cf8292 ]
sess->stats and sess->stats->pcpu_stats objects are freed when sysfs entry is removed. If something wrong happens and session is closed before sysfs entry is created, sess->stats and sess->stats->pcpu_stats objects are not freed.
This patch adds freeing of them at three places:
1. When client uses wrong address and session creation fails.
2. When client fails to create a sysfs entry.
3. When client adds wrong address via sysfs add_path.
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +6 -0
@@ -2689,6 +2689,8 @@ struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *ops,if (err) {list_del_rcu (&sess->s.entry);rtrs_clt_close_conns (sess, true); +free_percpu (sess->stats->pcpu_stats); +kfree (sess->stats);free_sess (sess); goto close_all_sess; }
@@ -2697,6 +2699,8 @@ struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *ops,if (err) {list_del_rcu (&sess->s.entry);rtrs_clt_close_conns (sess, true); +free_percpu (sess->stats->pcpu_stats); +kfree (sess->stats);free_sess (sess); goto close_all_sess; }
@@ -2954,6 +2958,8 @@ int rtrs_clt_create_path_from_sysfs(struct rtrs_clt *clt, close_sess:rtrs_clt_remove_path_from_arr (sess);rtrs_clt_close_conns (sess, true); +free_percpu (sess->stats->pcpu_stats); +kfree (sess->stats);free_sess (sess);return err;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 389/700 ehea: fix error return code in ehea_restart_qps()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 015dbf5662fd689d581c0bc980711b073ca09a1a ]
Fix to return -EFAULT from the error handling case instead of 0, as done elsewhere in this function.
By the way, when get_zeroed_page() fails, directly return -ENOMEM to simplify code.
--- drivers/net/ethernet/ibm/ehea/ehea_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/ibm/ehea/ehea_main.c +5 -4
@@ -2617,10 +2617,8 @@ static int ehea_restart_qps(struct net_device *dev)u16 dummy16 =0 ; cb0 = (void *)get_zeroed_page (GFP_KERNEL ); -if (!cb0) { - ret = -ENOMEM ; - goto out; - } +if (!cb0) +return -ENOMEM ;for (i =0 ; i < (port->num_def_qps); i++) {struct ehea_port_res *pr = &port->port_res[i];
@@ -2640,6 +2638,7 @@ static int ehea_restart_qps(struct net_device *dev) cb0);if (hret !=H_SUCCESS ) {netdev_err (dev,"query_ehea_qp failed (1)\n" ); + ret = -EFAULT ; goto out; }
@@ -2652,6 +2651,7 @@ static int ehea_restart_qps(struct net_device *dev) &dummy64, &dummy16, &dummy16);if (hret !=H_SUCCESS ) {netdev_err (dev,"modify_ehea_qp failed (1)\n" ); + ret = -EFAULT ; goto out; }
@@ -2660,6 +2660,7 @@ static int ehea_restart_qps(struct net_device *dev) cb0);if (hret !=H_SUCCESS ) {netdev_err (dev,"query_ehea_qp failed (2)\n" ); + ret = -EFAULT ; goto out; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 390/700 clk: tegra30: Use 300MHz for video decoder by default
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 56bb7c28ad00e7bcfc851c4e183c42d148d3ad4e ]
The 600MHz is a too high clock rate for some SoC versions for the video decoder hardware and this may cause stability issues. Use 300MHz for the video decoder by default, which is supported by all hardware versions.
--- drivers/clk/tegra/clk-tegra30.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/tegra/clk-tegra30.c +1 -1
@@ -1245,7 +1245,7 @@ static struct tegra_clk_init_table init_table[] __initdata = { { TEGRA30_CLK_GR3D, TEGRA30_CLK_PLL_C, 300000000, 0 }, { TEGRA30_CLK_GR3D2, TEGRA30_CLK_PLL_C, 300000000, 0 }, { TEGRA30_CLK_PLL_U, TEGRA30_CLK_CLK_MAX, 480000000, 0 }, - { TEGRA30_CLK_VDE, TEGRA30_CLK_PLL_C, 600000000, 0 }, + { TEGRA30_CLK_VDE, TEGRA30_CLK_PLL_C, 300000000, 0 }, { TEGRA30_CLK_SPDIF_IN_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 }, { TEGRA30_CLK_I2S0_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 }, { TEGRA30_CLK_I2S1_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 },
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 391/700 xfrm: remove the fragment check for ipv6 beet mode
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit eebd49a4ffb420a991c606e54aa3c9f02857a334 ]
In commit 68dc022d04eb ("xfrm: BEET mode doesn't support fragments for inner packets"), it tried to fix the issue that in TX side the packet is fragmented before the ESP encapping while in the RX side the fragments always get reassembled before decapping with ESP.
This is not true for IPv6. IPv6 is different, and it's using exthdr to save fragment info, as well as the ESP info. Exthdrs are added in TX and processed in RX both in order. So in the above case, the ESP decapping will be done earlier than the fragment reassembling in TX side.
Here just remove the fragment check for the IPv6 inner packets to recover the fragments support for BEET mode.
--- net/xfrm/xfrm_output.c | 7 ------- 1 file changed, 7 deletions(-)
net/xfrm/xfrm_output.c +0 -7
@@ -711,15 +711,8 @@ out:static int xfrm6_extract_output (struct xfrm_state *x,struct sk_buff *skb) {#if IS_ENABLED (CONFIG_IPV6 ) -unsigned int ptr =0 ;int err; -if (x->outer_mode.encap ==XFRM_MODE_BEET && -ipv6_find_hdr (skb, &ptr,NEXTHDR_FRAGMENT ,NULL ,NULL ) >=0 ) { -net_warn_ratelimited ("BEET mode doesn't support inner IPv6 fragments\n" ); -return -EAFNOSUPPORT ; - } - err =xfrm6_tunnel_check_size (skb);if (err)return err;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 392/700 net/sched: act_vlan: Fix modify to allow 0
In reply to Greg Kroah-HartmanFrom: Boris Sukholitko <[email protected]>
[ Upstream commit 9c5eee0afca09cbde6bd00f77876754aaa552970 ]
Currently vlan modification action checks existence of vlan priority by comparing it to 0. Therefore it is impossible to modify existing vlan tag to have priority 0.
For example, the following tc command will change the vlan id but will not affect vlan priority:
tc filter add dev eth1 ingress matchall action vlan modify id 300 \
priority 0 pipe mirred egress redirect dev eth2
The incoming packet on eth1:
ethertype 802.1Q (0x8100), vlan 200, p 4, ethertype IPv4
will be changed to:
ethertype 802.1Q (0x8100), vlan 300, p 4, ethertype IPv4
although the user has intended to have p == 0.
The fix is to add tcfv_push_prio_exists flag to struct tcf_vlan_params and rely on it when deciding to set the priority.
--- include/net/tc_act/tc_vlan.h | 1 + net/sched/act_vlan.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
include/net/tc_act/tc_vlan.h +1 -0
@@ -16,6 +16,7 @@ struct tcf_vlan_params {u16 tcfv_push_vid;__be16 tcfv_push_proto;u8 tcfv_push_prio; +bool tcfv_push_prio_exists;struct rcu_head rcu; };
net/sched/act_vlan.c +5 -2
@@ -70,7 +70,7 @@ static int tcf_vlan_act(struct sk_buff *skb, const struct tc_action *a,/* replace the vid */ tci = (tci & ~VLAN_VID_MASK ) | p->tcfv_push_vid;/* replace prio bits, if tcfv_push_prio specified */ -if (p->tcfv_push_prio) { +if (p->tcfv_push_prio_exists) { tci &= ~VLAN_PRIO_MASK ; tci |= p->tcfv_push_prio <<VLAN_PRIO_SHIFT ; }
@@ -121,6 +121,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,struct tc_action_net *tn =net_generic (net, vlan_net_id);struct nlattr *tb[TCA_VLAN_MAX +1 ];struct tcf_chain *goto_ch =NULL ; +bool push_prio_exists = false;struct tcf_vlan_params *p;struct tc_vlan *parm;struct tcf_vlan *v;
@@ -189,7 +190,8 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla, push_proto =htons (ETH_P_8021Q ); } -if (tb[TCA_VLAN_PUSH_VLAN_PRIORITY ]) + push_prio_exists = !!tb[TCA_VLAN_PUSH_VLAN_PRIORITY ]; +if (push_prio_exists) push_prio =nla_get_u8 (tb[TCA_VLAN_PUSH_VLAN_PRIORITY ]);break ;case TCA_VLAN_ACT_POP_ETH :
@@ -241,6 +243,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla, p->tcfv_action = action; p->tcfv_push_vid = push_vid; p->tcfv_push_prio = push_prio; + p->tcfv_push_prio_exists = push_prio_exists || action ==TCA_VLAN_ACT_PUSH ; p->tcfv_push_proto = push_proto;if (action ==TCA_VLAN_ACT_PUSH_ETH ) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 393/700 RDMA/core: Sanitize WQ state received from the userspace
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit f97442887275d11c88c2899e720fe945c1f61488 ]
The mlx4 and mlx5 implemented differently the WQ input checks. Instead of duplicating mlx4 logic in the mlx5, let's prepare the input in the central place.
The mlx5 implementation didn't check for validity of state input. It is not real bug because our FW checked that, but still worth to fix.
--- drivers/infiniband/core/uverbs_cmd.c | 21 +++++++++++++++++++-- drivers/infiniband/hw/mlx4/qp.c | 9 ++------- drivers/infiniband/hw/mlx5/qp.c | 6 ++---- 3 files changed, 23 insertions(+), 13 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +19 -2
@@ -3033,12 +3033,29 @@ static int ib_uverbs_ex_modify_wq(struct uverbs_attr_bundle *attrs)if (!wq)return -EINVAL ; - wq_attr.curr_wq_state = cmd.curr_wq_state; - wq_attr.wq_state = cmd.wq_state;if (cmd.attr_mask &IB_WQ_FLAGS ) { wq_attr.flags = cmd.flags; wq_attr.flags_mask = cmd.flags_mask; } + +if (cmd.attr_mask &IB_WQ_CUR_STATE ) { +if (cmd.curr_wq_state >IB_WQS_ERR ) +return -EINVAL ; + + wq_attr.curr_wq_state = cmd.curr_wq_state; + }else { + wq_attr.curr_wq_state = wq->state; + } + +if (cmd.attr_mask &IB_WQ_STATE ) { +if (cmd.wq_state >IB_WQS_ERR ) +return -EINVAL ; + + wq_attr.wq_state = cmd.wq_state; + }else { + wq_attr.wq_state = wq_attr.curr_wq_state; + } + ret = wq->device->ops.modify_wq (wq, &wq_attr, cmd.attr_mask, &attrs->driver_udata); rdma_lookup_put_uobject(&wq->uobject->uevent.uobject,
drivers/infiniband/hw/mlx4/qp.c +2 -7
@@ -4254,13 +4254,8 @@ int mlx4_ib_modify_wq(struct ib_wq *ibwq, struct ib_wq_attr *wq_attr,if (wq_attr_mask &IB_WQ_FLAGS )return -EOPNOTSUPP ; - cur_state = wq_attr_mask &IB_WQ_CUR_STATE ? wq_attr->curr_wq_state : - ibwq->state; - new_state = wq_attr_mask &IB_WQ_STATE ? wq_attr->wq_state : cur_state; - -if (cur_state <IB_WQS_RESET || cur_state >IB_WQS_ERR || - new_state <IB_WQS_RESET || new_state >IB_WQS_ERR ) -return -EINVAL ; + cur_state = wq_attr->curr_wq_state; + new_state = wq_attr->wq_state;if ((new_state ==IB_WQS_RDY ) && (cur_state ==IB_WQS_ERR ))return -EINVAL ;
drivers/infiniband/hw/mlx5/qp.c +2 -4
@@ -5309,10 +5309,8 @@ int mlx5_ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *wq_attr, rqc =MLX5_ADDR_OF (modify_rq_in, in, ctx); - curr_wq_state = (wq_attr_mask &IB_WQ_CUR_STATE ) ? - wq_attr->curr_wq_state : wq->state; - wq_state = (wq_attr_mask &IB_WQ_STATE ) ? - wq_attr->wq_state : curr_wq_state; + curr_wq_state = wq_attr->curr_wq_state; + wq_state = wq_attr->wq_state;if (curr_wq_state ==IB_WQS_ERR ) curr_wq_state =MLX5_RQC_STATE_ERR ;if (wq_state ==IB_WQS_ERR )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 394/700 drm/pl111: depend on CONFIG_VEXPRESS_CONFIG
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 4dc7c97d04dcaa9f19482f70dcfdbeb52cc7193f ]
Avoid randconfig build failures by requiring VEXPRESS_CONFIG:
aarch64-linux-gnu-ld: drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_vexpress_clcd_init':
pl111_versatile.c:(.text+0x220): undefined reference to `devm_regmap_init_vexpress_config'
--- drivers/gpu/drm/pl111/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/pl111/Kconfig +1 -1
@@ -2,7 +2,7 @@ config DRM_PL111 tristate "DRM Support for PL111 CLCD Controller" depends on DRM - depends on ARM || ARM64 || COMPILE_TEST + depends on VEXPRESS_CONFIG depends on COMMON_CLK select DRM_KMS_HELPER select DRM_KMS_CMA_HELPER
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 395/700 RDMA/rxe: Fix failure during driver load
In reply to Greg Kroah-HartmanFrom: Kamal Heib <[email protected]>
[ Upstream commit 32a25f2ea690dfaace19f7a3a916f5d7e1ddafe8 ]
To avoid the following failure when trying to load the rdma_rxe module while IPv6 is disabled, add a check for EAFNOSUPPORT and ignore the failure, also delete the needless debug print from rxe_setup_udp_tunnel().
$ modprobe rdma_rxe modprobe: ERROR: could not insert 'rdma_rxe': Operation not permitted
--- drivers/infiniband/sw/rxe/rxe_net.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_net.c +7 -3
@@ -207,10 +207,8 @@ static struct socket *rxe_setup_udp_tunnel(struct net *net, __be16 port,/* Create UDP socket */ err =udp_sock_create (net, &udp_cfg, &sock); -if (err <0 ) { -pr_err ("failed to create udp socket. err = %d\n" , err); +if (err <0 )return ERR_PTR (err); - } tnl_cfg.encap_type =1 ; tnl_cfg.encap_rcv = rxe_udp_encap_recv;
@@ -619,6 +617,12 @@ static int rxe_net_ipv6_init(void) recv_sockets.sk6 =rxe_setup_udp_tunnel (&init_net,htons (ROCE_V2_UDP_DPORT ), true); +if (PTR_ERR (recv_sockets.sk6) == -EAFNOSUPPORT ) { + recv_sockets.sk6 =NULL ; +pr_warn ("IPv6 is not supported, can not create a UDPv6 socket\n" ); +return 0 ; + } +if (IS_ERR (recv_sockets.sk6)) { recv_sockets.sk6 =NULL ;pr_err ("Failed to create IPv6 UDP tunnel\n" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 396/700 drm/pl111: Actually fix CONFIG_VEXPRESS_CONFIG depends
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 4e566003571244f508408f59ce78f6ac2ccdba8e ]
VEXPRESS_CONFIG needs to either be missing, built-in, or modular when pl111 is modular. Update the Kconfig to reflect the need.
--- drivers/gpu/drm/pl111/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/pl111/Kconfig +2 -1
@@ -2,7 +2,8 @@ config DRM_PL111 tristate "DRM Support for PL111 CLCD Controller" depends on DRM - depends on VEXPRESS_CONFIG + depends on ARM || ARM64 || COMPILE_TEST + depends on VEXPRESS_CONFIG || VEXPRESS_CONFIG=n depends on COMMON_CLK select DRM_KMS_HELPER select DRM_KMS_CMA_HELPER
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 397/700 drm/vc4: hdmi: Fix error path of hpd-gpios
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit e075a7811977ff51c917a65ed1896e08231d2615 ]
If the of_get_named_gpio_flags call fails in vc4_hdmi_bind, we jump to the err_unprepare_hsm label. That label will then call pm_runtime_disable and put_device on the DDC device.
We just retrieved the DDC device, so the latter is definitely justified. However at that point we still haven't called pm_runtime_enable, so the call to pm_runtime_disable is not supposed to be there.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +2 -2
@@ -2000,7 +2000,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) &hpd_gpio_flags);if (vc4_hdmi->hpd_gpio <0 ) { ret = vc4_hdmi->hpd_gpio; - goto err_unprepare_hsm; + goto err_put_ddc; } vc4_hdmi->hpd_active_low = hpd_gpio_flags &OF_GPIO_ACTIVE_LOW ;
@@ -2041,8 +2041,8 @@ err_destroy_conn:vc4_hdmi_connector_destroy (&vc4_hdmi->connector); err_destroy_encoder:drm_encoder_cleanup (encoder); -err_unprepare_hsm:pm_runtime_disable (dev); +err_put_ddc:put_device (&vc4_hdmi->ddc->dev);return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 398/700 clk: vc5: fix output disabling when enabling a FOD
In reply to Greg Kroah-HartmanFrom: Luca Ceresoli <[email protected]>
[ Upstream commit fc336ae622df0ec114dbe5551a4d2760c535ecd0 ]
On 5P49V6965, when an output is enabled we enable the corresponding FOD. When this happens for the first time, and specifically when writing register VC5_OUT_DIV_CONTROL in vc5_clk_out_prepare(), all other outputs are stopped for a short time and then restarted.
According to Renesas support this is intended: "The reason for that is VC6E has synced up all output function".
This behaviour can be disabled at least on VersaClock 6E devices, of which only the 5P49V6965 is currently implemented by this driver. This requires writing bit 7 (bypass_sync{1..4}) in register 0x20..0x50. Those registers are named "Unused Factory Reserved Register", and the bits are documented as "Skip VDDO<N> verification", which does not clearly explain the relation to FOD sync. However according to Renesas support as well as my testing setting this bit does prevent disabling of all clock outputs when enabling a FOD.
See "VersaClock ® 6E Family Register Descriptions and Programming Guide" (August 30, 2018), Table 116 "Power Up VDD check", page 58:
https://www.renesas.com/us/en/document/mau/versaclock-6e-family-register-descriptions-and-programming-guide
--- drivers/clk/clk-versaclock5.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)
drivers/clk/clk-versaclock5.c +24 -3
@@ -69,7 +69,10 @@#define VC5_FEEDBACK_FRAC_DIV (n) (0x19 + (n))#define VC5_RC_CONTROL0 0x1e#define VC5_RC_CONTROL1 0x1f -/* Register 0x20 is factory reserved */ + +/* These registers are named "Unused Factory Reserved Registers" */ +#define VC5_RESERVED_X0 (idx) (0x20 + ((idx) * 0x10)) +#define VC5_RESERVED_X0_BYPASS_SYNC BIT(7)/* bypass_sync<idx> bit */ /* Output divider control for divider 1,2,3,4 */ #define VC5_OUT_DIV_CONTROL (idx) (0x21 + ((idx) * 0x10))
@@ -87,7 +90,6 @@#define VC5_OUT_DIV_SKEW_INT (idx, n) (0x2b + ((idx) * 0x10) + (n))#define VC5_OUT_DIV_INT (idx, n) (0x2d + ((idx) * 0x10) + (n))#define VC5_OUT_DIV_SKEW_FRAC (idx) (0x2f + ((idx) * 0x10)) -/* Registers 0x30, 0x40, 0x50 are factory reserved */ /* Clock control register for clock 1,2 */ #define VC5_CLK_OUTPUT_CFG (idx, n) (0x60 + ((idx) * 0x2) + (n))
@@ -140,6 +142,8 @@#define VC5_HAS_INTERNAL_XTAL BIT(0)/* chip has PFD requency doubler */ #define VC5_HAS_PFD_FREQ_DBL BIT(1) +/* chip has bits to disable FOD sync */ +#define VC5_HAS_BYPASS_SYNC_BIT BIT(2)/* Supported IDT VC5 models. */ enum vc5_model {
@@ -581,6 +585,23 @@ static int vc5_clk_out_prepare(struct clk_hw *hw)unsigned int src;int ret; +/* +* When enabling a FOD, all currently enabled FODs are briefly +* stopped in order to synchronize all of them. This causes a clock +* disruption to any unrelated chips that might be already using +* other clock outputs. Bypass the sync feature to avoid the issue, +* which is possible on the VersaClock 6E family via reserved +* registers. +*/ +if (vc5->chip_info->flags &VC5_HAS_BYPASS_SYNC_BIT ) { + ret =regmap_update_bits (vc5->regmap, +VC5_RESERVED_X0 (hwdata->num), +VC5_RESERVED_X0_BYPASS_SYNC , +VC5_RESERVED_X0_BYPASS_SYNC ); +if (ret) +return ret; + } +/* * If the input mux is disabled, enable it first and * select source from matching FOD.
@@ -1166,7 +1187,7 @@ static const struct vc5_chip_info idt_5p49v6965_info = { .model = IDT_VC6_5P49V6965, .clk_fod_cnt = 4, .clk_out_cnt = 5, - .flags = 0, + .flags = VC5_HAS_BYPASS_SYNC_BIT, };static const struct i2c_device_id vc5_id[] = {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 399/700 drm: qxl: ensure surf.data is ininitialized
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit fbbf23ddb2a1cc0c12c9f78237d1561c24006f50 ]
The object surf is not fully initialized and the uninitialized field surf.data is being copied by the call to qxl_bo_create via the call to qxl_gem_object_create. Set surf.data to zero to ensure garbage data from the stack is not being copied.
Addresses-Coverity: ("Uninitialized scalar variable")
--- drivers/gpu/drm/qxl/qxl_dumb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/qxl/qxl_dumb.c +2 -0
@@ -58,6 +58,8 @@ int qxl_mode_dumb_create(struct drm_file *file_priv, surf.height = args->height; surf.stride = pitch; surf.format = format; + surf.data =0 ; + r = qxl_gem_object_create_with_handle(qdev, file_priv, QXL_GEM_DOMAIN_SURFACE, args->size, &surf, &qobj,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 400/700 tools/bpftool: Fix error return code in do_batch()
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
[ Upstream commit ca16b429f39b4ce013bfa7e197f25681e65a2a42 ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- tools/bpf/bpftool/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/bpf/bpftool/main.c +3 -1
@@ -340,8 +340,10 @@ static int do_batch(int argc, char **argv) n_argc =make_args (buf, n_argv,BATCH_ARG_NB_MAX , lines);if (!n_argc)continue ; -if (n_argc <0 ) +if (n_argc <0 ) { + err = n_argc; goto err_close; + }if (json_output) {jsonw_start_object (json_wtr);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 401/700 ath10k: go to path err_unsupported when chip id is not supported
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 9e88dd431d2345acdb7a549f3e88aaf4c2a307a1 ]
When chip id is not supported, it go to path err_unsupported to print the error message.
--- drivers/net/wireless/ath/ath10k/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/pci.c +1 -1
@@ -3701,7 +3701,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev, goto err_unsupported;if (!ath10k_pci_chip_is_supported (pdev->device, bus_params.chip_id)) - goto err_free_irq; + goto err_unsupported; ret =ath10k_core_register (ar, &bus_params);if (ret) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 402/700 ath10k: add missing error return code in ath10k_pci_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit e2783e2f39ba99178dedfc1646d5cc0979d1bab3 ]
When chip_id is not supported, the resources will be freed on path err_unsupported, these resources will also be freed when calling ath10k_pci_remove(), it will cause double free, so return -ENODEV when it doesn't support the device with wrong chip_id.
--- drivers/net/wireless/ath/ath10k/pci.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +9 -3
@@ -3685,8 +3685,10 @@ static int ath10k_pci_probe(struct pci_dev *pdev,ath10k_pci_soc_read32 (ar,SOC_CHIP_ID_ADDRESS );if (bus_params.chip_id !=0xffffffff ) {if (!ath10k_pci_chip_is_supported (pdev->device, - bus_params.chip_id)) + bus_params.chip_id)) { + ret = -ENODEV ; goto err_unsupported; + } } }
@@ -3697,11 +3699,15 @@ static int ath10k_pci_probe(struct pci_dev *pdev, } bus_params.chip_id =ath10k_pci_soc_read32 (ar,SOC_CHIP_ID_ADDRESS ); -if (bus_params.chip_id ==0xffffffff ) +if (bus_params.chip_id ==0xffffffff ) { + ret = -ENODEV ; goto err_unsupported; + } -if (!ath10k_pci_chip_is_supported (pdev->device, bus_params.chip_id)) +if (!ath10k_pci_chip_is_supported (pdev->device, bus_params.chip_id)) { + ret = -ENODEV ; goto err_unsupported; + } ret =ath10k_core_register (ar, &bus_params);if (ret) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 403/700 wireless: carl9170: fix LEDS build errors & warnings
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 272fdc0c4542fad173b44965be02a16d6db95499 ]
kernel test robot reports over 200 build errors and warnings that are due to this Kconfig problem when CARL9170=m, MAC80211=y, and LEDS_CLASS=m.
WARNING: unmet direct dependencies detected for MAC80211_LEDS
Depends on [n]: NET [=y] && WIRELESS [=y] && MAC80211 [=y] && (LEDS_CLASS [=m]=y || LEDS_CLASS [=m]=MAC80211 [=y]) Selected by [m]:
- CARL9170_LEDS [=y] && NETDEVICES [=y] && WLAN [=y] && WLAN_VENDOR_ATH [=y] && CARL9170 [=m]
CARL9170_LEDS selects MAC80211_LEDS even though its kconfig dependencies are not met. This happens because 'select' does not follow any Kconfig dependency chains.
Fix this by making CARL9170_LEDS depend on MAC80211_LEDS, where the latter supplies any needed dependencies on LEDS_CLASS.
--- drivers/net/wireless/ath/carl9170/Kconfig | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/carl9170/Kconfig +3 -5
@@ -16,13 +16,11 @@ config CARL9170 config CARL9170_LEDS bool "SoftLED Support" - depends on CARL9170 - select MAC80211_LEDS - select LEDS_CLASS - select NEW_LEDS default y + depends on CARL9170 + depends on MAC80211_LEDS help - This option is necessary, if you want your device' LEDs to blink + This option is necessary, if you want your device's LEDs to blink. Say Y, unless you need the LEDs for firmware debugging.
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 404/700 ieee802154: hwsim: Fix possible memory leak in hwsim_subscribe_all_others
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit ab372c2293f5d0b279f31c8d768566ea37602dc9 ]
In hwsim_subscribe_all_others, the error handling code performs incorrectly if the second hwsim_alloc_edge fails. When this issue occurs, it goes to sub_fail, without cleaning the edges allocated before.
--- drivers/net/ieee802154/mac802154_hwsim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ieee802154/mac802154_hwsim.c +2 -2
@@ -715,6 +715,8 @@ static int hwsim_subscribe_all_others(struct hwsim_phy *phy)return 0 ; +sub_fail: +hwsim_edge_unsubscribe_me (phy); me_fail:rcu_read_lock ();list_for_each_entry_rcu (e, &phy->edges, list) {
@@ -722,8 +724,6 @@ me_fail:hwsim_free_edge (e); }rcu_read_unlock (); -sub_fail: -hwsim_edge_unsubscribe_me (phy);return -ENOMEM ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 405/700 clk: imx8mq: remove SYS PLL 1/2 clock gates
In reply to Greg Kroah-HartmanFrom: Lucas Stach <[email protected]>
[ Upstream commit c586f53ae159c6c1390f093a1ec94baef2df9f3a ]
Remove the PLL clock gates as the allowing to gate the sys1_pll_266m breaks the uSDHC module which is sporadically unable to enumerate devices after this change. Also it makes AMP clock management harder with no obvious benefit to Linux, so just revert the change.
--- drivers/clk/imx/clk-imx8mq.c | 56 ++++++++---------------- include/dt-bindings/clock/imx8mq-clock.h | 19 -------- 2 files changed, 18 insertions(+), 57 deletions(-)
drivers/clk/imx/clk-imx8mq.c +18 -38
@@ -358,46 +358,26 @@ static int imx8mq_clocks_probe(struct platform_device *pdev) hws[IMX8MQ_VIDEO2_PLL_OUT ] =imx_clk_hw_sscg_pll ("video2_pll_out" , video2_pll_out_sels,ARRAY_SIZE (video2_pll_out_sels),0 ,0 ,0 , base +0x54 ,0 );/* SYS PLL1 fixed output */ - hws[IMX8MQ_SYS1_PLL_40M_CG ] =imx_clk_hw_gate ("sys1_pll_40m_cg" ,"sys1_pll_out" , base +0x30 ,9 ); - hws[IMX8MQ_SYS1_PLL_80M_CG ] =imx_clk_hw_gate ("sys1_pll_80m_cg" ,"sys1_pll_out" , base +0x30 ,11 ); - hws[IMX8MQ_SYS1_PLL_100M_CG ] =imx_clk_hw_gate ("sys1_pll_100m_cg" ,"sys1_pll_out" , base +0x30 ,13 ); - hws[IMX8MQ_SYS1_PLL_133M_CG ] =imx_clk_hw_gate ("sys1_pll_133m_cg" ,"sys1_pll_out" , base +0x30 ,15 ); - hws[IMX8MQ_SYS1_PLL_160M_CG ] =imx_clk_hw_gate ("sys1_pll_160m_cg" ,"sys1_pll_out" , base +0x30 ,17 ); - hws[IMX8MQ_SYS1_PLL_200M_CG ] =imx_clk_hw_gate ("sys1_pll_200m_cg" ,"sys1_pll_out" , base +0x30 ,19 ); - hws[IMX8MQ_SYS1_PLL_266M_CG ] =imx_clk_hw_gate ("sys1_pll_266m_cg" ,"sys1_pll_out" , base +0x30 ,21 ); - hws[IMX8MQ_SYS1_PLL_400M_CG ] =imx_clk_hw_gate ("sys1_pll_400m_cg" ,"sys1_pll_out" , base +0x30 ,23 ); - hws[IMX8MQ_SYS1_PLL_800M_CG ] =imx_clk_hw_gate ("sys1_pll_800m_cg" ,"sys1_pll_out" , base +0x30 ,25 ); - - hws[IMX8MQ_SYS1_PLL_40M ] =imx_clk_hw_fixed_factor ("sys1_pll_40m" ,"sys1_pll_40m_cg" ,1 ,20 ); - hws[IMX8MQ_SYS1_PLL_80M ] =imx_clk_hw_fixed_factor ("sys1_pll_80m" ,"sys1_pll_80m_cg" ,1 ,10 ); - hws[IMX8MQ_SYS1_PLL_100M ] =imx_clk_hw_fixed_factor ("sys1_pll_100m" ,"sys1_pll_100m_cg" ,1 ,8 ); - hws[IMX8MQ_SYS1_PLL_133M ] =imx_clk_hw_fixed_factor ("sys1_pll_133m" ,"sys1_pll_133m_cg" ,1 ,6 ); - hws[IMX8MQ_SYS1_PLL_160M ] =imx_clk_hw_fixed_factor ("sys1_pll_160m" ,"sys1_pll_160m_cg" ,1 ,5 ); - hws[IMX8MQ_SYS1_PLL_200M ] =imx_clk_hw_fixed_factor ("sys1_pll_200m" ,"sys1_pll_200m_cg" ,1 ,4 ); - hws[IMX8MQ_SYS1_PLL_266M ] =imx_clk_hw_fixed_factor ("sys1_pll_266m" ,"sys1_pll_266m_cg" ,1 ,3 ); - hws[IMX8MQ_SYS1_PLL_400M ] =imx_clk_hw_fixed_factor ("sys1_pll_400m" ,"sys1_pll_400m_cg" ,1 ,2 ); - hws[IMX8MQ_SYS1_PLL_800M ] =imx_clk_hw_fixed_factor ("sys1_pll_800m" ,"sys1_pll_800m_cg" ,1 ,1 ); + hws[IMX8MQ_SYS1_PLL_40M ] =imx_clk_hw_fixed_factor ("sys1_pll_40m" ,"sys1_pll_out" ,1 ,20 ); + hws[IMX8MQ_SYS1_PLL_80M ] =imx_clk_hw_fixed_factor ("sys1_pll_80m" ,"sys1_pll_out" ,1 ,10 ); + hws[IMX8MQ_SYS1_PLL_100M ] =imx_clk_hw_fixed_factor ("sys1_pll_100m" ,"sys1_pll_out" ,1 ,8 ); + hws[IMX8MQ_SYS1_PLL_133M ] =imx_clk_hw_fixed_factor ("sys1_pll_133m" ,"sys1_pll_out" ,1 ,6 ); + hws[IMX8MQ_SYS1_PLL_160M ] =imx_clk_hw_fixed_factor ("sys1_pll_160m" ,"sys1_pll_out" ,1 ,5 ); + hws[IMX8MQ_SYS1_PLL_200M ] =imx_clk_hw_fixed_factor ("sys1_pll_200m" ,"sys1_pll_out" ,1 ,4 ); + hws[IMX8MQ_SYS1_PLL_266M ] =imx_clk_hw_fixed_factor ("sys1_pll_266m" ,"sys1_pll_out" ,1 ,3 ); + hws[IMX8MQ_SYS1_PLL_400M ] =imx_clk_hw_fixed_factor ("sys1_pll_400m" ,"sys1_pll_out" ,1 ,2 ); + hws[IMX8MQ_SYS1_PLL_800M ] =imx_clk_hw_fixed_factor ("sys1_pll_800m" ,"sys1_pll_out" ,1 ,1 );/* SYS PLL2 fixed output */ - hws[IMX8MQ_SYS2_PLL_50M_CG ] =imx_clk_hw_gate ("sys2_pll_50m_cg" ,"sys2_pll_out" , base +0x3c ,9 ); - hws[IMX8MQ_SYS2_PLL_100M_CG ] =imx_clk_hw_gate ("sys2_pll_100m_cg" ,"sys2_pll_out" , base +0x3c ,11 ); - hws[IMX8MQ_SYS2_PLL_125M_CG ] =imx_clk_hw_gate ("sys2_pll_125m_cg" ,"sys2_pll_out" , base +0x3c ,13 ); - hws[IMX8MQ_SYS2_PLL_166M_CG ] =imx_clk_hw_gate ("sys2_pll_166m_cg" ,"sys2_pll_out" , base +0x3c ,15 ); - hws[IMX8MQ_SYS2_PLL_200M_CG ] =imx_clk_hw_gate ("sys2_pll_200m_cg" ,"sys2_pll_out" , base +0x3c ,17 ); - hws[IMX8MQ_SYS2_PLL_250M_CG ] =imx_clk_hw_gate ("sys2_pll_250m_cg" ,"sys2_pll_out" , base +0x3c ,19 ); - hws[IMX8MQ_SYS2_PLL_333M_CG ] =imx_clk_hw_gate ("sys2_pll_333m_cg" ,"sys2_pll_out" , base +0x3c ,21 ); - hws[IMX8MQ_SYS2_PLL_500M_CG ] =imx_clk_hw_gate ("sys2_pll_500m_cg" ,"sys2_pll_out" , base +0x3c ,23 ); - hws[IMX8MQ_SYS2_PLL_1000M_CG ] =imx_clk_hw_gate ("sys2_pll_1000m_cg" ,"sys2_pll_out" , base +0x3c ,25 ); - - hws[IMX8MQ_SYS2_PLL_50M ] =imx_clk_hw_fixed_factor ("sys2_pll_50m" ,"sys2_pll_50m_cg" ,1 ,20 ); - hws[IMX8MQ_SYS2_PLL_100M ] =imx_clk_hw_fixed_factor ("sys2_pll_100m" ,"sys2_pll_100m_cg" ,1 ,10 ); - hws[IMX8MQ_SYS2_PLL_125M ] =imx_clk_hw_fixed_factor ("sys2_pll_125m" ,"sys2_pll_125m_cg" ,1 ,8 ); - hws[IMX8MQ_SYS2_PLL_166M ] =imx_clk_hw_fixed_factor ("sys2_pll_166m" ,"sys2_pll_166m_cg" ,1 ,6 ); - hws[IMX8MQ_SYS2_PLL_200M ] =imx_clk_hw_fixed_factor ("sys2_pll_200m" ,"sys2_pll_200m_cg" ,1 ,5 ); - hws[IMX8MQ_SYS2_PLL_250M ] =imx_clk_hw_fixed_factor ("sys2_pll_250m" ,"sys2_pll_250m_cg" ,1 ,4 ); - hws[IMX8MQ_SYS2_PLL_333M ] =imx_clk_hw_fixed_factor ("sys2_pll_333m" ,"sys2_pll_333m_cg" ,1 ,3 ); - hws[IMX8MQ_SYS2_PLL_500M ] =imx_clk_hw_fixed_factor ("sys2_pll_500m" ,"sys2_pll_500m_cg" ,1 ,2 ); - hws[IMX8MQ_SYS2_PLL_1000M ] =imx_clk_hw_fixed_factor ("sys2_pll_1000m" ,"sys2_pll_1000m_cg" ,1 ,1 ); + hws[IMX8MQ_SYS2_PLL_50M ] =imx_clk_hw_fixed_factor ("sys2_pll_50m" ,"sys2_pll_out" ,1 ,20 ); + hws[IMX8MQ_SYS2_PLL_100M ] =imx_clk_hw_fixed_factor ("sys2_pll_100m" ,"sys2_pll_out" ,1 ,10 ); + hws[IMX8MQ_SYS2_PLL_125M ] =imx_clk_hw_fixed_factor ("sys2_pll_125m" ,"sys2_pll_out" ,1 ,8 ); + hws[IMX8MQ_SYS2_PLL_166M ] =imx_clk_hw_fixed_factor ("sys2_pll_166m" ,"sys2_pll_out" ,1 ,6 ); + hws[IMX8MQ_SYS2_PLL_200M ] =imx_clk_hw_fixed_factor ("sys2_pll_200m" ,"sys2_pll_out" ,1 ,5 ); + hws[IMX8MQ_SYS2_PLL_250M ] =imx_clk_hw_fixed_factor ("sys2_pll_250m" ,"sys2_pll_out" ,1 ,4 ); + hws[IMX8MQ_SYS2_PLL_333M ] =imx_clk_hw_fixed_factor ("sys2_pll_333m" ,"sys2_pll_out" ,1 ,3 ); + hws[IMX8MQ_SYS2_PLL_500M ] =imx_clk_hw_fixed_factor ("sys2_pll_500m" ,"sys2_pll_out" ,1 ,2 ); + hws[IMX8MQ_SYS2_PLL_1000M ] =imx_clk_hw_fixed_factor ("sys2_pll_1000m" ,"sys2_pll_out" ,1 ,1 ); hws[IMX8MQ_CLK_MON_AUDIO_PLL1_DIV ] =imx_clk_hw_divider ("audio_pll1_out_monitor" ,"audio_pll1_bypass" , base +0x78 ,0 ,3 ); hws[IMX8MQ_CLK_MON_AUDIO_PLL2_DIV ] =imx_clk_hw_divider ("audio_pll2_out_monitor" ,"audio_pll2_bypass" , base +0x78 ,4 ,3 );
include/dt-bindings/clock/imx8mq-clock.h +0 -19
@@ -405,25 +405,6 @@#define IMX8MQ_VIDEO2_PLL1_REF_SEL 266 -#define IMX8MQ_SYS1_PLL_40M_CG 267 -#define IMX8MQ_SYS1_PLL_80M_CG 268 -#define IMX8MQ_SYS1_PLL_100M_CG 269 -#define IMX8MQ_SYS1_PLL_133M_CG 270 -#define IMX8MQ_SYS1_PLL_160M_CG 271 -#define IMX8MQ_SYS1_PLL_200M_CG 272 -#define IMX8MQ_SYS1_PLL_266M_CG 273 -#define IMX8MQ_SYS1_PLL_400M_CG 274 -#define IMX8MQ_SYS1_PLL_800M_CG 275 -#define IMX8MQ_SYS2_PLL_50M_CG 276 -#define IMX8MQ_SYS2_PLL_100M_CG 277 -#define IMX8MQ_SYS2_PLL_125M_CG 278 -#define IMX8MQ_SYS2_PLL_166M_CG 279 -#define IMX8MQ_SYS2_PLL_200M_CG 280 -#define IMX8MQ_SYS2_PLL_250M_CG 281 -#define IMX8MQ_SYS2_PLL_333M_CG 282 -#define IMX8MQ_SYS2_PLL_500M_CG 283 -#define IMX8MQ_SYS2_PLL_1000M_CG 284 -#define IMX8MQ_CLK_GPU_CORE 285#define IMX8MQ_CLK_GPU_SHADER 286#define IMX8MQ_CLK_M4_CORE 287
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 406/700 wcn36xx: Move hal_buf allocation to devm_kmalloc in probe
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit ef48667557c53d4b51a1ee3090eab7699324c9de ]
Right now wcn->hal_buf is allocated in wcn36xx_start(). This is a problem since we should have setup all of the buffers we required by the time ieee80211_register_hw() is called.
struct ieee80211_ops callbacks may run prior to mac_start() and therefore wcn->hal_buf must be initialized.
This is easily remediated by moving the allocation to probe() taking the opportunity to tidy up freeing memory by using devm_kmalloc().
--- drivers/net/wireless/ath/wcn36xx/main.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/net/wireless/ath/wcn36xx/main.c +8 -13
@@ -293,23 +293,16 @@ static int wcn36xx_start(struct ieee80211_hw *hw) goto out_free_dxe_pool; } - wcn->hal_buf =kmalloc (WCN36XX_HAL_BUF_SIZE ,GFP_KERNEL ); -if (!wcn->hal_buf) { -wcn36xx_err ("Failed to allocate smd buf\n" ); - ret = -ENOMEM ; - goto out_free_dxe_ctl; - } - ret =wcn36xx_smd_load_nv (wcn);if (ret) {wcn36xx_err ("Failed to push NV to chip\n" ); - goto out_free_smd_buf; + goto out_free_dxe_ctl; } ret =wcn36xx_smd_start (wcn);if (ret) {wcn36xx_err ("Failed to start chip\n" ); - goto out_free_smd_buf; + goto out_free_dxe_ctl; }if (!wcn36xx_is_fw_version (wcn,1 ,2 ,2 ,24 )) {
@@ -336,8 +329,6 @@ static int wcn36xx_start(struct ieee80211_hw *hw) out_smd_stop:wcn36xx_smd_stop (wcn); -out_free_smd_buf: -kfree (wcn->hal_buf); out_free_dxe_ctl:wcn36xx_dxe_free_ctl_blks (wcn); out_free_dxe_pool:
@@ -372,8 +363,6 @@ static void wcn36xx_stop(struct ieee80211_hw *hw)wcn36xx_dxe_free_mem_pools (wcn);wcn36xx_dxe_free_ctl_blks (wcn); - -kfree (wcn->hal_buf); }static void wcn36xx_change_ps (struct wcn36xx *wcn,bool enable)
@@ -1401,6 +1390,12 @@ static int wcn36xx_probe(struct platform_device *pdev)mutex_init (&wcn->hal_mutex);mutex_init (&wcn->scan_lock); + wcn->hal_buf =devm_kmalloc (wcn->dev,WCN36XX_HAL_BUF_SIZE ,GFP_KERNEL ); +if (!wcn->hal_buf) { + ret = -ENOMEM ; + goto out_wq; + } + ret =dma_set_mask_and_coherent (wcn->dev,DMA_BIT_MASK (32 ));if (ret <0 ) {wcn36xx_err ("failed to set DMA mask: %d\n" , ret);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 407/700 ssb: Fix error return code in ssb_bus_scan()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 77a0989baa427dbd242c5784d05a53ca3d197d43 ]
Fix to return -EINVAL from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/ssb/scan.c | 1 + 1 file changed, 1 insertion(+)
drivers/ssb/scan.c +1 -0
@@ -325,6 +325,7 @@ int ssb_bus_scan(struct ssb_bus *bus,if (bus->nr_devices >ARRAY_SIZE (bus->devices)) {pr_err ("More than %d ssb cores found (%d)\n" ,SSB_MAX_NR_CORES , bus->nr_devices); + err = -EINVAL ; goto err_unmap; }if (bus->bustype ==SSB_BUSTYPE_SSB ) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 408/700 brcmfmac: fix setting of station info chains bitmask
In reply to Greg Kroah-HartmanFrom: Alvin Šipraga <[email protected]>
[ Upstream commit feb45643762172110cb3a44f99dd54304f33b711 ]
The sinfo->chains field is a bitmask for filled values in chain_signal and chain_signal_avg, not a count. Treat it as such so that the driver can properly report per-chain RSSI information.
Before (MIMO mode):
$ iw dev wlan0 station dump
...
signal: -51 [-51] dBmAfter (MIMO mode):
$ iw dev wlan0 station dump
...
signal: -53 [-53, -54] dBm--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +1 -2
@@ -2838,6 +2838,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, count_rssi =0 ;for (i =0 ; i <BRCMF_ANT_MAX ; i++) {if (sta_info_le.rssi[i]) { + sinfo->chains |=BIT (count_rssi); sinfo->chain_signal_avg[count_rssi] = sta_info_le.rssi[i]; sinfo->chain_signal[count_rssi] =
@@ -2848,8 +2849,6 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, }if (count_rssi) { sinfo->filled |=BIT_ULL (NL80211_STA_INFO_CHAIN_SIGNAL ); - sinfo->chains = count_rssi; - sinfo->filled |=BIT_ULL (NL80211_STA_INFO_SIGNAL ); total_rssi /= count_rssi; sinfo->signal = total_rssi;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 409/700 brcmfmac: correctly report average RSSI in station info
In reply to Greg Kroah-HartmanFrom: Alvin Šipraga <[email protected]>
[ Upstream commit 9a1590934d9a02e570636432b93052c0c035f31f ]
The rx_lastpkt_rssi field provided by the firmware is suitable for NL80211_STA_INFO_{SIGNAL,CHAIN_SIGNAL}, while the rssi field is an average. Fix up the assignments and set the correct STA_INFO bits. This lets userspace know that the average RSSI is part of the station info.
--- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +20 -16
@@ -2767,8 +2767,9 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,struct brcmf_sta_info_le sta_info_le;u32 sta_flags;u32 is_tdls_peer; -s32 total_rssi; -s32 count_rssi; +s32 total_rssi_avg =0 ; +s32 total_rssi =0 ; +s32 count_rssi =0 ;int rssi;u32 i;
@@ -2834,24 +2835,27 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, sinfo->filled |=BIT_ULL (NL80211_STA_INFO_RX_BYTES ); sinfo->rx_bytes =le64_to_cpu (sta_info_le.rx_tot_bytes); } - total_rssi =0 ; - count_rssi =0 ;for (i =0 ; i <BRCMF_ANT_MAX ; i++) { -if (sta_info_le.rssi[i]) { - sinfo->chains |=BIT (count_rssi); - sinfo->chain_signal_avg[count_rssi] = - sta_info_le.rssi[i]; - sinfo->chain_signal[count_rssi] = - sta_info_le.rssi[i]; - total_rssi += sta_info_le.rssi[i]; - count_rssi++; - } +if (sta_info_le.rssi[i] ==0 || + sta_info_le.rx_lastpkt_rssi[i] ==0 ) +continue ; + sinfo->chains |=BIT (count_rssi); + sinfo->chain_signal[count_rssi] = + sta_info_le.rx_lastpkt_rssi[i]; + sinfo->chain_signal_avg[count_rssi] = + sta_info_le.rssi[i]; + total_rssi += sta_info_le.rx_lastpkt_rssi[i]; + total_rssi_avg += sta_info_le.rssi[i]; + count_rssi++; }if (count_rssi) { - sinfo->filled |=BIT_ULL (NL80211_STA_INFO_CHAIN_SIGNAL ); sinfo->filled |=BIT_ULL (NL80211_STA_INFO_SIGNAL ); - total_rssi /= count_rssi; - sinfo->signal = total_rssi; + sinfo->filled |=BIT_ULL (NL80211_STA_INFO_SIGNAL_AVG ); + sinfo->filled |=BIT_ULL (NL80211_STA_INFO_CHAIN_SIGNAL ); + sinfo->filled |= +BIT_ULL (NL80211_STA_INFO_CHAIN_SIGNAL_AVG ); + sinfo->signal = total_rssi / count_rssi; + sinfo->signal_avg = total_rssi_avg / count_rssi; }else if (test_bit (BRCMF_VIF_STATUS_CONNECTED , &ifp->vif->sme_state)) {memset (&scb_val,0 ,sizeof (scb_val));
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 410/700 brcmfmac: Fix a double-free in brcmf_sdio_bus_reset
In reply to Greg Kroah-HartmanFrom: Tong Tiangen <[email protected]>
[ Upstream commit 7ea7a1e05c7ff5ffc9f9ec1f0849f6ceb7fcd57c ]
brcmf_sdiod_remove has been called inside brcmf_sdiod_probe when fails, so there's no need to call another one. Otherwise, sdiodev->freezer would be double freed.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +0 -1
@@ -4162,7 +4162,6 @@ static int brcmf_sdio_bus_reset(struct device *dev)if (ret) {brcmf_err ("Failed to probe after sdio device reset: ret %d\n" , ret); -brcmf_sdiod_remove (sdiodev); }return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 411/700 brcmfmac: Delete second brcm folder hierarchy
In reply to Greg Kroah-HartmanFrom: Matthias Brugger <[email protected]>
[ Upstream commit 4a26aafe4886a4ec9965171c280ce16df30dc362 ]
BRCMF_FW_DEFAULT_PATH already defines the brcm folder, delete the second folder to match with Linux firmware repository layout.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +2 -2
@@ -626,8 +626,8 @@ BRCMF_FW_DEF(4373, "brcmfmac4373-sdio");BRCMF_FW_DEF (43012 ,"brcmfmac43012-sdio" );/* firmware config files */ -MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcm/brcmfmac*-sdio.*.txt" ); -MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcm/brcmfmac*-pcie.*.txt" ); +MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcmfmac*-sdio.*.txt" ); +MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.*.txt" );static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {BRCMF_FW_ENTRY (BRCM_CC_43143_CHIP_ID ,0xFFFFFFFF ,43143 ),
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 412/700 brcmsmac: mac80211_if: Fix a resource leak in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 9a25344d5177c2b9285532236dc3d10a091f39a8 ]
If 'brcms_attach()' fails, we must undo the previous 'ieee80211_alloc_hw()' as already done in the remove function.
--- .../wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c +7 -1
@@ -1220,6 +1220,7 @@ static int brcms_bcma_probe(struct bcma_device *pdev) {struct brcms_info *wl;struct ieee80211_hw *hw; +int ret; dev_info(&pdev->dev, "mfg %x core %x rev %d class %d irq %d\n", pdev->id.manuf, pdev->id.id, pdev->id.rev, pdev->id.class,
@@ -1244,11 +1245,16 @@ static int brcms_bcma_probe(struct bcma_device *pdev) wl =brcms_attach (pdev);if (!wl) {pr_err ("%s: brcms_attach failed!\n" , __func__); -return -ENODEV ; + ret = -ENODEV ; + goto err_free_ieee80211; }brcms_led_register (wl);return 0 ; + +err_free_ieee80211: +ieee80211_free_hw (hw); +return ret; }static int brcms_suspend (struct bcma_device *pdev)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 413/700 cw1200: Revert unnecessary patches that fix unreal use-after-free bugs
In reply to Greg Kroah-HartmanFrom: Hang Zhang <[email protected]>
[ Upstream commit 3f60f4685699aa6006e58e424637e8e413e0a94d ]
A previous commit 4f68ef64cd7f ("cw1200: Fix concurrency use-after-free bugs in cw1200_hw_scan()") tried to fix a seemingly use-after-free bug between cw1200_bss_info_changed() and cw1200_hw_scan(), where the former frees a sk_buff pointed to by frame.skb, and the latter accesses the sk_buff pointed to by frame.skb. However, this issue should be a false alarm because:
(1) "frame.skb" is not a shared variable between the above two functions, because "frame" is a local function variable, each of the two functions has its own local "frame" - they just happen to have the same variable name.
(2) the sk_buff(s) pointed to by these two "frame.skb" are also two different object instances, they are individually allocated by different dev_alloc_skb() within the two above functions. To free one object instance will not invalidate the access of another different one.
Based on these facts, the previous commit should be unnecessary. Moreover, it also introduced a missing unlock which was addressed in a subsequent commit 51c8d24101c7 ("cw1200: fix missing unlock on error in cw1200_hw_scan()"). Now that the original use-after-free is unreal, these two commits should be reverted. This patch performs the reversion.
--- drivers/net/wireless/st/cw1200/scan.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/net/wireless/st/cw1200/scan.c +7 -10
@@ -75,30 +75,27 @@ int cw1200_hw_scan(struct ieee80211_hw *hw,if (req->n_ssids >WSM_SCAN_MAX_NUM_OF_SSIDS )return -EINVAL ; -/* will be unlocked in cw1200_scan_work() */ -down (&priv->scan.lock); -mutex_lock (&priv->conf_mutex); - frame.skb =ieee80211_probereq_get (hw, priv->vif->addr,NULL ,0 , req->ie_len); -if (!frame.skb) { -mutex_unlock (&priv->conf_mutex); -up (&priv->scan.lock); +if (!frame.skb)return -ENOMEM ; - }if (req->ie_len)skb_put_data (frame.skb, req->ie, req->ie_len); +/* will be unlocked in cw1200_scan_work() */ +down (&priv->scan.lock); +mutex_lock (&priv->conf_mutex); + ret =wsm_set_template_frame (priv, &frame);if (!ret) {/* Host want to be the probe responder. */ ret =wsm_set_probe_responder (priv, true); }if (ret) { -dev_kfree_skb (frame.skb);mutex_unlock (&priv->conf_mutex);up (&priv->scan.lock); +dev_kfree_skb (frame.skb);return ret; }
@@ -120,8 +117,8 @@ int cw1200_hw_scan(struct ieee80211_hw *hw, ++priv->scan.n_ssids; } -dev_kfree_skb (frame.skb);mutex_unlock (&priv->conf_mutex); +dev_kfree_skb (frame.skb);queue_work (priv->workqueue, &priv->scan.work);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 414/700 ath11k: Fix an error handling path in ath11k_core_fetch_board_data_api_n()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 515bda1d1e51c64edf2a384a58801f85a80a3f2d ]
All error paths but this one 'goto err' in order to release some resources.
Fix this.
--- drivers/net/wireless/ath/ath11k/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/core.c +2 -1
@@ -445,7 +445,8 @@ static int ath11k_core_fetch_board_data_api_n(struct ath11k_base *ab,if (len <ALIGN (ie_len,4 )) {ath11k_err (ab,"invalid length for board ie_id %d ie_len %zu len %zu\n" , ie_id, ie_len, len); -return -EINVAL ; + ret = -EINVAL ; + goto err; }switch (ie_id) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 415/700 ath10k: Fix an error code in ath10k_add_interface()
In reply to Greg Kroah-HartmanFrom: Yang Li <[email protected]>
[ Upstream commit e9ca70c735ce66fc6a0e02c8b6958434f74ef8de ]
When the code execute this if statement, the value of ret is 0. However, we can see from the ath10k_warn() log that the value of ret should be -EINVAL.
Clean up smatch warning:
drivers/net/wireless/ath/ath10k/mac.c:5596 ath10k_add_interface() warn:
missing error code 'ret'
--- drivers/net/wireless/ath/ath10k/mac.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath10k/mac.c +1 -0
@@ -5590,6 +5590,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,if (arvif->nohwcrypt && !test_bit (ATH10K_FLAG_RAW_MODE , &ar->dev_flags)) { + ret = -EINVAL ;ath10k_warn (ar,"cryptmode module param needed for sw crypto\n" ); goto err; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 416/700 ath11k: send beacon template after vdev_start/restart during csa
In reply to Greg Kroah-HartmanFrom: Seevalamuthu Mariappan <[email protected]>
[ Upstream commit 979ebc54cf13bd1e3eb6e21766d208d5de984fb8 ]
Firmware has added assert if beacon template is received after vdev_down. Firmware expects beacon template after vdev_start and before vdev_up. This change is needed to support MBSSID EMA cases in firmware.
Hence, Change the sequence in ath11k as expected from firmware. This new change is not causing any issues with older firmware.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1.r3-00011-QCAHKSWPL_SILICONZ-1
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1.r4-00008-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/mac.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +5 -5
@@ -5311,11 +5311,6 @@ ath11k_mac_update_vif_chan(struct ath11k *ar,if (WARN_ON (!arvif->is_up))continue ; - ret =ath11k_mac_setup_bcn_tmpl (arvif); -if (ret) -ath11k_warn (ab,"failed to update bcn tmpl during csa: %d\n" , - ret); - ret =ath11k_mac_vdev_restart (arvif, &vifs[i].new_ctx->def);if (ret) { ath11k_warn(ab, "failed to restart vdev %d: %d\n",
@@ -5323,6 +5318,11 @@ ath11k_mac_update_vif_chan(struct ath11k *ar,continue ; } + ret =ath11k_mac_setup_bcn_tmpl (arvif); +if (ret) +ath11k_warn (ab,"failed to update bcn tmpl during csa: %d\n" , + ret); + ret =ath11k_wmi_vdev_up (arvif->ar, arvif->vdev_id, arvif->aid, arvif->bssid);if (ret) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 417/700 wil6210: remove erroneous wiphy locking
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 8f78caa2264ece71c2e207cba023f28ab6665138 ]
We already hold the wiphy lock in all cases when we get here, so this would deadlock, remove the erroneous locking.
--- drivers/net/wireless/ath/wil6210/cfg80211.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/wireless/ath/wil6210/cfg80211.c +0 -2
@@ -2842,9 +2842,7 @@ void wil_p2p_wdev_free(struct wil6210_priv *wil) wil->radio_wdev = wil->main_ndev->ieee80211_ptr;mutex_unlock (&wil->vif_mutex);if (p2p_wdev) { -wiphy_lock (wil->wiphy);cfg80211_unregister_wdev (p2p_wdev); -wiphy_unlock (wil->wiphy);kfree (p2p_wdev); } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 418/700 netlabel: Fix memory leak in netlbl_mgmt_add_common
In reply to Greg Kroah-HartmanFrom: Liu Shixin <[email protected]>
[ Upstream commit b8f6b0522c298ae9267bd6584e19b942a0636910 ]
Hulk Robot reported memory leak in netlbl_mgmt_add_common. The problem is non-freed map in case of netlbl_domhsh_add() failed.
BUG: memory leak
unreferenced object 0xffff888100ab7080 (size 96):
comm "syz-executor537", pid 360, jiffies 4294862456 (age 22.678s)
hex dump (first 32 bytes):
05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
fe 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 ................
backtrace:
[<0000000008b40026>] netlbl_mgmt_add_common.isra.0+0xb2a/0x1b40
[<000000003be10950>] netlbl_mgmt_add+0x271/0x3c0
[<00000000c70487ed>] genl_family_rcv_msg_doit.isra.0+0x20e/0x320
[<000000001f2ff614>] genl_rcv_msg+0x2bf/0x4f0
[<0000000089045792>] netlink_rcv_skb+0x134/0x3d0
[<0000000020e96fdd>] genl_rcv+0x24/0x40
[<0000000042810c66>] netlink_unicast+0x4a0/0x6a0
[<000000002e1659f0>] netlink_sendmsg+0x789/0xc70
[<000000006e43415f>] sock_sendmsg+0x139/0x170
[<00000000680a73d7>] ____sys_sendmsg+0x658/0x7d0
[<0000000065cbb8af>] ___sys_sendmsg+0xf8/0x170
[<0000000019932b6c>] __sys_sendmsg+0xd3/0x190
[<00000000643ac172>] do_syscall_64+0x37/0x90
[<000000009b79d6dc>] entry_SYSCALL_64_after_hwframe+0x44/0xae--- net/netlabel/netlabel_mgmt.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
net/netlabel/netlabel_mgmt.c +10 -9
@@ -76,6 +76,7 @@ static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {static int netlbl_mgmt_add_common (struct genl_info *info,struct netlbl_audit *audit_info) { +void *pmap =NULL ;int ret_val = -EINVAL ;struct netlbl_domaddr_map *addrmap =NULL ;struct cipso_v4_doi *cipsov4 =NULL ;
@@ -175,6 +176,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, ret_val = -ENOMEM ; goto add_free_addrmap; } + pmap = map; map->list.addr = addr->s_addr & mask->s_addr; map->list.mask = mask->s_addr; map->list.valid =1 ;
@@ -183,10 +185,8 @@ static int netlbl_mgmt_add_common(struct genl_info *info, map->def.cipso = cipsov4; ret_val =netlbl_af4list_add (&map->list, &addrmap->list4); -if (ret_val !=0 ) { -kfree (map); - goto add_free_addrmap; - } +if (ret_val !=0 ) + goto add_free_map; entry->family =AF_INET ; entry->def.type =NETLBL_NLTYPE_ADDRSELECT ;
@@ -223,6 +223,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, ret_val = -ENOMEM ; goto add_free_addrmap; } + pmap = map; map->list.addr = *addr; map->list.addr.s6_addr32[0 ] &= mask->s6_addr32[0 ]; map->list.addr.s6_addr32[1 ] &= mask->s6_addr32[1 ];
@@ -235,10 +236,8 @@ static int netlbl_mgmt_add_common(struct genl_info *info, map->def.calipso = calipso; ret_val =netlbl_af6list_add (&map->list, &addrmap->list6); -if (ret_val !=0 ) { -kfree (map); - goto add_free_addrmap; - } +if (ret_val !=0 ) + goto add_free_map; entry->family =AF_INET6 ; entry->def.type =NETLBL_NLTYPE_ADDRSELECT ;
@@ -248,10 +247,12 @@ static int netlbl_mgmt_add_common(struct genl_info *info, ret_val =netlbl_domhsh_add (entry, audit_info);if (ret_val !=0 ) - goto add_free_addrmap; + goto add_free_map;return 0 ; +add_free_map: +kfree (pmap); add_free_addrmap:kfree (addrmap); add_doi_put_def:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 419/700 RDMA/mlx5: Dont add slave port to unaffiliated list
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 7ce6095e3bff8e20ce018b050960b527e298f7df ]
The mlx5_ib_bind_slave_port() doesn't remove multiport device from the unaffiliated list, but mlx5_ib_unbind_slave_port() did it. This unbalanced flow caused to the situation where mlx5_ib_unaffiliated_port_list was changed during iteration.
--- drivers/infiniband/hw/mlx5/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/main.c +2 -2
@@ -3393,8 +3393,6 @@ static void mlx5_ib_unbind_slave_port(struct mlx5_ib_dev *ibdev, port->mp.mpi =NULL ; -list_add_tail (&mpi->list, &mlx5_ib_unaffiliated_port_list); -spin_unlock (&port->mp.mpi_lock); err =mlx5_nic_vport_unaffiliate_multiport (mpi->mdev);
@@ -3542,6 +3540,8 @@ static void mlx5_ib_cleanup_multiport_master(struct mlx5_ib_dev *dev) }else {mlx5_ib_dbg (dev,"unbinding port_num: %d\n" , i +1 );mlx5_ib_unbind_slave_port (dev, dev->port[i].mp.mpi); +list_add_tail (&dev->port[i].mp.mpi->list, + &mlx5_ib_unaffiliated_port_list); } } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 420/700 netfilter: nft_exthdr: check for IPv6 packet before further processing
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit cdd73cc545c0fb9b1a1f7b209f4f536e7990cff4 ]
ipv6_find_hdr() does not validate that this is an IPv6 packet. Add a sanity check for calling ipv6_find_hdr() to make sure an IPv6 packet is passed for parsing.
--- net/netfilter/nft_exthdr.c | 3 +++ 1 file changed, 3 insertions(+)
net/netfilter/nft_exthdr.c +3 -0
@@ -42,6 +42,9 @@ static void nft_exthdr_ipv6_eval(const struct nft_expr *expr,unsigned int offset =0 ;int err; +if (pkt->skb->protocol !=htons (ETH_P_IPV6 )) + goto err; + err =ipv6_find_hdr (pkt->skb, &offset, priv->type,NULL ,NULL );if (priv->flags &NFT_EXTHDR_F_PRESENT ) {nft_reg_store8 (dest, err >=0 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 421/700 netfilter: nft_osf: check for TCP packet before further processing
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 8f518d43f89ae00b9cf5460e10b91694944ca1a8 ]
The osf expression only supports for TCP packets, add a upfront sanity check to skip packet parsing if this is not a TCP packet.
--- net/netfilter/nft_osf.c | 5 +++++ 1 file changed, 5 insertions(+)
net/netfilter/nft_osf.c +5 -0
@@ -28,6 +28,11 @@ static void nft_osf_eval(const struct nft_expr *expr, struct nft_regs *regs,struct nf_osf_data data;struct tcphdr _tcph; +if (pkt->tprot !=IPPROTO_TCP ) { + regs->verdict.code =NFT_BREAK ; +return ; + } + tcp =skb_header_pointer (skb,ip_hdrlen (skb),sizeof (struct tcphdr ), &_tcph);if (!tcp) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 422/700 netfilter: nft_tproxy: restrict support to TCP and UDP transport protocols
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 52f0f4e178c757b3d356087376aad8bd77271828 ]
Add unfront check for TCP and UDP packets before performing further processing.
--- net/netfilter/nft_tproxy.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/netfilter/nft_tproxy.c +8 -1
@@ -30,6 +30,12 @@ static void nft_tproxy_eval_v4(const struct nft_expr *expr,__be16 tport =0 ;struct sock *sk; +if (pkt->tprot !=IPPROTO_TCP && + pkt->tprot !=IPPROTO_UDP ) { + regs->verdict.code =NFT_BREAK ; +return ; + } + hp =skb_header_pointer (skb,ip_hdrlen (skb),sizeof (_hdr), &_hdr);if (!hp) { regs->verdict.code =NFT_BREAK ;
@@ -91,7 +97,8 @@ static void nft_tproxy_eval_v6(const struct nft_expr *expr,memset (&taddr,0 ,sizeof (taddr)); -if (!pkt->tprot_set) { +if (pkt->tprot !=IPPROTO_TCP && + pkt->tprot !=IPPROTO_UDP ) { regs->verdict.code =NFT_BREAK ;return ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 423/700 RDMA/rxe: Fix qp reference counting for atomic ops
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit 15ae1375ea91ae2dee6f12d71a79d8c0a10a30bf ]
Currently the rdma_rxe driver attempts to protect atomic responder resources by taking a reference to the qp which is only freed when the resource is recycled for a new read or atomic operation. This means that in normal circumstances there is almost always an extra qp reference once an atomic operation has been executed which prevents cleaning up the qp and associated pd and cqs when the qp is destroyed.
This patch removes the call to rxe_add_ref() in send_atomic_ack() and the call to rxe_drop_ref() in free_rd_atomic_resource(). If the qp is destroyed while a peer is retrying an atomic op it will cause the operation to fail which is acceptable.
--- drivers/infiniband/sw/rxe/rxe_qp.c | 1 - drivers/infiniband/sw/rxe/rxe_resp.c | 2 -- 2 files changed, 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_qp.c +0 -1
@@ -136,7 +136,6 @@ static void free_rd_atomic_resources(struct rxe_qp *qp)void free_rd_atomic_resource (struct rxe_qp *qp,struct resp_res *res) {if (res->type ==RXE_ATOMIC_MASK ) { -rxe_drop_ref (qp);kfree_skb (res->atomic.skb); }else if (res->type ==RXE_READ_MASK ) {if (res->read.mr)
drivers/infiniband/sw/rxe/rxe_resp.c +0 -2
@@ -966,8 +966,6 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt, goto out; } -rxe_add_ref (qp); - res = &qp->resp.resources[qp->resp.res_head];free_rd_atomic_resource (qp, res);rxe_advance_resp_resource (qp);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 424/700 selftests/bpf: Whitelist test_progs.h from .gitignore
In reply to Greg Kroah-HartmanFrom: Daniel Xu <[email protected]>
[ Upstream commit 809ed84de8b3f2fd7b1d06efb94bf98fd318a7d7 ]
Somehow test_progs.h was being included by the existing rule:
/test_progs*
This is bad because:
1) test_progs.h is a checked in file
2) grep-like tools like ripgrep[0] respect gitignore and test_progs.h was being hidden from searches
[0]: https://github.com/BurntSushi/ripgrep
--- tools/testing/selftests/bpf/.gitignore | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/.gitignore +1 -0
@@ -8,6 +8,7 @@ FEATURE-DUMP.libbpf fixdep test_dev_cgroup /test_progs* +!test_progs.h test_verifier_log feature test_sock
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 425/700 xsk: Fix missing validation for skb and unaligned mode
In reply to Greg Kroah-HartmanFrom: Magnus Karlsson <[email protected]>
[ Upstream commit 2f99619820c2269534eb2c0cde44870313c6d353 ]
Fix a missing validation of a Tx descriptor when executing in skb mode and the umem is in unaligned mode. A descriptor could point to a buffer straddling the end of the umem, thus effectively tricking the kernel to read outside the allowed umem region. This could lead to a kernel crash if that part of memory is not mapped.
In zero-copy mode, the descriptor validation code rejects such descriptors by checking a bit in the DMA address that tells us if the next page is physically contiguous or not. For the last page in the umem, this bit is not set, therefore any descriptor pointing to a packet straddling this last page boundary will be rejected. However, the skb path does not use this bit since it copies out data and can do so to two different pages. (It also does not have the array of DMA address, so it cannot even store this bit.) The code just returned that the packet is always physically contiguous. But this is unfortunately also returned for the last page in the umem, which means that packets that cross the end of the umem are being allowed, which they should not be.
Fix this by introducing a check for this in the SKB path only, not penalizing the zero-copy path.
--- include/net/xsk_buff_pool.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
include/net/xsk_buff_pool.h +7 -2
@@ -147,11 +147,16 @@ static inline bool xp_desc_crosses_non_contig_pg(struct xsk_buff_pool *pool, {bool cross_pg = (addr & (PAGE_SIZE -1 )) + len >PAGE_SIZE ; -if (pool->dma_pages_cnt && cross_pg) { +if (likely (!cross_pg)) +return false; + +if (pool->dma_pages_cnt) {return !(pool->dma_pages[addr >>PAGE_SHIFT ] &XSK_NEXT_PG_CONTIG_MASK ); } -return false; + +/* skb path */ +return addr + len > pool->addrs_cnt; }static inline u64 xp_aligned_extract_addr (struct xsk_buff_pool *pool,u64 addr)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 426/700 xsk: Fix broken Tx ring validation
In reply to Greg Kroah-HartmanFrom: Magnus Karlsson <[email protected]>
[ Upstream commit f654fae47e83e56b454fbbfd0af0a4f232e356d6 ]
Fix broken Tx ring validation for AF_XDP. The commit under the Fixes tag, fixed an off-by-one error in the validation but introduced another error. Descriptors are now let through even if they straddle a chunk boundary which they are not allowed to do in aligned mode. Worse is that they are let through even if they straddle the end of the umem itself, tricking the kernel to read data outside the allowed umem region which might or might not be mapped at all.
Fix this by reintroducing the old code, but subtract the length by one to fix the off-by-one error that the original patch was addressing. The test chunk != chunk_end makes sure packets do not straddle chunk boundraries. Note that packets of zero length are allowed in the interface, therefore the test if the length is non-zero.
--- net/xdp/xsk_queue.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/xdp/xsk_queue.h +7 -4
@@ -128,12 +128,15 @@ static inline bool xskq_cons_read_addr_unchecked(struct xsk_queue *q, u64 *addr)static inline bool xp_aligned_validate_desc (struct xsk_buff_pool *pool,struct xdp_desc *desc) { -u64 chunk; - -if (desc->len > pool->chunk_size) -return false; +u64 chunk, chunk_end; chunk =xp_aligned_extract_addr (pool, desc->addr); +if (likely (desc->len)) { + chunk_end =xp_aligned_extract_addr (pool, desc->addr + desc->len -1 ); +if (chunk != chunk_end) +return false; + } +if (chunk >= pool->addrs_cnt)return false;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 427/700 bpf: Fix libelf endian handling in resolv_btfids
In reply to Greg Kroah-HartmanFrom: Tony Ambardar <[email protected]>
[ Upstream commit 61e8aeda9398925f8c6fc290585bdd9727d154c4 ]
The vmlinux ".BTF_ids" ELF section is declared in btf_ids.h to hold a list of zero-filled BTF IDs, which is then patched at link-time with correct values by resolv_btfids. The section is flagged as "allocable" to preclude compression, but notably the section contents (BTF IDs) are untyped.
When patching the BTF IDs, resolve_btfids writes in host-native endianness and relies on libelf for any required translation on reading and updating vmlinux. However, since the type of the .BTF_ids section content defaults to ELF_T_BYTE (i.e. unsigned char), no translation occurs. This results in incorrect patched values when cross-compiling to non-native endianness, and can manifest as kernel Oops and test failures which are difficult to troubleshoot [1].
Explicitly set the type of patched data to ELF_T_WORD, the architecture- neutral ELF type corresponding to the u32 BTF IDs. This enables libelf to transparently perform any needed endian conversions.
--- tools/bpf/resolve_btfids/main.c | 3 +++ 1 file changed, 3 insertions(+)
tools/bpf/resolve_btfids/main.c +3 -0
@@ -656,6 +656,9 @@ static int symbols_patch(struct object *obj)if (sets_patch (obj))return -1 ; +/* Set type to ensure endian translation occurs. */ + obj->efile.idlist->d_type =ELF_T_WORD ; +elf_flagdata (obj->efile.idlist,ELF_C_SET ,ELF_F_DIRTY ); err =elf_update (obj->efile.elf,ELF_C_WRITE );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 428/700 RDMA/rtrs-srv: Set minimal max_send_wr and max_recv_wr
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit 5e91eabf66c854f16ca2e954e5c68939bc81601e ]
Currently rtrs when create_qp use a coarse numbers (bigger in general), which leads to hardware create more resources which only waste memory with no benefits.
For max_send_wr, we don't really need alway max_qp_wr size when creating qp, reduce it to cq_size.
For max_recv_wr, cq_size is enough.
With the patch when sess_queue_depth=128, per session (2 paths) memory consumption reduced from 188 MB to 65MB
When always_invalidate is enabled, we need send more wr, so treat it special.
--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 38 +++++++++++++++++--------- 1 file changed, 25 insertions(+), 13 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +25 -13
@@ -1601,7 +1601,7 @@ static int create_con(struct rtrs_srv_sess *sess,struct rtrs_sess *s = &sess->s;struct rtrs_srv_con *con; -u32 cq_size, wr_queue_size; +u32 cq_size, max_send_wr, max_recv_wr, wr_limit;int err, cq_vector; con =kzalloc (sizeof (*con),GFP_KERNEL );
@@ -1622,30 +1622,42 @@ static int create_con(struct rtrs_srv_sess *sess,* All receive and all send (each requiring invalidate) * + 2 for drain and heartbeat */ - wr_queue_size =SERVICE_CON_QUEUE_DEPTH *3 +2 ; - cq_size = wr_queue_size; + max_send_wr =SERVICE_CON_QUEUE_DEPTH *2 +2 ; + max_recv_wr =SERVICE_CON_QUEUE_DEPTH +2 ; + cq_size = max_send_wr + max_recv_wr; }else { -/* -* If we have all receive requests posted and -* all write requests posted and each read request -* requires an invalidate request + drain -* and qp gets into error state. -*/ - cq_size = srv->queue_depth *3 +1 ;/* * In theory we might have queue_depth * 32 * outstanding requests if an unsafe global key is used * and we have queue_depth read requests each consisting * of 32 different addresses. div 3 for mlx5. */ - wr_queue_size = sess->s.dev->ib_dev->attrs.max_qp_wr /3 ; + wr_limit = sess->s.dev->ib_dev->attrs.max_qp_wr /3 ; +/* when always_invlaidate enalbed, we need linv+rinv+mr+imm */ +if (always_invalidate) + max_send_wr = +min_t (int, wr_limit, + srv->queue_depth * (1 +4 ) +1 ); +else + max_send_wr = +min_t (int, wr_limit, + srv->queue_depth * (1 +2 ) +1 ); + + max_recv_wr = srv->queue_depth +1 ; +/* +* If we have all receive requests posted and +* all write requests posted and each read request +* requires an invalidate request + drain +* and qp gets into error state. +*/ + cq_size = max_send_wr + max_recv_wr; } -atomic_set (&con->sq_wr_avail, wr_queue_size); +atomic_set (&con->sq_wr_avail, max_send_wr); cq_vector =rtrs_srv_get_next_cq_vector (sess);/* TODO: SOFTIRQ can be faster, but be careful with softirq context */ err =rtrs_cq_qp_create (&sess->s, &con->c,1 , cq_vector, cq_size, - wr_queue_size, wr_queue_size, + max_send_wr, max_recv_wr,IB_POLL_WORKQUEUE );if (err) {rtrs_err (s,"rtrs_cq_qp_create(), err: %d\n" , err);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 429/700 samples/bpf: Fix Segmentation fault for xdp_redirect command
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit 85102ba58b4125ebad941d7555c3c248b23efd16 ]
A Segmentation fault error is caused when the following command is executed.
$ sudo ./samples/bpf/xdp_redirect lo Segmentation fault
This command is missing a device <IFNAME|IFINDEX> as an argument, resulting in out-of-bounds access from argv.
If the number of devices for the xdp_redirect parameter is not 2, we should report an error and exit.
--- samples/bpf/xdp_redirect_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
samples/bpf/xdp_redirect_user.c +1 -1
@@ -130,7 +130,7 @@ int main(int argc, char **argv)if (!(xdp_flags &XDP_FLAGS_SKB_MODE )) xdp_flags |=XDP_FLAGS_DRV_MODE ; -if (optind == argc) { +if (optind +2 != argc) {printf ("usage: %s <IFNAME|IFINDEX>_IN <IFNAME|IFINDEX>_OUT\n" , argv[0 ]);return 1 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 430/700 samples/bpf: Fix the error return code of xdp_redirects main()
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit 7c6090ee2a7b3315410cfc83a94c3eb057407b25 ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
If bpf_map_update_elem() failed, main() should return a negative error.
--- samples/bpf/xdp_redirect_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
samples/bpf/xdp_redirect_user.c +1 -1
@@ -213,5 +213,5 @@ int main(int argc, char **argv)poll_stats (2 , ifindex_out); out: -return 0 ; +return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 431/700 net: pxa168_eth: Fix a potential data race in pxa168_eth_remove
In reply to Greg Kroah-HartmanFrom: Pavel Machek <[email protected]>
[ Upstream commit bd70957438f0cc4879cbdff8bbc8614bc1cddf49 ]
Commit 0571a753cb07 cancelled delayed work too late, keeping small race. Cancel work sooner to close it completely.
--- drivers/net/ethernet/marvell/pxa168_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/pxa168_eth.c +1 -1
@@ -1533,6 +1533,7 @@ static int pxa168_eth_remove(struct platform_device *pdev)struct net_device *dev =platform_get_drvdata (pdev);struct pxa168_eth_private *pep =netdev_priv (dev); +cancel_work_sync (&pep->tx_timeout_task);if (pep->htpr) {dma_free_coherent (pep->dev->dev.parent,HASH_ADDR_TABLE_SIZE , pep->htpr, pep->htpr_dma);
@@ -1544,7 +1545,6 @@ static int pxa168_eth_remove(struct platform_device *pdev)clk_disable_unprepare (pep->clk);mdiobus_unregister (pep->smi_bus);mdiobus_free (pep->smi_bus); -cancel_work_sync (&pep->tx_timeout_task);unregister_netdev (dev);free_netdev (dev);return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 432/700 mt76: fix possible NULL pointer dereference in mt76_tx
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit d7400a2f3e295b8cee692c7a66e10f60015a3c37 ]
Even if this is not a real issue since mt76_tx is never run with wcid set to NULL, fix a theoretical NULL pointer dereference in mt76_tx routine
--- drivers/net/wireless/mediatek/mt76/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/tx.c +1 -1
@@ -285,7 +285,7 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,skb_set_queue_mapping (skb, qid); } -if (!(wcid->tx_info &MT_WCID_TX_INFO_SET )) +if (wcid && !(wcid->tx_info &MT_WCID_TX_INFO_SET ))ieee80211_get_tx_rates (info->control.vif, sta, skb, info->control.rates,1 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 433/700 mt76: mt7615: fix NULL pointer dereference in tx_prepare_skb()
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 8d3cdc1bbb1d355f0ebef973175ae5fd74286feb ]
Fix theoretical NULL pointer dereference in mt7615_tx_prepare_skb and mt7663_usb_sdio_tx_prepare_skb routines. This issue has been identified by code analysis.
--- drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c | 5 +++-- drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c +3 -2
@@ -133,20 +133,21 @@ int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, struct mt76_tx_info *tx_info) { struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76); - struct mt7615_sta *msta = container_of(wcid, struct mt7615_sta, wcid);struct ieee80211_tx_info *info =IEEE80211_SKB_CB (tx_info->skb);struct ieee80211_key_conf *key = info->control.hw_key;int pid, id;u8 *txwi = (u8 *)txwi_ptr;struct mt76_txwi_cache *t; +struct mt7615_sta *msta;void *txp; + msta = wcid ? container_of(wcid, struct mt7615_sta, wcid) : NULL;if (!wcid) wcid = &dev->mt76.global_wcid; pid =mt76_tx_status_skb_add (mdev, wcid, tx_info->skb); -if (info->flags &IEEE80211_TX_CTL_RATE_CTRL_PROBE ) { +if ((info->flags &IEEE80211_TX_CTL_RATE_CTRL_PROBE ) && msta) {struct mt7615_phy *phy = &dev->phy;if ((info->hw_queue &MT_TX_HW_QUEUE_EXT_PHY ) && mdev->phy2)
drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c +3 -2
@@ -191,14 +191,15 @@ int mt7663_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,struct ieee80211_sta *sta, struct mt76_tx_info *tx_info) { - struct mt7615_sta *msta = container_of(wcid, struct mt7615_sta, wcid); struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);struct sk_buff *skb = tx_info->skb;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb); +struct mt7615_sta *msta;int pad; + msta = wcid ? container_of(wcid, struct mt7615_sta, wcid) : NULL;if ((info->flags &IEEE80211_TX_CTL_RATE_CTRL_PROBE ) && - !msta->rate_probe) { + msta && !msta->rate_probe) {/* request to configure sampling rate */ spin_lock_bh (&dev->mt76.lock); mt7615_mac_set_rates(&dev->phy, msta, &info->control.rates[0],
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 434/700 mt76: mt7921: Dont alter Rx path classifier
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 2c80c02a682aefc073df2cfbb48c77c74579cb4a ]
Keep Rx path classifier the mt7921 firmware prefers to allow frames pass through MCU.
--- .../net/wireless/mediatek/mt76/mt7921/init.c | 18 ------------------ 1 file changed, 18 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/init.c +0 -18
@@ -110,30 +110,12 @@ mt7921_init_wiphy(struct ieee80211_hw *hw)static void mt7921_mac_init_band (struct mt7921_dev *dev,u8 band) { -u32 mask, set; -mt76_rmw_field (dev,MT_TMAC_CTCR0 (band),MT_TMAC_CTCR0_INS_DDLMT_REFTIME ,0x3f );mt76_set (dev,MT_TMAC_CTCR0 (band),MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN |MT_TMAC_CTCR0_INS_DDLMT_EN ); - mask =MT_MDP_RCFR0_MCU_RX_MGMT | -MT_MDP_RCFR0_MCU_RX_CTL_NON_BAR | -MT_MDP_RCFR0_MCU_RX_CTL_BAR ; - set =FIELD_PREP (MT_MDP_RCFR0_MCU_RX_MGMT ,MT_MDP_TO_HIF ) | -FIELD_PREP (MT_MDP_RCFR0_MCU_RX_CTL_NON_BAR ,MT_MDP_TO_HIF ) | -FIELD_PREP (MT_MDP_RCFR0_MCU_RX_CTL_BAR ,MT_MDP_TO_HIF ); -mt76_rmw (dev,MT_MDP_BNRCFR0 (band), mask, set); - - mask =MT_MDP_RCFR1_MCU_RX_BYPASS | -MT_MDP_RCFR1_RX_DROPPED_UCAST | -MT_MDP_RCFR1_RX_DROPPED_MCAST ; - set =FIELD_PREP (MT_MDP_RCFR1_MCU_RX_BYPASS ,MT_MDP_TO_HIF ) | -FIELD_PREP (MT_MDP_RCFR1_RX_DROPPED_UCAST ,MT_MDP_TO_HIF ) | -FIELD_PREP (MT_MDP_RCFR1_RX_DROPPED_MCAST ,MT_MDP_TO_HIF ); -mt76_rmw (dev,MT_MDP_BNRCFR1 (band), mask, set); -mt76_set (dev,MT_WF_RMAC_MIB_TIME0 (band),MT_WF_RMAC_MIB_RXTIME_EN );mt76_set (dev,MT_WF_RMAC_MIB_AIRTIME0 (band),MT_WF_RMAC_MIB_RXTIME_EN );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 435/700 mt76: connac: fix WoW with disconnetion and bitmap pattern
In reply to Greg Kroah-HartmanFrom: YN Chen <[email protected]>
[ Upstream commit 193e5f22eeb2a9661bff8bc0d8519e6ded48c807 ]
Update MCU command usage to fix WoW configuration with disconnection and bitmap pattern and to avoid magic number.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 11 +++++++---- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h | 8 ++++++++ 2 files changed, 15 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +7 -4
@@ -1732,7 +1732,7 @@ mt76_connac_mcu_set_wow_pattern(struct mt76_dev *dev, ptlv->index = index;memcpy (ptlv->pattern, pattern->pattern, pattern->pattern_len); -memcpy (ptlv->mask, pattern->mask, pattern->pattern_len /8 ); +memcpy (ptlv->mask, pattern->mask,DIV_ROUND_UP (pattern->pattern_len,8 ));return mt76_mcu_skb_send_msg (dev, skb,MCU_UNI_CMD_SUSPEND , true); }
@@ -1767,14 +1767,17 @@ mt76_connac_mcu_set_wow_ctrl(struct mt76_phy *phy, struct ieee80211_vif *vif, };if (wowlan->magic_pkt) - req.wow_ctrl_tlv.trigger |=BIT (0 ); + req.wow_ctrl_tlv.trigger |=UNI_WOW_DETECT_TYPE_MAGIC ;if (wowlan->disconnect) - req.wow_ctrl_tlv.trigger |=BIT (2 ); + req.wow_ctrl_tlv.trigger |= (UNI_WOW_DETECT_TYPE_DISCONNECT | +UNI_WOW_DETECT_TYPE_BCN_LOST );if (wowlan->nd_config) {mt76_connac_mcu_sched_scan_req (phy, vif, wowlan->nd_config); - req.wow_ctrl_tlv.trigger |=BIT (5 ); + req.wow_ctrl_tlv.trigger |=UNI_WOW_DETECT_TYPE_SCH_SCAN_HIT ;mt76_connac_mcu_sched_scan_enable (phy, vif, suspend); } +if (wowlan->n_patterns) + req.wow_ctrl_tlv.trigger |=UNI_WOW_DETECT_TYPE_BITMAP ;if (mt76_is_mmio (dev)) req.wow_ctrl_tlv.wakeup_hif =WOW_PCIE ;
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +8 -0
@@ -589,6 +589,14 @@ enum { UNI_OFFLOAD_OFFLOAD_BMC_RPY_DETECT, }; +#define UNI_WOW_DETECT_TYPE_MAGIC BIT(0) +#define UNI_WOW_DETECT_TYPE_ANY BIT(1) +#define UNI_WOW_DETECT_TYPE_DISCONNECT BIT(2) +#define UNI_WOW_DETECT_TYPE_GTK_REKEY_FAIL BIT(3) +#define UNI_WOW_DETECT_TYPE_BCN_LOST BIT(4) +#define UNI_WOW_DETECT_TYPE_SCH_SCAN_HIT BIT(5) +#define UNI_WOW_DETECT_TYPE_BITMAP BIT(6) +enum {UNI_SUSPEND_MODE_SETTING ,UNI_SUSPEND_WOW_CTRL ,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 436/700 mt76: mt7921: consider the invalid value for to_rssi
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit edb5aebc1c3db312e74e1dcf75b8626ee5300596 ]
It is possible the RCPI from the certain antenna is an invalid value, especially packets are receiving while the system is frequently entering deep sleep mode, so consider calculating RSSI with the reasonable upper bound to avoid report the wrong value to the mac80211 layer.
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +7 -4
@@ -420,16 +420,19 @@ int mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb) status->chain_signal[1 ] =to_rssi (MT_PRXV_RCPI1 , v1); status->chain_signal[2 ] =to_rssi (MT_PRXV_RCPI2 , v1); status->chain_signal[3 ] =to_rssi (MT_PRXV_RCPI3 , v1); - status->signal = status->chain_signal[0 ]; - -for (i =1 ; i <hweight8 (mphy->antenna_mask); i++) { -if (!(status->chains &BIT (i))) + status->signal =-128 ; +for (i =0 ; i <hweight8 (mphy->antenna_mask); i++) { +if (!(status->chains &BIT (i)) || + status->chain_signal[i] >=0 )continue ; status->signal =max (status->signal, status->chain_signal[i]); } +if (status->signal ==-128 ) + status->flag |=RX_FLAG_NO_SIGNAL_VAL ; + stbc =FIELD_GET (MT_PRXV_STBC , v0); gi =FIELD_GET (MT_PRXV_SGI , v0); cck = false;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 437/700 mt76: connac: alaways wake the device before scanning
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit a61826203ba8806b4cdffd36bafdce3e9ad35c24 ]
move scanning check from mt76_connac_power_save_sched routine to mt7921_pm_power_save_work/mt7615_pm_power_save_work ones
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 4 ++++ drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 8 -------- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 4 ++++ 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +4 -0
@@ -1890,6 +1890,10 @@ void mt7615_pm_power_save_work(struct work_struct *work) pm.ps_work.work); delta = dev->pm.idle_timeout; +if (test_bit (MT76_HW_SCANNING , &dev->mphy.state) || +test_bit (MT76_HW_SCHED_SCANNING , &dev->mphy.state)) + goto out; +if (time_is_after_jiffies (dev->pm.last_activity + delta)) { delta = dev->pm.last_activity + delta - jiffies; goto out;
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +0 -8
@@ -16,10 +16,6 @@ int mt76_connac_pm_wake(struct mt76_phy *phy, struct mt76_connac_pm *pm)if (!test_bit (MT76_STATE_PM , &phy->state))return 0 ; -if (test_bit (MT76_HW_SCANNING , &phy->state) || -test_bit (MT76_HW_SCHED_SCANNING , &phy->state)) -return 0 ; -if (queue_work (dev->wq, &pm->wake_work))reinit_completion (&pm->wake_cmpl);
@@ -45,10 +41,6 @@ void mt76_connac_power_save_sched(struct mt76_phy *phy, pm->last_activity = jiffies; -if (test_bit (MT76_HW_SCANNING , &phy->state) || -test_bit (MT76_HW_SCHED_SCANNING , &phy->state)) -return ; -if (!test_bit (MT76_STATE_PM , &phy->state))queue_delayed_work (dev->wq, &pm->ps_work, pm->idle_timeout); }
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +4 -0
@@ -1524,6 +1524,10 @@ void mt7921_pm_power_save_work(struct work_struct *work) pm.ps_work.work); delta = dev->pm.idle_timeout; +if (test_bit (MT76_HW_SCANNING , &dev->mphy.state) || +test_bit (MT76_HW_SCHED_SCANNING , &dev->mphy.state)) + goto out; +if (time_is_after_jiffies (dev->pm.last_activity + delta)) { delta = dev->pm.last_activity + delta - jiffies; goto out;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 438/700 mt76: mt7921: remove redundant check on type
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 1921b8925c6f2a171af6294bba6af733da2409b9 ]
Currently in the switch statement case where type is NL80211_IFTYPE_STATION there is a check to see if type is not NL80211_IFTYPE_STATION. This check is always false and is redundant dead code that can be removed.
Addresses-Coverity: ("Logically dead code")
--- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/main.c +0 -3
@@ -239,9 +239,6 @@ static int get_omac_idx(enum nl80211_iftype type, u64 mask)if (i)return i -1 ; -if (type !=NL80211_IFTYPE_STATION ) -break ; -/* next, try to find a free repeater entry for the sta */ i =get_free_idx (mask >>REPEATER_BSSID_START ,0 ,REPEATER_BSSID_MAX -REPEATER_BSSID_START );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 439/700 mt76: mt7921: fix OMAC idx usage
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 213f87289ea01514acdbfeed9f65bcb5f12aef70 ]
OMAC idx have to be same with BSS idx according to firmware usage.
--- .../net/wireless/mediatek/mt76/mt7921/main.c | 55 +------------------ 1 file changed, 1 insertion(+), 54 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 -54
@@ -223,54 +223,6 @@ static void mt7921_stop(struct ieee80211_hw *hw)mt7921_mutex_release (dev); } -static inline int get_free_idx (u32 mask,u8 start,u8 end) -{ -return ffs (~mask &GENMASK (end, start)); -} - -static int get_omac_idx (enum nl80211_iftype type,u64 mask) -{ -int i; - -switch (type) { -case NL80211_IFTYPE_STATION : -/* prefer hw bssid slot 1-3 */ - i =get_free_idx (mask,HW_BSSID_1 ,HW_BSSID_3 ); -if (i) -return i -1 ; - -/* next, try to find a free repeater entry for the sta */ - i =get_free_idx (mask >>REPEATER_BSSID_START ,0 , -REPEATER_BSSID_MAX -REPEATER_BSSID_START ); -if (i) -return i +32 -1 ; - - i =get_free_idx (mask,EXT_BSSID_1 ,EXT_BSSID_MAX ); -if (i) -return i -1 ; - -if (~mask &BIT (HW_BSSID_0 )) -return HW_BSSID_0 ; - -break ; -case NL80211_IFTYPE_MONITOR : -/* ap uses hw bssid 0 and ext bssid */ -if (~mask &BIT (HW_BSSID_0 )) -return HW_BSSID_0 ; - - i =get_free_idx (mask,EXT_BSSID_1 ,EXT_BSSID_MAX ); -if (i) -return i -1 ; - -break ; -default : -WARN_ON (1 ); -break ; - } - -return -1 ; -} -static int mt7921_add_interface (struct ieee80211_hw *hw,struct ieee80211_vif *vif) {
@@ -292,12 +244,7 @@ static int mt7921_add_interface(struct ieee80211_hw *hw, goto out; } - idx =get_omac_idx (vif->type, phy->omac_mask); -if (idx <0 ) { - ret = -ENOSPC ; - goto out; - } - mvif->mt76.omac_idx = idx; + mvif->mt76.omac_idx = mvif->mt76.idx; mvif->phy = phy; mvif->mt76.band_idx =0 ; mvif->mt76.wmm_idx = mvif->mt76.idx %MT7921_MAX_WMM_SETS ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 440/700 mt76: mt7915: fix rx fcs error count in testmode
In reply to Greg Kroah-HartmanFrom: Shayne Chen <[email protected]>
[ Upstream commit 89043529c8b833d87391f1844e9d1cc1643393eb ]
FCS error packets are filtered by default and won't be reported to driver, so that RX fcs error and PER in testmode always show zero. Fix this issue by reading fcs error count from hw counter.
We did't fix this issue by disabling fcs error rx filter since it may let HW suffer some SER errors.
--- .../wireless/mediatek/mt76/mt7915/testmode.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/testmode.c +19 -2
@@ -476,10 +476,17 @@ mt7915_tm_set_tx_frames(struct mt7915_phy *phy, bool en)static void mt7915_tm_set_rx_frames (struct mt7915_phy *phy,bool en) { -if (en) +mt7915_tm_set_trx (phy,TM_MAC_RX_RXV , false); + +if (en) { +struct mt7915_dev *dev = phy->dev; +mt7915_tm_update_channel (phy); -mt7915_tm_set_trx (phy,TM_MAC_RX_RXV , en); +/* read-clear */ +mt76_rr (dev,MT_MIB_SDR3 (phy != &dev->phy)); +mt7915_tm_set_trx (phy,TM_MAC_RX_RXV , en); + } } static int
@@ -702,7 +709,11 @@ static int mt7915_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg) { struct mt7915_phy *phy = mphy->priv; +struct mt7915_dev *dev = phy->dev; +bool ext_phy = phy != &dev->phy; +enum mt76_rxq_id q;void *rx, *rssi; +u16 fcs_err;int i; rx =nla_nest_start (msg,MT76_TM_STATS_ATTR_LAST_RX );
@@ -747,6 +758,12 @@ mt7915_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg)nla_nest_end (msg, rx); + fcs_err =mt76_get_field (dev,MT_MIB_SDR3 (ext_phy), +MT_MIB_SDR3_FCS_ERR_MASK ); + q = ext_phy ?MT_RXQ_EXT :MT_RXQ_MAIN ; + mphy->test.rx_stats.packets[q] += fcs_err; + mphy->test.rx_stats.fcs_error[q] += fcs_err; +return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 441/700 net: ethernet: aeroflex: fix UAF in greth_of_remove
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit e3a5de6d81d8b2199935c7eb3f7d17a50a7075b7 ]
static int greth_of_remove(struct platform_device *of_dev) {
...
struct greth_private *greth = netdev_priv(ndev); ... unregister_netdev(ndev); free_netdev(ndev); of_iounmap(&of_dev->resource[0], greth->regs, resource_size(&of_dev->resource[0]));
...
}
greth is netdev private data, but it is used
after free_netdev(). It can cause use-after-free when accessing greth pointer. So, fix it by moving free_netdev() after of_iounmap() call.
--- drivers/net/ethernet/aeroflex/greth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/aeroflex/greth.c +2 -1
@@ -1539,10 +1539,11 @@ static int greth_of_remove(struct platform_device *of_dev)mdiobus_unregister (greth->mdio);unregister_netdev (ndev); -free_netdev (ndev);of_iounmap (&of_dev->resource[0 ], greth->regs,resource_size (&of_dev->resource[0 ])); +free_netdev (ndev); +return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 442/700 net: ethernet: ezchip: fix UAF in nps_enet_remove
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit e4b8700e07a86e8eab6916aa5c5ba99042c34089 ]
priv is netdev private data, but it is used
after free_netdev(). It can cause use-after-free when accessing priv pointer. So, fix it by moving free_netdev() after netif_napi_del() call.
--- drivers/net/ethernet/ezchip/nps_enet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ezchip/nps_enet.c +1 -1
@@ -645,8 +645,8 @@ static s32 nps_enet_remove(struct platform_device *pdev)struct nps_enet_priv *priv =netdev_priv (ndev);unregister_netdev (ndev); -free_netdev (ndev);netif_napi_del (&priv->napi); +free_netdev (ndev);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 443/700 net: ethernet: ezchip: fix error handling
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 0de449d599594f5472e00267d651615c7f2c6c1d ]
As documented at drivers/base/platform.c for platform_get_irq:
* Gets an IRQ for a platform device and prints an error message if finding the
* IRQ fails. Device drivers should check the return value for errors so as to
* not pass a negative integer value to the request_irq() APIs.
So, the driver should check that platform_get_irq() return value is _negative_, not that it's equal to zero, because -ENXIO (return value from request_irq() if irq was not found) will
pass this check and it leads to passing negative irq to request_irq()
--- drivers/net/ethernet/ezchip/nps_enet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ezchip/nps_enet.c +1 -1
@@ -610,7 +610,7 @@ static s32 nps_enet_probe(struct platform_device *pdev)/* Get IRQ number */ priv->irq =platform_get_irq (pdev,0 ); -if (!priv->irq) { +if (priv->irq <0 ) {dev_err (dev,"failed to retrieve <irq Rx-Tx> value from device tree\n" ); err = -ENODEV ; goto out_netdev;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 444/700 vrf: do not push non-ND strict packets with a source LLA through packet taps again
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit 603113c514e95c3350598bc3cccbd03af7ea4ab2 ]
Non-ND strict packets with a source LLA go through the packet taps again, while non-ND strict packets with other source addresses do not, and we can see a clone of those packets on the vrf interface (we should not). This is due to a series of changes:
Commit 6f12fa775530[1] made non-ND strict packets not being pushed again in the packet taps. This changed with commit 205704c618af[2] for those packets having a source LLA, as they need a lookup with the orig_iif.
The issue now is those packets do not skip the 'vrf_ip6_rcv' function to the end (as the ones without a source LLA) and go through the check to call packet taps again. This check was changed by commit 6f12fa775530[1] and do not exclude non-strict packets anymore. Packets matching 'need_strict && !is_ndisc && is_ll_src' are now being sent through the packet taps again. This can be seen by dumping packets on the vrf interface.
Fix this by having the same code path for all non-ND strict packets and selectively lookup with the orig_iif for those with a source LLA. This has the effect to revert to the pre-205704c618af[2] condition, which should also be easier to maintain.
[1] 6f12fa775530 ("vrf: mark skb for multicast or link-local as enslaved to VRF")
[2] 205704c618af ("vrf: packets with lladdr src needs dst at input with orig_iif when needs strict")
--- drivers/net/vrf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/vrf.c +7 -7
@@ -1366,22 +1366,22 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,int orig_iif = skb->skb_iif;bool need_strict =rt6_need_strict (&ipv6_hdr (skb)->daddr);bool is_ndisc =ipv6_ndisc_frame (skb); -bool is_ll_src;/* loopback, multicast & non-ND link-local traffic; do not push through * packet taps again. Reset pkt_type for upper layers to process skb. -* for packets with lladdr src, however, skip so that the dst can be -* determine at input using original ifindex in the case that daddr -* needs strict +* For strict packets with a source LLA, determine the dst using the +* original ifindex. */ - is_ll_src =ipv6_addr_type (&ipv6_hdr (skb)->saddr) &IPV6_ADDR_LINKLOCAL ; -if (skb->pkt_type ==PACKET_LOOPBACK || - (need_strict && !is_ndisc && !is_ll_src)) { +if (skb->pkt_type ==PACKET_LOOPBACK || (need_strict && !is_ndisc)) { skb->dev = vrf_dev; skb->skb_iif = vrf_dev->ifindex;IP6CB (skb)->flags |=IP6SKB_L3SLAVE ; +if (skb->pkt_type ==PACKET_LOOPBACK ) skb->pkt_type =PACKET_HOST ; +else if (ipv6_addr_type (&ipv6_hdr (skb)->saddr) &IPV6_ADDR_LINKLOCAL ) +vrf_ip6_input_dst (skb, vrf_dev, orig_iif); + goto out; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 445/700 net: sched: add barrier to ensure correct ordering for lockless qdisc
In reply to Greg Kroah-HartmanFrom: Yunsheng Lin <[email protected]>
[ Upstream commit 89837eb4b2463c556a123437f242d6c2bc62ce81 ]
The spin_trylock() was assumed to contain the implicit barrier needed to ensure the correct ordering between STATE_MISSED setting/clearing and STATE_MISSED checking in commit a90c57f2cedd ("net: sched: fix packet stuck problem for lockless qdisc").
But it turns out that spin_trylock() only has load-acquire semantic, for strongly-ordered system(like x86), the compiler barrier implicitly contained in spin_trylock() seems enough to ensure the correct ordering. But for weakly-orderly system (like arm64), the store-release semantic is needed to ensure the correct ordering as clear_bit() and test_bit() is store operation, see queued_spin_lock().
So add the explicit barrier to ensure the correct ordering for the above case.
--- include/net/sch_generic.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
include/net/sch_generic.h +12 -0
@@ -163,6 +163,12 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)if (spin_trylock (&qdisc->seqlock)) goto nolock_empty; +/* Paired with smp_mb__after_atomic() to make sure +* STATE_MISSED checking is synchronized with clearing +* in pfifo_fast_dequeue(). +*/ +smp_mb__before_atomic (); +/* If the MISSED flag is set, it means other thread has * set the MISSED flag before second spin_trylock(), so * we can return false here to avoid multi cpus doing
@@ -180,6 +186,12 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)*/ set_bit (__QDISC_STATE_MISSED, &qdisc->state); +/* spin_trylock() only has load-acquire semantic, so use +* smp_mb__after_atomic() to ensure STATE_MISSED is set +* before doing the second spin_trylock(). +*/ +smp_mb__after_atomic (); +/* Retry again in case other CPU may not see the new flag * after it releases the lock at the end of qdisc_run_end(). */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 446/700 selftests: tls: clean up uninitialized warnings
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit baa00119d69e3318da8d99867fc1170ebddf09ce ]
A bunch of tests uses uninitialized stack memory as random data to send. This is harmless but generates compiler warnings. Explicitly init the buffers with random data.
--- tools/testing/selftests/net/tls.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
tools/testing/selftests/net/tls.c +20 -0
@@ -25,6 +25,18 @@#define TLS_PAYLOAD_MAX_LEN 16384#define SOL_TLS 282 +static void memrnd (void *s,size_t n) +{ +int *dword = s; +char *byte; + +for (; n >=4 ; n -=4 ) + *dword++ =rand (); + byte = (void *)dword; +while (n--) + *byte++ =rand (); +} +FIXTURE (tls_basic) {int fd, cfd;
@@ -308,6 +320,8 @@ TEST_F(tls, recv_max)char recv_mem[TLS_PAYLOAD_MAX_LEN ];char buf[TLS_PAYLOAD_MAX_LEN ]; +memrnd (buf,sizeof (buf)); +EXPECT_GE (send (self->fd, buf, send_len,0 ),0 );EXPECT_NE (recv (self->cfd, recv_mem, send_len,0 ),-1 );EXPECT_EQ (memcmp (buf, recv_mem, send_len),0 );
@@ -588,6 +602,8 @@ TEST_F(tls, recvmsg_single_max)struct iovec vec;struct msghdr hdr; +memrnd (send_mem,sizeof (send_mem)); +EXPECT_EQ (send (self->fd, send_mem, send_len,0 ), send_len); vec.iov_base = (char *)recv_mem; vec.iov_len =TLS_PAYLOAD_MAX_LEN ;
@@ -610,6 +626,8 @@ TEST_F(tls, recvmsg_multiple)struct msghdr hdr;int i; +memrnd (buf,sizeof (buf)); +EXPECT_EQ (send (self->fd, buf, send_len,0 ), send_len);for (i =0 ; i < msg_iovlen; i++) { iov_base[i] = (char *)malloc (iov_len);
@@ -634,6 +652,8 @@ TEST_F(tls, single_send_multiple_recv)char send_mem[TLS_PAYLOAD_MAX_LEN *2 ];char recv_mem[TLS_PAYLOAD_MAX_LEN *2 ]; +memrnd (send_mem,sizeof (send_mem)); +EXPECT_GE (send (self->fd, send_mem, total_len,0 ),0 );memset (recv_mem,0 , total_len);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 447/700 selftests: tls: fix chacha+bidir tests
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 291c53e4dacd3a2cc3152d8af37f07f8496c594a ]
ChaCha support did not adjust the bidirectional test. We need to set up KTLS in reverse direction correctly, otherwise these two cases will fail:
tls.12_chacha.bidir
tls.13_chacha.bidir
--- tools/testing/selftests/net/tls.c | 67 ++++++++++++++++++------------- 1 file changed, 39 insertions(+), 28 deletions(-)
tools/testing/selftests/net/tls.c +39 -28
@@ -25,6 +25,35 @@#define TLS_PAYLOAD_MAX_LEN 16384#define SOL_TLS 282 +struct tls_crypto_info_keys { +union { +struct tls12_crypto_info_aes_gcm_128 aes128; +struct tls12_crypto_info_chacha20_poly1305 chacha20; + }; +size_t len; +}; + +static void tls_crypto_info_init (uint16_t tls_version,uint16_t cipher_type, +struct tls_crypto_info_keys *tls12) +{ +memset (tls12,0 ,sizeof (*tls12)); + +switch (cipher_type) { +case TLS_CIPHER_CHACHA20_POLY1305 : + tls12->len =sizeof (struct tls12_crypto_info_chacha20_poly1305 ); + tls12->chacha20.info.version = tls_version; + tls12->chacha20.info.cipher_type = cipher_type; +break ; +case TLS_CIPHER_AES_GCM_128 : + tls12->len =sizeof (struct tls12_crypto_info_aes_gcm_128 ); + tls12->aes128.info.version = tls_version; + tls12->aes128.info.cipher_type = cipher_type; +break ; +default : +break ; + } +} +static void memrnd (void *s,size_t n) {int *dword = s;
@@ -145,33 +174,16 @@ FIXTURE_VARIANT_ADD(tls, 13_chacha)FIXTURE_SETUP (tls) { -union { -struct tls12_crypto_info_aes_gcm_128 aes128; -struct tls12_crypto_info_chacha20_poly1305 chacha20; - } tls12; +struct tls_crypto_info_keys tls12;struct sockaddr_in addr;socklen_t len;int sfd, ret; -size_t tls12_sz; self->notls = false; len =sizeof (addr); -memset (&tls12,0 ,sizeof (tls12)); -switch (variant->cipher_type) { -case TLS_CIPHER_CHACHA20_POLY1305 : - tls12_sz =sizeof (struct tls12_crypto_info_chacha20_poly1305 ); - tls12.chacha20.info.version = variant->tls_version; - tls12.chacha20.info.cipher_type = variant->cipher_type; -break ; -case TLS_CIPHER_AES_GCM_128 : - tls12_sz =sizeof (struct tls12_crypto_info_aes_gcm_128 ); - tls12.aes128.info.version = variant->tls_version; - tls12.aes128.info.cipher_type = variant->cipher_type; -break ; -default : - tls12_sz =0 ; - } +tls_crypto_info_init (variant->tls_version, variant->cipher_type, + &tls12); addr.sin_family =AF_INET ; addr.sin_addr.s_addr =htonl (INADDR_ANY );
@@ -199,7 +211,7 @@ FIXTURE_SETUP(tls)if (!self->notls) { ret =setsockopt (self->fd,SOL_TLS ,TLS_TX , &tls12, - tls12_sz); + tls12.len);ASSERT_EQ (ret,0 ); }
@@ -212,7 +224,7 @@ FIXTURE_SETUP(tls)ASSERT_EQ (ret,0 ); ret =setsockopt (self->cfd,SOL_TLS ,TLS_RX , &tls12, - tls12_sz); + tls12.len);ASSERT_EQ (ret,0 ); }
@@ -854,18 +866,17 @@ TEST_F(tls, bidir)int ret;if (!self->notls) { -struct tls12_crypto_info_aes_gcm_128 tls12; +struct tls_crypto_info_keys tls12; -memset (&tls12,0 ,sizeof (tls12)); - tls12.info.version = variant->tls_version; - tls12.info.cipher_type =TLS_CIPHER_AES_GCM_128 ; +tls_crypto_info_init (variant->tls_version, variant->cipher_type, + &tls12); ret =setsockopt (self->fd,SOL_TLS ,TLS_RX , &tls12, -sizeof (tls12)); + tls12.len);ASSERT_EQ (ret,0 ); ret =setsockopt (self->cfd,SOL_TLS ,TLS_TX , &tls12, -sizeof (tls12)); + tls12.len);ASSERT_EQ (ret,0 ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 448/700 tls: prevent oversized sendfile() hangs by ignoring MSG_MORE
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit d452d48b9f8b1a7f8152d33ef52cfd7fe1735b0a ]
We got multiple reports that multi_chunk_sendfile test case from tls selftest fails. This was sort of expected, as the original fix was never applied (see it in the first Link:). The test in question uses sendfile() with count larger than the size of the underlying file. This will make splice set MSG_MORE on all sendpage calls, meaning TLS will never close and flush the last partial record.
Eric seem to have addressed a similar problem in
commit 35f9c09fe9c7 ("tcp: tcp_sendpages() should call tcp_push() once") by introducing MSG_SENDPAGE_NOTLAST. Unlike MSG_MORE MSG_SENDPAGE_NOTLAST is not set on the last call
of a "pipefull" of data (PIPE_DEF_BUFFERS == 16,
so every 16 pages or whenever we run out of data).
Having a break every 16 pages should be fine, TLS can pack exactly 4 pages into a record, so for aligned reads there should be no difference, unaligned may see one extra record per sendpage().
Sticking to TCP semantics seems preferable to modifying splice, but we can revisit it if real life scenarios show a regression.
--- net/tls/tls_sw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/tls/tls_sw.c +1 -1
@@ -1153,7 +1153,7 @@ static int tls_sw_do_sendpage(struct sock *sk, struct page *page,int ret =0 ;bool eor; - eor = !(flags & (MSG_MORE |MSG_SENDPAGE_NOTLAST )); + eor = !(flags &MSG_SENDPAGE_NOTLAST );sk_clear_bit (SOCKWQ_ASYNC_NOSPACE , sk);/* Call the sk_stream functions to manage the sndbuf mem. */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 449/700 netfilter: nf_tables_offload: check FLOW_DISSECTOR_KEY_BASIC in VLAN transfer logic
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit ea45fdf82cc90430bb7c280e5e53821e833782c5 ]
The VLAN transfer logic should actually check for FLOW_DISSECTOR_KEY_BASIC, not FLOW_DISSECTOR_KEY_CONTROL. Moreover, do not fallback to case 2) .n_proto is set to 802.1q or 802.1ad, if FLOW_DISSECTOR_KEY_BASIC is unset.
--- net/netfilter/nf_tables_offload.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
net/netfilter/nf_tables_offload.c +7 -10
@@ -54,15 +54,10 @@ static void nft_flow_rule_transfer_vlan(struct nft_offload_ctx *ctx, struct nft_flow_rule *flow) {struct nft_flow_match *match = &flow->match; -struct nft_offload_ethertype ethertype; - -if (match->dissector.used_keys &BIT (FLOW_DISSECTOR_KEY_CONTROL ) && - match->key.basic.n_proto !=htons (ETH_P_8021Q ) && - match->key.basic.n_proto !=htons (ETH_P_8021AD )) -return ; - - ethertype.value = match->key.basic.n_proto; - ethertype.mask = match->mask.basic.n_proto; +struct nft_offload_ethertype ethertype = { + .value = match->key.basic.n_proto, + .mask = match->mask.basic.n_proto, + }; if (match->dissector.used_keys & BIT(FLOW_DISSECTOR_KEY_VLAN) && (match->key.vlan.vlan_tpid == htons(ETH_P_8021Q) ||
@@ -76,7 +71,9 @@ static void nft_flow_rule_transfer_vlan(struct nft_offload_ctx *ctx, match->dissector.offset[FLOW_DISSECTOR_KEY_CVLAN ] = offsetof(struct nft_flow_key , cvlan); match->dissector.used_keys |=BIT (FLOW_DISSECTOR_KEY_CVLAN ); - }else { + }else if (match->dissector.used_keys &BIT (FLOW_DISSECTOR_KEY_BASIC ) && + (match->key.basic.n_proto ==htons (ETH_P_8021Q ) || + match->key.basic.n_proto ==htons (ETH_P_8021AD ))) { match->key.basic.n_proto = match->key.vlan.vlan_tpid; match->mask.basic.n_proto = match->mask.vlan.vlan_tpid; match->key.vlan.vlan_tpid = ethertype.value;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 450/700 net: dsa: mv88e6xxx: Fix adding vlan 0
In reply to Greg Kroah-HartmanFrom: Eldar Gasanov <[email protected]>
[ Upstream commit b8b79c414eca4e9bcab645e02cb92c48db974ce9 ]
8021q module adds vlan 0 to all interfaces when it starts. When 8021q module is loaded it isn't possible to create bond with mv88e6xxx interfaces, bonding module dipslay error "Couldn't add bond vlan ids", because it tries to add vlan 0 to slave interfaces.
There is unexpected behavior in the switch. When a PVID is assigned to a port the switch changes VID to PVID in ingress frames with VID 0 on the port. Expected that the switch doesn't assign PVID to tagged frames with VID 0. But there isn't a way to change this behavior in the switch.
--- drivers/net/dsa/mv88e6xxx/chip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +3 -3
@@ -1552,9 +1552,6 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port,struct mv88e6xxx_vtu_entry vlan;int i, err; -if (!vid) -return -EOPNOTSUPP ; -/* DSA and CPU ports have to be members of multiple vlans */ if (dsa_is_dsa_port (ds, port) ||dsa_is_cpu_port (ds, port))return 0 ;
@@ -1993,6 +1990,9 @@ static int mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port,u8 member;int err; +if (!vlan->vid) +return 0 ; + err =mv88e6xxx_port_vlan_prepare (ds, port, vlan);if (err)return err;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 451/700 pkt_sched: sch_qfq: fix qfq_change_class() error path
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 0cd58e5c53babb9237b741dbef711f0a9eb6d3fd ]
If qfq_change_class() is unable to allocate memory for qfq_aggregate, it frees the class that has been inserted in the class hash table, but does not unhash it.
Defer the insertion after the problematic allocation.
BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:884 [inline]
BUG: KASAN: use-after-free in qdisc_class_hash_insert+0x200/0x210 net/sched/sch_api.c:731
Write of size 8 at addr ffff88814a534f10 by task syz-executor.4/31478
CPU: 0 PID: 31478 Comm: syz-executor.4 Not tainted 5.13.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x141/0x1d7 lib/dump_stack.c:120
print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:233
__kasan_report mm/kasan/report.c:419 [inline]
kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436
hlist_add_head include/linux/list.h:884 [inline]
qdisc_class_hash_insert+0x200/0x210 net/sched/sch_api.c:731
qfq_change_class+0x96c/0x1990 net/sched/sch_qfq.c:489
tc_ctl_tclass+0x514/0xe50 net/sched/sch_api.c:2113
rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5564
netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504
netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340
netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1929
sock_sendmsg_nosec net/socket.c:654 [inline]
sock_sendmsg+0xcf/0x120 net/socket.c:674
____sys_sendmsg+0x6e8/0x810 net/socket.c:2350
___sys_sendmsg+0xf3/0x170 net/socket.c:2404
__sys_sendmsg+0xe5/0x1b0 net/socket.c:2433
do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x4665d9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fdc7b5f0188 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665d9
RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000003
RBP: 00007fdc7b5f01d0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002
R13: 00007ffcf7310b3f R14: 00007fdc7b5f0300 R15: 0000000000022000
Allocated by task 31445:
kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:428 [inline]
____kasan_kmalloc mm/kasan/common.c:507 [inline]
____kasan_kmalloc mm/kasan/common.c:466 [inline]
__kasan_kmalloc+0x9b/0xd0 mm/kasan/common.c:516
kmalloc include/linux/slab.h:556 [inline]
kzalloc include/linux/slab.h:686 [inline]
qfq_change_class+0x705/0x1990 net/sched/sch_qfq.c:464
tc_ctl_tclass+0x514/0xe50 net/sched/sch_api.c:2113
rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5564
netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504
netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340
netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1929
sock_sendmsg_nosec net/socket.c:654 [inline]
sock_sendmsg+0xcf/0x120 net/socket.c:674
____sys_sendmsg+0x6e8/0x810 net/socket.c:2350
___sys_sendmsg+0xf3/0x170 net/socket.c:2404
__sys_sendmsg+0xe5/0x1b0 net/socket.c:2433
do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
entry_SYSCALL_64_after_hwframe+0x44/0xae
Freed by task 31445:
kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357
____kasan_slab_free mm/kasan/common.c:360 [inline]
____kasan_slab_free mm/kasan/common.c:325 [inline]
__kasan_slab_free+0xfb/0x130 mm/kasan/common.c:368
kasan_slab_free include/linux/kasan.h:212 [inline]
slab_free_hook mm/slub.c:1583 [inline]
slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1608
slab_free mm/slub.c:3168 [inline]
kfree+0xe5/0x7f0 mm/slub.c:4212
qfq_change_class+0x10fb/0x1990 net/sched/sch_qfq.c:518
tc_ctl_tclass+0x514/0xe50 net/sched/sch_api.c:2113
rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5564
netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504
netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340
netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1929
sock_sendmsg_nosec net/socket.c:654 [inline]
sock_sendmsg+0xcf/0x120 net/socket.c:674
____sys_sendmsg+0x6e8/0x810 net/socket.c:2350
___sys_sendmsg+0xf3/0x170 net/socket.c:2404
__sys_sendmsg+0xe5/0x1b0 net/socket.c:2433
do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
entry_SYSCALL_64_after_hwframe+0x44/0xae
The buggy address belongs to the object at ffff88814a534f00
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 16 bytes inside of
128-byte region [ffff88814a534f00, ffff88814a534f80)
The buggy address belongs to the page:
page:ffffea0005294d00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14a534
flags: 0x57ff00000000200(slab|node=1|zone=2|lastcpupid=0x7ff)
raw: 057ff00000000200 ffffea00004fee00 0000000600000006 ffff8880110418c0
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 29797, ts 604817765317, free_ts 604810151744
prep_new_page mm/page_alloc.c:2358 [inline]
get_page_from_freelist+0x1033/0x2b60 mm/page_alloc.c:3994
__alloc_pages+0x1b2/0x500 mm/page_alloc.c:5200
alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2272
alloc_slab_page mm/slub.c:1646 [inline]
allocate_slab+0x2c5/0x4c0 mm/slub.c:1786
new_slab mm/slub.c:1849 [inline]
new_slab_objects mm/slub.c:2595 [inline]
___slab_alloc+0x4a1/0x810 mm/slub.c:2758
__slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2798
slab_alloc_node mm/slub.c:2880 [inline]
slab_alloc mm/slub.c:2922 [inline]
__kmalloc+0x315/0x330 mm/slub.c:4050
kmalloc include/linux/slab.h:561 [inline]
kzalloc include/linux/slab.h:686 [inline]
__register_sysctl_table+0x112/0x1090 fs/proc/proc_sysctl.c:1318
mpls_dev_sysctl_register+0x1b7/0x2d0 net/mpls/af_mpls.c:1421
mpls_add_dev net/mpls/af_mpls.c:1472 [inline]
mpls_dev_notify+0x214/0x8b0 net/mpls/af_mpls.c:1588
notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2121
call_netdevice_notifiers_extack net/core/dev.c:2133 [inline]
call_netdevice_notifiers net/core/dev.c:2147 [inline]
register_netdevice+0x106b/0x1500 net/core/dev.c:10312
veth_newlink+0x585/0xac0 drivers/net/veth.c:1547
__rtnl_newlink+0x1062/0x1710 net/core/rtnetlink.c:3452
rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3500
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1298 [inline]
free_pcp_prepare+0x223/0x300 mm/page_alloc.c:1342
free_unref_page_prepare mm/page_alloc.c:3250 [inline]
free_unref_page+0x12/0x1d0 mm/page_alloc.c:3298
__vunmap+0x783/0xb60 mm/vmalloc.c:2566
free_work+0x58/0x70 mm/vmalloc.c:80
process_one_work+0x98d/0x1600 kernel/workqueue.c:2276
worker_thread+0x64c/0x1120 kernel/workqueue.c:2422
kthread+0x3b1/0x4a0 kernel/kthread.c:313
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294
Memory state around the buggy address:
ffff88814a534e00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88814a534e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88814a534f00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88814a534f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88814a535000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00--- net/sched/sch_qfq.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
net/sched/sch_qfq.c +3 -5
@@ -485,11 +485,6 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,if (cl->qdisc != &noop_qdisc)qdisc_hash_add (cl->qdisc, true); -sch_tree_lock (sch); -qdisc_class_hash_insert (&q->clhash, &cl->common); -sch_tree_unlock (sch); - -qdisc_class_hash_grow (sch, &q->clhash); set_change_agg:sch_tree_lock (sch);
@@ -507,8 +502,11 @@ set_change_agg: }if (existing)qfq_deact_rm_from_agg (q, cl); +else +qdisc_class_hash_insert (&q->clhash, &cl->common);qfq_add_to_agg (q, new_agg, cl);sch_tree_unlock (sch); +qdisc_class_hash_grow (sch, &q->clhash); *arg = (unsigned long )cl;return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 452/700 xfrm: Fix xfrm offload fallback fail case
In reply to Greg Kroah-HartmanFrom: Ayush Sawal <[email protected]>
[ Upstream commit dd72fadf2186fc8a6018f97fe72f4d5ca05df440 ]
In case of xfrm offload, if xdo_dev_state_add() of driver returns -EOPNOTSUPP, xfrm offload fallback is failed.
In xfrm state_add() both xso->dev and xso->real_dev are initialized to dev and when err(-EOPNOTSUPP) is returned only xso->dev is set to null.
So in this scenario the condition in func validate_xmit_xfrm(), if ((x->xso.dev != dev) && (x->xso.real_dev == dev))
return skb;
returns true, due to which skb is returned without calling esp_xmit() below which has fallback code. Hence the CRYPTO_FALLBACK is failing.
So fixing this with by keeping x->xso.real_dev as NULL when err is returned in func xfrm_dev_state_add().
--- net/xfrm/xfrm_device.c | 1 + 1 file changed, 1 insertion(+)
net/xfrm/xfrm_device.c +1 -0
@@ -268,6 +268,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x, xso->num_exthdrs =0 ; xso->flags =0 ; xso->dev =NULL ; + xso->real_dev =NULL ;dev_put (dev);if (err != -EOPNOTSUPP )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 453/700 netfilter: nf_tables: skip netlink portID validation if zero
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 534799097a777e82910f77a4f9d289c815a9a64e ]
nft_table_lookup() allows us to obtain the table object by the name and the family. The netlink portID validation needs to be skipped for the dump path, since the ownership only applies to commands to update the given table. Skip validation if the specified netlink PortID is zero when calling nft_table_lookup().
--- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +1 -1
@@ -521,7 +521,7 @@ static struct nft_table *nft_table_lookup(const struct net *net, table->family == family && nft_active_genmask(table, genmask)) {if (nft_table_has_owner (table) && - table->nlpid != nlpid) + nlpid && table->nlpid != nlpid)return ERR_PTR (-EPERM );return table;
Signature · 1 line
2.30.2