5.10.50-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 286/593 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 287/593 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
@@ -1368,9 +1368,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);
@@ -1513,6 +1518,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 288/593 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
@@ -1242,9 +1242,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 289/593 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 290/593 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 291/593 mm/debug_vm_pgtable/basic: add validation for dirtiness after write protect
In reply to Greg Kroah-HartmanFrom: Anshuman Khandual <[email protected]>
[ Upstream commit bb5c47ced46797409f4791d0380db3116d93134c ]
Patch series "mm/debug_vm_pgtable: Some minor updates", v3.
This series contains some cleanups and new test suggestions from Catalin from an earlier discussion.
https://lore.kernel.org/linux-mm/20201123142237.GF17833@gaia/
This patch (of 2):
This adds validation tests for dirtiness after write protect conversion for each page table level. There are two new separate test types involved here.
The first test ensures that a given page table entry does not become dirty after pxx_wrprotect(). This is important for platforms like arm64 which transfers and drops the hardware dirty bit (!PTE_RDONLY) to the software dirty bit while making it an write protected one. This test ensures that no fresh page table entry could be created with hardware dirty bit set. The second test ensures that a given page table entry always preserve the dirty information across pxx_wrprotect().
This adds two previously missing PUD level basic tests and while here fixes pxx_wrprotect() related typos in the documentation file.
--- Documentation/vm/arch_pgtable_helpers.rst | 8 ++--- mm/debug_vm_pgtable.c | 39 +++++++++++++++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-)
Documentation/vm/arch_pgtable_helpers.rst +4 -4
@@ -50,7 +50,7 @@ PTE Page Table Helpers +---------------------------+--------------------------------------------------+ | pte_mkwrite | Creates a writable PTE | +---------------------------+--------------------------------------------------+ -| pte_mkwrprotect | Creates a write protected PTE | +| pte_wrprotect | Creates a write protected PTE | +---------------------------+--------------------------------------------------+ | pte_mkspecial | Creates a special PTE | +---------------------------+--------------------------------------------------+
@@ -120,7 +120,7 @@ PMD Page Table Helpers +---------------------------+--------------------------------------------------+ | pmd_mkwrite | Creates a writable PMD | +---------------------------+--------------------------------------------------+ -| pmd_mkwrprotect | Creates a write protected PMD | +| pmd_wrprotect | Creates a write protected PMD | +---------------------------+--------------------------------------------------+ | pmd_mkspecial | Creates a special PMD | +---------------------------+--------------------------------------------------+
@@ -186,7 +186,7 @@ PUD Page Table Helpers +---------------------------+--------------------------------------------------+ | pud_mkwrite | Creates a writable PUD | +---------------------------+--------------------------------------------------+ -| pud_mkwrprotect | Creates a write protected PUD | +| pud_wrprotect | Creates a write protected PUD | +---------------------------+--------------------------------------------------+ | pud_mkdevmap | Creates a ZONE_DEVICE mapped PUD | +---------------------------+--------------------------------------------------+
@@ -224,7 +224,7 @@ HugeTLB Page Table Helpers +---------------------------+--------------------------------------------------+ | huge_pte_mkwrite | Creates a writable HugeTLB | +---------------------------+--------------------------------------------------+ -| huge_pte_mkwrprotect | Creates a write protected HugeTLB | +| huge_pte_wrprotect | Creates a write protected HugeTLB | +---------------------------+--------------------------------------------------+ | huge_ptep_get_and_clear | Clears a HugeTLB | +---------------------------+--------------------------------------------------+
mm/debug_vm_pgtable.c +39 -0
@@ -63,6 +63,16 @@ static void __init pte_basic_tests(unsigned long pfn, pgprot_t prot)pte_t pte =pfn_pte (pfn, prot);pr_debug ("Validating PTE basic\n" ); + +/* +* This test needs to be executed after the given page table entry +* is created with pfn_pte() to make sure that protection_map[idx] +* does not have the dirty bit enabled from the beginning. This is +* important for platforms like arm64 where (!PTE_RDONLY) indicate +* dirty bit being set. +*/ +WARN_ON (pte_dirty (pte_wrprotect (pte))); +WARN_ON (!pte_same (pte, pte));WARN_ON (!pte_young (pte_mkyoung (pte_mkold (pte))));WARN_ON (!pte_dirty (pte_mkdirty (pte_mkclean (pte))));
@@ -70,6 +80,8 @@ static void __init pte_basic_tests(unsigned long pfn, pgprot_t prot)WARN_ON (pte_young (pte_mkold (pte_mkyoung (pte))));WARN_ON (pte_dirty (pte_mkclean (pte_mkdirty (pte))));WARN_ON (pte_write (pte_wrprotect (pte_mkwrite (pte)))); +WARN_ON (pte_dirty (pte_wrprotect (pte_mkclean (pte)))); +WARN_ON (!pte_dirty (pte_wrprotect (pte_mkdirty (pte)))); } static void __init pte_advanced_tests(struct mm_struct *mm,
@@ -137,6 +149,17 @@ static void __init pmd_basic_tests(unsigned long pfn, pgprot_t prot)return ;pr_debug ("Validating PMD basic\n" ); + +/* +* This test needs to be executed after the given page table entry +* is created with pfn_pmd() to make sure that protection_map[idx] +* does not have the dirty bit enabled from the beginning. This is +* important for platforms like arm64 where (!PTE_RDONLY) indicate +* dirty bit being set. +*/ +WARN_ON (pmd_dirty (pmd_wrprotect (pmd))); + +WARN_ON (!pmd_same (pmd, pmd));WARN_ON (!pmd_young (pmd_mkyoung (pmd_mkold (pmd))));WARN_ON (!pmd_dirty (pmd_mkdirty (pmd_mkclean (pmd))));
@@ -144,6 +167,8 @@ static void __init pmd_basic_tests(unsigned long pfn, pgprot_t prot)WARN_ON (pmd_young (pmd_mkold (pmd_mkyoung (pmd))));WARN_ON (pmd_dirty (pmd_mkclean (pmd_mkdirty (pmd))));WARN_ON (pmd_write (pmd_wrprotect (pmd_mkwrite (pmd)))); +WARN_ON (pmd_dirty (pmd_wrprotect (pmd_mkclean (pmd)))); +WARN_ON (!pmd_dirty (pmd_wrprotect (pmd_mkdirty (pmd))));/* * A huge page does not point to next level page table * entry. Hence this must qualify as pmd_bad().
@@ -257,11 +282,25 @@ static void __init pud_basic_tests(unsigned long pfn, pgprot_t prot)return ;pr_debug ("Validating PUD basic\n" ); + +/* +* This test needs to be executed after the given page table entry +* is created with pfn_pud() to make sure that protection_map[idx] +* does not have the dirty bit enabled from the beginning. This is +* important for platforms like arm64 where (!PTE_RDONLY) indicate +* dirty bit being set. +*/ +WARN_ON (pud_dirty (pud_wrprotect (pud))); +WARN_ON (!pud_same (pud, pud));WARN_ON (!pud_young (pud_mkyoung (pud_mkold (pud)))); +WARN_ON (!pud_dirty (pud_mkdirty (pud_mkclean (pud)))); +WARN_ON (pud_dirty (pud_mkclean (pud_mkdirty (pud))));WARN_ON (!pud_write (pud_mkwrite (pud_wrprotect (pud))));WARN_ON (pud_write (pud_wrprotect (pud_mkwrite (pud))));WARN_ON (pud_young (pud_mkold (pud_mkyoung (pud)))); +WARN_ON (pud_dirty (pud_wrprotect (pud_mkclean (pud)))); +WARN_ON (!pud_dirty (pud_wrprotect (pud_mkdirty (pud))));if (mm_pmd_folded (mm))return ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 292/593 mm/debug_vm_pgtable/basic: iterate over entire protection_map[]
In reply to Greg Kroah-HartmanFrom: Anshuman Khandual <[email protected]>
[ Upstream commit 2e326c07bbe1eabeece4047ab5972ef34b15679b ]
Currently the basic tests just validate various page table transformations after starting with vm_get_page_prot(VM_READ|VM_WRITE|VM_EXEC) protection. Instead scan over the entire protection_map[] for better coverage. It also makes sure that all these basic page table tranformations checks hold true irrespective of the starting protection value for the page table entry. There is also a slight change in the debug print format for basic tests to capture the protection value it is being tested with. The modified output looks something like
[pte_basic_tests ]: Validating PTE basic () [pte_basic_tests ]: Validating PTE basic (read) [pte_basic_tests ]: Validating PTE basic (write) [pte_basic_tests ]: Validating PTE basic (read|write) [pte_basic_tests ]: Validating PTE basic (exec) [pte_basic_tests ]: Validating PTE basic (read|exec) [pte_basic_tests ]: Validating PTE basic (write|exec) [pte_basic_tests ]: Validating PTE basic (read|write|exec) [pte_basic_tests ]: Validating PTE basic (shared) [pte_basic_tests ]: Validating PTE basic (read|shared) [pte_basic_tests ]: Validating PTE basic (write|shared) [pte_basic_tests ]: Validating PTE basic (read|write|shared) [pte_basic_tests ]: Validating PTE basic (exec|shared) [pte_basic_tests ]: Validating PTE basic (read|exec|shared) [pte_basic_tests ]: Validating PTE basic (write|exec|shared) [pte_basic_tests ]: Validating PTE basic (read|write|exec|shared)
This adds a missing argument 'struct mm_struct *' in pud_basic_tests() test . This never got exposed before as PUD based THP is available only on X86 platform where mm_pmd_folded(mm) call gets macro replaced without requiring the mm_struct i.e __is_defined(__PAGETABLE_PMD_FOLDED).
--- mm/debug_vm_pgtable.c | 47 ++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 12 deletions(-)
mm/debug_vm_pgtable.c +35 -12
@@ -58,11 +58,13 @@#define RANDOM_ORVALUE (GENMASK(BITS_PER_LONG - 1, 0) & ~ARCH_SKIP_MASK)#define RANDOM_NZVALUE GENMASK(7, 0) -static void __init pte_basic_tests (unsigned long pfn,pgprot_t prot) +static void __init pte_basic_tests (unsigned long pfn,int idx) { +pgprot_t prot = protection_map[idx];pte_t pte =pfn_pte (pfn, prot); +unsigned long val = idx, *ptr = &val; -pr_debug ("Validating PTE basic\n" ); +pr_debug ("Validating PTE basic (%pGv)\n" , ptr);/* * This test needs to be executed after the given page table entry
@@ -141,14 +143,16 @@ static void __init pte_savedwrite_tests(unsigned long pfn, pgprot_t prot) }#ifdef CONFIG_TRANSPARENT_HUGEPAGE -static void __init pmd_basic_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;if (!has_transparent_hugepage ())return ; -pr_debug ("Validating PMD basic\n" ); +pr_debug ("Validating PMD basic (%pGv)\n" , ptr);/* * This test needs to be executed after the given page table entry
@@ -274,14 +278,16 @@ static void __init pmd_savedwrite_tests(unsigned long pfn, pgprot_t prot) }#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD -static void __init pud_basic_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;if (!has_transparent_hugepage ())return ; -pr_debug ("Validating PUD basic\n" ); +pr_debug ("Validating PUD basic (%pGv)\n" , ptr);/* * This test needs to be executed after the given page table entry
@@ -398,7 +404,7 @@ static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t prot)#endif /* !CONFIG_HAVE_ARCH_HUGE_VMAP */ #else /* !CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */ -static void __init pud_basic_tests (unsigned long pfn,pgprot_t prot) { } +static void __init pud_basic_tests (struct mm_struct *mm,unsigned long pfn,int idx) { } static void __init pud_advanced_tests(struct mm_struct *mm, struct vm_area_struct *vma, pud_t *pudp, unsigned long pfn, unsigned long vaddr,
@@ -411,8 +417,8 @@ static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t prot) }#endif /* CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */ #else /* !CONFIG_TRANSPARENT_HUGEPAGE */ -static void __init pmd_basic_tests (unsigned long pfn,pgprot_t prot) { } -static void __init pud_basic_tests (unsigned long pfn,pgprot_t prot) { } +static void __init pmd_basic_tests (unsigned long pfn,int idx) { } +static void __init pud_basic_tests (struct mm_struct *mm,unsigned long pfn,int idx) { } static void __init pmd_advanced_tests(struct mm_struct *mm, struct vm_area_struct *vma, pmd_t *pmdp, unsigned long pfn, unsigned long vaddr,
@@ -938,6 +944,7 @@ static int __init debug_vm_pgtable(void)unsigned long vaddr, pte_aligned, pmd_aligned;unsigned long pud_aligned, p4d_aligned, pgd_aligned;spinlock_t *ptl =NULL ; +int idx;pr_info ("Validating architecture page table helpers\n" ); prot =vm_get_page_prot (VMFLAGS );
@@ -1002,9 +1009,25 @@ static int __init debug_vm_pgtable(void) saved_pmdp =pmd_offset (pudp,0UL ); saved_ptep =pmd_pgtable (pmd); -pte_basic_tests (pte_aligned, prot); -pmd_basic_tests (pmd_aligned, prot); -pud_basic_tests (pud_aligned, prot); +/* +* Iterate over the protection_map[] to make sure that all +* the basic page table transformation validations just hold +* true irrespective of the starting protection value for a +* given page table entry. +*/ +for (idx =0 ; idx <ARRAY_SIZE (protection_map); idx++) { +pte_basic_tests (pte_aligned, idx); +pmd_basic_tests (pmd_aligned, idx); +pud_basic_tests (mm, pud_aligned, idx); + } + +/* +* Both P4D and PGD level tests are very basic which do not +* involve creating page table entries from the protection +* value and the given pfn. Hence just keep them out from +* the above iteration for now to save some test execution +* time. +*/ p4d_basic_tests (p4d_aligned, prot);pgd_basic_tests (pgd_aligned, prot);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 293/593 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 294/593 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
@@ -503,6 +503,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
@@ -3302,6 +3302,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;
@@ -3329,14 +3330,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 */
@@ -3507,6 +3510,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);
@@ -3518,6 +3523,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 295/593 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
@@ -1698,7 +1698,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;
@@ -1706,6 +1707,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) {
@@ -1767,6 +1774,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))
@@ -1777,6 +1786,9 @@ unlock:put_page (page); } +if (si) +put_swap_device (si); +return error; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 296/593 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
@@ -2898,12 +2898,20 @@ 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) {unsigned int objects =objs_per_slab_page (s, page);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
@@ -326,7 +326,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 297/593 mm: page_alloc: refactor setup_per_zone_lowmem_reserve()
In reply to Greg Kroah-HartmanFrom: Lorenzo Stoakes <[email protected]>
[ Upstream commit 470c61d70299b1826f56ff5fede10786798e3c14 ]
setup_per_zone_lowmem_reserve() iterates through each zone setting zone->lowmem_reserve[j] = 0 (where j is the zone's index) then iterates backwards through all preceding zones, setting lower_zone->lowmem_reserve[j] = sum(managed pages of higher zones) / lowmem_reserve_ratio[idx] for each (where idx is the lower zone's index).
If the lower zone has no managed pages or its ratio is 0 then all of its lowmem_reserve[] entries are effectively zeroed.
As these arrays are only assigned here and all lowmem_reserve[] entries for index < this zone's index are implicitly assumed to be 0 (as these are specifically output in show_free_areas() and zoneinfo_show_print() for example) there is no need to additionally zero index == this zone's index too. This patch avoids zeroing unnecessarily.
Rather than iterating through zones and setting lowmem_reserve[j] for each lower zone this patch reverse the process and populates each zone's lowmem_reserve[] values in ascending order.
This clarifies what is going on especially in the case of zero managed pages or ratio which is now explicitly shown to clear these values.
--- mm/page_alloc.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-)
mm/page_alloc.c +14 -21
@@ -7788,31 +7788,24 @@ static void calculate_totalreserve_pages(void)static void setup_per_zone_lowmem_reserve (void ) {struct pglist_data *pgdat; -enum zone_type j, idx; +enum zone_type i, j;for_each_online_pgdat (pgdat) { -for (j =0 ; j <MAX_NR_ZONES ; j++) { -struct zone *zone = pgdat->node_zones + j; -unsigned long managed_pages =zone_managed_pages (zone); - - zone->lowmem_reserve[j] =0 ; - - idx = j; -while (idx) { -struct zone *lower_zone; - - idx--; - lower_zone = pgdat->node_zones + idx; - -if (!sysctl_lowmem_reserve_ratio[idx] || - !zone_managed_pages (lower_zone)) { - lower_zone->lowmem_reserve[j] =0 ; -continue ; +for (i =0 ; i <MAX_NR_ZONES -1 ; i++) { +struct zone *zone = &pgdat->node_zones[i]; +int ratio = sysctl_lowmem_reserve_ratio[i]; +bool clear = !ratio || !zone_managed_pages (zone); +unsigned long managed_pages =0 ; + +for (j = i +1 ; j <MAX_NR_ZONES ; j++) { +if (clear) { + zone->lowmem_reserve[j] =0 ; }else { - lower_zone->lowmem_reserve[j] = - managed_pages / sysctl_lowmem_reserve_ratio[idx]; +struct zone *upper_zone = &pgdat->node_zones[j]; + + managed_pages +=zone_managed_pages (upper_zone); + zone->lowmem_reserve[j] = managed_pages / ratio; } - managed_pages +=zone_managed_pages (lower_zone); } } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 298/593 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
@@ -7798,14 +7798,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 299/593 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
@@ -2516,7 +2516,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;
@@ -2547,7 +2547,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 300/593 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
@@ -130,7 +130,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 301/593 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 302/593 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
@@ -268,6 +268,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 303/593 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
@@ -409,7 +409,7 @@ struct ast_private *ast_device_create(struct drm_driver *drv, dev->pdev = pdev;pci_set_drvdata (pdev, dev); - ast->regs =pci_iomap (dev->pdev,1 ,0 ); + ast->regs =pcim_iomap (pdev,1 ,0 );if (!ast->regs)return ERR_PTR (-EIO );
@@ -425,7 +425,7 @@ struct ast_private *ast_device_create(struct drm_driver *drv,/* "map" IO regs if the above hasn't done so already */ if (!ast->ioregs) { - ast->ioregs =pci_iomap (dev->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 304/593 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 305/593 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
@@ -7045,6 +7045,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 306/593 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
@@ -2536,9 +2536,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),
@@ -2633,7 +2637,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 307/593 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), \
@@ -6109,7 +6110,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 308/593 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 309/593 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 310/593 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
@@ -1802,6 +1802,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 311/593 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
@@ -783,8 +783,10 @@ void 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 312/593 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
@@ -1602,7 +1602,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 313/593 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
@@ -1831,14 +1831,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_ncsi_dev; }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_ncsi_dev; + } }else if (np &&of_get_property (np,"phy-handle" ,NULL )) {struct phy_device *phy;
@@ -1846,6 +1849,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_setup_mdio; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 314/593 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 315/593 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 316/593 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 317/593 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 318/593 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 319/593 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 320/593 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
@@ -338,15 +338,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 ); }else if (mptcp_check_fallback (sk)) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 321/593 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 322/593 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
@@ -811,6 +811,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 323/593 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 324/593 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
@@ -1490,6 +1490,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 325/593 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
@@ -214,6 +214,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 326/593 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
@@ -1727,7 +1727,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 );
@@ -1741,7 +1753,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. *
@@ -1749,8 +1761,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 327/593 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
@@ -2706,6 +2706,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; }
@@ -2714,6 +2716,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; }
@@ -2973,6 +2977,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 328/593 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 329/593 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
@@ -1248,7 +1248,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 330/593 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 331/593 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 332/593 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
@@ -3000,12 +3000,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
@@ -4244,13 +4244,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
@@ -5236,10 +5236,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 333/593 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 334/593 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
@@ -212,10 +212,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;
@@ -616,6 +614,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 335/593 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 336/593 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
@@ -1795,7 +1795,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 ;
@@ -1836,8 +1836,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 337/593 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.
@@ -1102,7 +1123,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 338/593 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 339/593 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
@@ -338,8 +338,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 340/593 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
@@ -3700,7 +3700,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 341/593 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
@@ -3684,8 +3684,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; + } } }
@@ -3696,11 +3698,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 342/593 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 343/593 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 344/593 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
@@ -350,46 +350,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 ); np = dev->of_node; base =devm_platform_ioremap_resource (pdev,0 );
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 345/593 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)
@@ -1398,6 +1387,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 346/593 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 347/593 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 348/593 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 349/593 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
@@ -4157,7 +4157,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 350/593 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
@@ -1221,6 +1221,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,
@@ -1245,11 +1246,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 351/593 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 352/593 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
@@ -329,7 +329,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 353/593 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
@@ -5482,6 +5482,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 354/593 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
@@ -5123,11 +5123,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",
@@ -5135,6 +5130,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 355/593 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 356/593 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
@@ -3440,8 +3440,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);
@@ -3595,6 +3593,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 357/593 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 358/593 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 359/593 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 360/593 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
@@ -125,7 +125,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 361/593 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
@@ -9,6 +9,7 @@ fixdep test_dev_cgroup /test_progs* test_tcpbpf_user +!test_progs.h test_verifier_log feature test_sock
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 362/593 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 363/593 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
@@ -126,12 +126,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 364/593 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
@@ -649,6 +649,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 365/593 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
@@ -1614,7 +1614,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 );
@@ -1635,30 +1635,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 366/593 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
@@ -131,7 +131,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 367/593 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
@@ -219,5 +219,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 368/593 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
@@ -278,7 +278,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 369/593 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
@@ -243,14 +243,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 370/593 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 371/593 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 372/593 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 373/593 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
@@ -1312,22 +1312,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 374/593 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 375/593 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
@@ -1154,7 +1154,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 376/593 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 377/593 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 378/593 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 379/593 iwlwifi: increase PNVM load timeout
In reply to Greg Kroah-HartmanFrom: Luca Coelho <[email protected]>
[ Upstream commit 5cc816ef9db1fe03f73e56e9d8f118add9c6efe4 ]
The FW has a watchdog of 200ms in the PNVM load flow, so the driver should have a slightly higher timeout. Change the timeout from 100ms to 250ms.
--- drivers/net/wireless/intel/iwlwifi/fw/pnvm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/pnvm.h +2 -2
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /****************************************************************************** * -* Copyright(c) 2020 Intel Corporation +* Copyright(c) 2020-2021 Intel Corporation * *****************************************************************************/
@@ -10,7 +10,7 @@#include "fw/notif-wait.h" -#define MVM_UCODE_PNVM_TIMEOUT (HZ / 10) +#define MVM_UCODE_PNVM_TIMEOUT (HZ / 4)int iwl_pnvm_load (struct iwl_trans *trans,struct iwl_notif_wait_data *notif_wait);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 380/593 rtw88: 8822c: fix lc calibration timing
In reply to Greg Kroah-HartmanFrom: Po-Hao Huang <[email protected]>
[ Upstream commit 05684fd583e1acc34dddea283838fbfbed4904a0 ]
Before this patch, we use value from 2 seconds ago to decide whether we should do lc calibration.
Although this don't happen frequently, fix flow to the way it should be.
--- drivers/net/wireless/realtek/rtw88/rtw8822c.c | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/net/wireless/realtek/rtw88/rtw8822c.c +12 -10
@@ -3510,26 +3510,28 @@ static void rtw8822c_pwrtrack_set(struct rtw_dev *rtwdev, u8 rf_path) } } -static void rtw8822c_pwr_track_path (struct rtw_dev *rtwdev, -struct rtw_swing_table *swing_table, -u8 path) +static void rtw8822c_pwr_track_stats (struct rtw_dev *rtwdev,u8 path) { -struct rtw_dm_info *dm_info = &rtwdev->dm_info; -u8 thermal_value, delta; +u8 thermal_value;if (rtwdev->efuse.thermal_meter[path] ==0xff )return ; thermal_value =rtw_read_rf (rtwdev, path,RF_T_METER ,0x7e ); -rtw_phy_pwrtrack_avg (rtwdev, thermal_value, path); +} - delta =rtw_phy_pwrtrack_get_delta (rtwdev, path); +static void rtw8822c_pwr_track_path (struct rtw_dev *rtwdev, +struct rtw_swing_table *swing_table, +u8 path) +{ +struct rtw_dm_info *dm_info = &rtwdev->dm_info; +u8 delta; + delta =rtw_phy_pwrtrack_get_delta (rtwdev, path); dm_info->delta_power_index[path] =rtw_phy_pwrtrack_get_pwridx (rtwdev, swing_table, path, path, delta); -rtw8822c_pwrtrack_set (rtwdev, path); }
@@ -3540,12 +3542,12 @@ static void __rtw8822c_pwr_track(struct rtw_dev *rtwdev)rtw_phy_config_swing_table (rtwdev, &swing_table); +for (i =0 ; i < rtwdev->hal.rf_path_num; i++) +rtw8822c_pwr_track_stats (rtwdev, i);if (rtw_phy_pwrtrack_need_lck (rtwdev))rtw8822c_do_lck (rtwdev); -for (i =0 ; i < rtwdev->hal.rf_path_num; i++)rtw8822c_pwr_track_path (rtwdev, &swing_table, i); - }static void rtw8822c_pwr_track (struct rtw_dev *rtwdev)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 381/593 vxlan: add missing rcu_read_lock() in neigh_reduce()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 85e8b032d6ebb0f698a34dd22c2f13443d905888 ]
syzbot complained in neigh_reduce(), because rcu_read_lock_bh() is treated differently than rcu_read_lock()
WARNING: suspicious RCU usage
5.13.0-rc6-syzkaller #0 Not tainted
-----------------------------include/net/addrconf.h:313 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
3 locks held by kworker/0:0/5:
#0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline] #0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: atomic64_set include/asm-generic/atomic-instrumented.h:856 [inline] #0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: atomic_long_set include/asm-generic/atomic-long.h:41 [inline] #0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: set_work_data kernel/workqueue.c:617 [inline] #0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: set_work_pool_and_clear_pending kernel/workqueue.c:644 [inline] #0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x871/0x1600 kernel/workqueue.c:2247 #1: ffffc90000ca7da8 ((work_completion)(&port->wq)){+.+.}-{0:0}, at: process_one_work+0x8a5/0x1600 kernel/workqueue.c:2251 #2: ffffffff8bf795c0 (rcu_read_lock_bh){....}-{1:2}, at: __dev_queue_xmit+0x1da/0x3130 net/core/dev.c:4180
stack backtrace: CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.13.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events ipvlan_process_multicast Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x141/0x1d7 lib/dump_stack.c:120 __in6_dev_get include/net/addrconf.h:313 [inline] __in6_dev_get include/net/addrconf.h:311 [inline] neigh_reduce drivers/net/vxlan.c:2167 [inline] vxlan_xmit+0x34d5/0x4c30 drivers/net/vxlan.c:2919 __netdev_start_xmit include/linux/netdevice.h:4944 [inline] netdev_start_xmit include/linux/netdevice.h:4958 [inline] xmit_one net/core/dev.c:3654 [inline] dev_hard_start_xmit+0x1eb/0x920 net/core/dev.c:3670 __dev_queue_xmit+0x2133/0x3130 net/core/dev.c:4246 ipvlan_process_multicast+0xa99/0xd70 drivers/net/ipvlan/ipvlan_core.c:287 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
--- drivers/net/vxlan.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/vxlan.c +2 -0
@@ -2163,6 +2163,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)struct neighbour *n;struct nd_msg *msg; +rcu_read_lock (); in6_dev =__in6_dev_get (dev);if (!in6_dev) goto out;
@@ -2214,6 +2215,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni) } out: +rcu_read_unlock ();consume_skb (skb);return NETDEV_TX_OK ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 382/593 ip6_tunnel: fix GRE6 segmentation
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit a6e3f2985a80ef6a45a17d2d9d9151f17ea3ce07 ]
Commit 6c11fbf97e69 ("ip6_tunnel: add MPLS transmit support") moved assiging inner_ipproto down from ipxip6_tnl_xmit() to its callee ip6_tnl_xmit(). The latter is also used by GRE.
Since commit 38720352412a ("gre: Use inner_proto to obtain inner header protocol") GRE had been depending on skb->inner_protocol during segmentation. It sets it in gre_build_header() and reads it in gre_gso_segment(). Changes to ip6_tnl_xmit() overwrite the protocol, resulting in GSO skbs getting dropped.
Note that inner_protocol is a union with inner_ipproto, GRE uses the former while the change switched it to the latter (always setting it to just IPPROTO_GRE).
Restore the original location of skb_set_inner_ipproto(), it is unclear why it was moved in the first place.
--- net/ipv6/ip6_tunnel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv6/ip6_tunnel.c +2 -2
@@ -1270,8 +1270,6 @@ route_lookup:if (max_headroom > dev->needed_headroom) dev->needed_headroom = max_headroom; -skb_set_inner_ipproto (skb, proto); - err =ip6_tnl_encap (skb, t, &proto, fl6);if (err)return err;
@@ -1408,6 +1406,8 @@ ipxip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev,if (iptunnel_handle_offloads (skb,SKB_GSO_IPXIP6 ))return -1 ; +skb_set_inner_ipproto (skb, protocol); + err =ip6_tnl_xmit (skb, dev, dsfield, &fl6, encap_limit, &mtu, protocol);if (err !=0 ) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 383/593 net/ipv4: swap flow ports when validating source
In reply to Greg Kroah-HartmanFrom: Miao Wang <[email protected]>
[ Upstream commit c69f114d09891adfa3e301a35d9e872b8b7b5a50 ]
When doing source address validation, the flowi4 struct used for fib_lookup should be in the reverse direction to the given skb. fl4_dport and fl4_sport returned by fib4_rules_early_flow_dissect should thus be swapped.
--- net/ipv4/fib_frontend.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv4/fib_frontend.c +2 -0
@@ -371,6 +371,8 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, fl4.flowi4_proto =0 ; fl4.fl4_sport =0 ; fl4.fl4_dport =0 ; + }else { +swap (fl4.fl4_sport, fl4.fl4_dport); }if (fib_lookup (net, &fl4, &res,0 ))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 384/593 net: ti: am65-cpsw-nuss: Fix crash when changing number of TX queues
In reply to Greg Kroah-HartmanFrom: Vignesh Raghavendra <[email protected]>
[ Upstream commit ce8eb4c728ef40b554b4f3d8963f11ed44502e00 ]
When changing number of TX queues using ethtool:
# ethtool -L eth0 tx 1 [ 135.301047] Unable to handle kernel paging request at virtual address 00000000af5d0000 [...] [ 135.525128] Call trace: [ 135.525142] dma_release_from_dev_coherent+0x2c/0xb0 [ 135.525148] dma_free_attrs+0x54/0xe0 [ 135.525156] k3_cppi_desc_pool_destroy+0x50/0xa0 [ 135.525164] am65_cpsw_nuss_remove_tx_chns+0x88/0xdc [ 135.525171] am65_cpsw_set_channels+0x3c/0x70 [...]
This is because k3_cppi_desc_pool_destroy() which is called after k3_udma_glue_release_tx_chn() in am65_cpsw_nuss_remove_tx_chns() references struct device that is unregistered at the end of k3_udma_glue_release_tx_chn()
Therefore the right order is to call k3_cppi_desc_pool_destroy() and destroy desc pool before calling k3_udma_glue_release_tx_chn(). Fix this throughout the driver.
--- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/ethernet/ti/am65-cpsw-nuss.c +9 -9
@@ -1433,12 +1433,12 @@ static void am65_cpsw_nuss_free_tx_chns(void *data)for (i =0 ; i < common->tx_ch_num; i++) {struct am65_cpsw_tx_chn *tx_chn = &common->tx_chns[i]; -if (!IS_ERR_OR_NULL (tx_chn->tx_chn)) -k3_udma_glue_release_tx_chn (tx_chn->tx_chn); -if (!IS_ERR_OR_NULL (tx_chn->desc_pool))k3_cppi_desc_pool_destroy (tx_chn->desc_pool); +if (!IS_ERR_OR_NULL (tx_chn->tx_chn)) +k3_udma_glue_release_tx_chn (tx_chn->tx_chn); +memset (tx_chn,0 ,sizeof (*tx_chn)); } }
@@ -1458,12 +1458,12 @@ void am65_cpsw_nuss_remove_tx_chns(struct am65_cpsw_common *common)netif_napi_del (&tx_chn->napi_tx); -if (!IS_ERR_OR_NULL (tx_chn->tx_chn)) -k3_udma_glue_release_tx_chn (tx_chn->tx_chn); -if (!IS_ERR_OR_NULL (tx_chn->desc_pool))k3_cppi_desc_pool_destroy (tx_chn->desc_pool); +if (!IS_ERR_OR_NULL (tx_chn->tx_chn)) +k3_udma_glue_release_tx_chn (tx_chn->tx_chn); +memset (tx_chn,0 ,sizeof (*tx_chn)); } }
@@ -1550,11 +1550,11 @@ static void am65_cpsw_nuss_free_rx_chns(void *data) rx_chn = &common->rx_chns; -if (!IS_ERR_OR_NULL (rx_chn->rx_chn)) -k3_udma_glue_release_rx_chn (rx_chn->rx_chn); -if (!IS_ERR_OR_NULL (rx_chn->desc_pool))k3_cppi_desc_pool_destroy (rx_chn->desc_pool); + +if (!IS_ERR_OR_NULL (rx_chn->rx_chn)) +k3_udma_glue_release_rx_chn (rx_chn->rx_chn); }static int am65_cpsw_nuss_init_rx_chns (struct am65_cpsw_common *common)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 385/593 tc-testing: fix list handling
In reply to Greg Kroah-HartmanFrom: Marcelo Ricardo Leitner <[email protected]>
[ Upstream commit b4fd096cbb871340be837491fa1795864a48b2d9 ]
python lists don't have an 'add' method, but 'append'.
--- tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py +1 -1
@@ -36,7 +36,7 @@ class SubPlugin(TdcPlugin): for k in scapy_keys: if k not in scapyinfo: keyfail = True - missing_keys.add(k) + missing_keys.append(k) if keyfail: print('{}: Scapy block present in the test, but is missing info:' .format(self.sub_class))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 386/593 ieee802154: hwsim: Fix memory leak in hwsim_add_one
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit 28a5501c3383f0e6643012c187b7c2027ef42aea ]
No matter from hwsim_remove or hwsim_del_radio_nl, hwsim_del fails to remove the entry in the edges list. Take the example below, phy0, phy1 and e0 will be deleted, resulting in e1 not freed and accessed in the future.
hwsim_phys
|
------------------------------
| |phy0 (edges) phy1 (edges)
----> e1 (idx = 1) ----> e0 (idx = 0)
Fix this by deleting and freeing all the entries in the edges list between hwsim_edge_unsubscribe_me and list_del(&phy->list).
--- drivers/net/ieee802154/mac802154_hwsim.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ieee802154/mac802154_hwsim.c +5 -0
@@ -824,12 +824,17 @@ err_pib:static void hwsim_del (struct hwsim_phy *phy) {struct hwsim_pib *pib; +struct hwsim_edge *e;hwsim_edge_unsubscribe_me (phy);list_del (&phy->list);rcu_read_lock (); +list_for_each_entry_rcu (e, &phy->edges, list) { +list_del_rcu (&e->list); +hwsim_free_edge (e); + } pib =rcu_dereference (phy->pib);rcu_read_unlock ();
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 387/593 ieee802154: hwsim: avoid possible crash in hwsim_del_edge_nl()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 0303b30375dff5351a79cc2c3c87dfa4fda29bed ]
Both MAC802154_HWSIM_ATTR_RADIO_ID and MAC802154_HWSIM_ATTR_RADIO_EDGE must be present to avoid a crash.
--- drivers/net/ieee802154/mac802154_hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ieee802154/mac802154_hwsim.c +1 -1
@@ -480,7 +480,7 @@ static int hwsim_del_edge_nl(struct sk_buff *msg, struct genl_info *info)struct hwsim_edge *e;u32 v0, v1; -if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID ] && +if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID ] || !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE ])return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 388/593 bpf: Fix null ptr deref with mixed tail calls and subprogs
In reply to Greg Kroah-HartmanFrom: John Fastabend <[email protected]>
[ Upstream commit 7506d211b932870155bcb39e3dd9e39fab45a7c7 ]
The sub-programs prog->aux->poke_tab[] is populated in jit_subprogs() and then used when emitting 'BPF_JMP|BPF_TAIL_CALL' insn->code from the individual JITs. The poke_tab[] to use is stored in the insn->imm by the code adding it to that array slot. The JIT then uses imm to find the right entry for an individual instruction. In the x86 bpf_jit_comp.c this is done by calling emit_bpf_tail_call_direct with the poke_tab[] of the imm value.
However, we observed the below null-ptr-deref when mixing tail call programs with subprog programs. For this to happen we just need to mix bpf-2-bpf calls and tailcalls with some extra calls or instructions that would be patched later by one of the fixup routines. So whats happening?
Before the fixup_call_args() -- where the jit op is done -- various code patching is done by do_misc_fixups(). This may increase the insn count, for example when we patch map_lookup_up using map_gen_lookup hook. This does two things. First, it means the instruction index, insn_idx field, of a tail call instruction will move by a 'delta'.
In verifier code,
struct bpf_jit_poke_descriptor desc = {
.reason = BPF_POKE_REASON_TAIL_CALL, .tail_call.map = BPF_MAP_PTR(aux->map_ptr_state), .tail_call.key = bpf_map_key_immediate(aux), .insn_idx = i + delta,
};
Then subprog start values subprog_info[i].start will be updated with the delta and any poke descriptor index will also be updated with the delta in adjust_poke_desc(). If we look at the adjust subprog starts though we see its only adjusted when the delta occurs before the new instructions,
/* NOTE: fake 'exit' subprog should be updated as well. */
for (i = 0; i <= env->subprog_cnt; i++) {
if (env->subprog_info[i].start <= off)
continue;Earlier subprograms are not changed because their start values are not moved. But, adjust_poke_desc() does the offset + delta indiscriminately. The result is poke descriptors are potentially corrupted.
Then in jit_subprogs() we only populate the poke_tab[]
when the above insn_idx is less than the next subprogram start. From above we corrupted our insn_idx so we might incorrectly assume a poke descriptor is not used in a subprogram omitting it from the subprogram. And finally when the jit runs it does the deref of poke_tab when emitting the instruction and crashes with below. Because earlier step omitted the poke descriptor.
The fix is straight forward with above context. Simply move same logic from adjust_subprog_starts() into adjust_poke_descs() and only adjust insn_idx when needed.
[ 82.396354] bpf_testmod: version magic '5.12.0-rc2alu+ SMP preempt mod_unload ' should be '5.12.0+ SMP preempt mod_unload ' [ 82.623001] loop10: detected capacity change from 0 to 8 [ 88.487424] ================================================================== [ 88.487438] BUG: KASAN: null-ptr-deref in do_jit+0x184a/0x3290 [ 88.487455] Write of size 8 at addr 0000000000000008 by task test_progs/5295 [ 88.487471] CPU: 7 PID: 5295 Comm: test_progs Tainted: G I 5.12.0+ #386 [ 88.487483] Hardware name: Dell Inc. Precision 5820 Tower/002KVM, BIOS 1.9.2 01/24/2019 [ 88.487490] Call Trace: [ 88.487498] dump_stack+0x93/0xc2 [ 88.487515] kasan_report.cold+0x5f/0xd8 [ 88.487530] ? do_jit+0x184a/0x3290 [ 88.487542] do_jit+0x184a/0x3290 ... [ 88.487709] bpf_int_jit_compile+0x248/0x810 ... [ 88.487765] bpf_check+0x3718/0x5140 ... [ 88.487920] bpf_prog_load+0xa22/0xf10
--- kernel/bpf/verifier.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +4 -2
@@ -10532,7 +10532,7 @@ static void adjust_subprog_starts(struct bpf_verifier_env *env, u32 off, u32 len } } -static void adjust_poke_descs (struct bpf_prog *prog,u32 len) +static void adjust_poke_descs (struct bpf_prog *prog,u32 off,u32 len) {struct bpf_jit_poke_descriptor *tab = prog->aux->poke_tab;int i, sz = prog->aux->size_poke_tab;
@@ -10540,6 +10540,8 @@ static void adjust_poke_descs(struct bpf_prog *prog, u32 len)for (i =0 ; i < sz; i++) { desc = &tab[i]; +if (desc->insn_idx <= off) +continue ; desc->insn_idx += len -1 ; } }
@@ -10560,7 +10562,7 @@ static struct bpf_prog *bpf_patch_insn_data(struct bpf_verifier_env *env, u32 ofif (adjust_insn_aux_data (env, new_prog, off, len))return NULL ;adjust_subprog_starts (env, off, len); -adjust_poke_descs (new_prog, len); +adjust_poke_descs (new_prog, off, len);return new_prog; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 389/593 drm/msm: Fix error return code in msm_drm_init()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit a1c9b1e3bdd6d8dc43c18699772fb6cf4497d45a ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/gpu/drm/msm/msm_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/msm_drv.c +1 -0
@@ -505,6 +505,7 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) priv->event_thread[i].worker =kthread_create_worker (0 ,"crtc_event:%d" , priv->event_thread[i].crtc_id);if (IS_ERR (priv->event_thread[i].worker)) { + ret =PTR_ERR (priv->event_thread[i].worker);DRM_DEV_ERROR (dev,"failed to create crtc_event kthread\n" ); goto err_msm_uninit; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 390/593 drm/msm/dpu: Fix error return code in dpu_mdss_init()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit e020ac961ce5d038de66dc7f6ffca98899e9a3f3 ]
The error code returned by platform_get_irq() is stored in 'irq', it's forgotten to be copied to 'ret' before being returned. As a result, the value 0 of 'ret' is returned incorrectly.
After the above fix is completed, initializing the local variable 'ret' to 0 is no longer needed, remove it.
In addition, when dpu_mdss_init() is successfully returned, the value of 'ret' is always 0. Therefore, replace "return ret" with "return 0" to make the code clearer.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +5 -3
@@ -222,7 +222,7 @@ int dpu_mdss_init(struct drm_device *dev)struct msm_drm_private *priv = dev->dev_private;struct dpu_mdss *dpu_mdss;struct dss_module_power *mp; -int ret =0 ; +int ret;int irq; dpu_mdss =devm_kzalloc (dev->dev,sizeof (*dpu_mdss),GFP_KERNEL );
@@ -250,8 +250,10 @@ int dpu_mdss_init(struct drm_device *dev) goto irq_domain_error; irq =platform_get_irq (pdev,0 ); -if (irq <0 ) +if (irq <0 ) { + ret = irq; goto irq_error; + }irq_set_chained_handler_and_data (irq, dpu_mdss_irq, dpu_mdss);
@@ -260,7 +262,7 @@ int dpu_mdss_init(struct drm_device *dev)pm_runtime_enable (dev->dev); -return ret; +return 0 ; irq_error:_dpu_mdss_irq_domain_fini (dpu_mdss);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 391/593 mac80211: remove iwlwifi specific workaround NDPs of null_response
In reply to Greg Kroah-HartmanFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 744757e46bf13ec3a7b3507d17ab3faab9516d43 ]
Remove the remaining workaround that is not removed by the commit e41eb3e408de ("mac80211: remove iwlwifi specific workaround that broke sta NDP tx")
--- net/mac80211/sta_info.c | 5 ----- 1 file changed, 5 deletions(-)
net/mac80211/sta_info.c +0 -5
@@ -1398,11 +1398,6 @@ static void ieee80211_send_null_response(struct sta_info *sta, int tid,struct ieee80211_tx_info *info;struct ieee80211_chanctx_conf *chanctx_conf; -/* Don't send NDPs when STA is connected HE */ -if (sdata->vif.type ==NL80211_IFTYPE_STATION && - !(sdata->u.mgd.flags &IEEE80211_STA_DISABLE_HE )) -return ; -if (qos) { fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC |
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 392/593 net: bcmgenet: Fix attaching to PYH failed on RPi 4B
In reply to Greg Kroah-HartmanFrom: Jian-Hong Pan <[email protected]>
[ Upstream commit b2ac9800cfe0f8da16abc4e74e003440361c112e ]
The Broadcom UniMAC MDIO bus from mdio-bcm-unimac module comes too late. So, GENET cannot find the ethernet PHY on UniMAC MDIO bus. This leads GENET fail to attach the PHY as following log:
bcmgenet fd580000.ethernet: GENET 5.0 EPHY: 0x0000
...
could not attach to PHY
bcmgenet fd580000.ethernet eth0: failed to connect to PHY uart-pl011 fe201000.serial: no DMA platform data
libphy: bcmgenet MII bus: probed
...
unimac-mdio unimac-mdio.-19: Broadcom UniMAC MDIO bus
This patch adds the soft dependency to load mdio-bcm-unimac module before genet module to avoid the issue.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +1 -0
@@ -4296,3 +4296,4 @@ MODULE_AUTHOR("Broadcom Corporation");MODULE_DESCRIPTION ("Broadcom GENET Ethernet controller driver" );MODULE_ALIAS ("platform:bcmgenet" );MODULE_LICENSE ("GPL" ); +MODULE_SOFTDEP ("pre: mdio-bcm-unimac" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 393/593 ipv6: exthdrs: do not blindly use init_net
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit bcc3f2a829b9edbe3da5fb117ee5a63686d31834 ]
I see no reason why max_dst_opts_cnt and max_hbh_opts_cnt are fetched from the initial net namespace.
The other sysctls (max_dst_opts_len & max_hbh_opts_len) are in fact already using the current ns.
Note: it is not clear why ipv6_destopt_rcv() use two ways to get to the netns :
1) dev_net(dst->dev)
Originally used to increment IPSTATS_MIB_INHDRERRORS
2) dev_net(skb->dev)
Tom used this variant in his patch.
Maybe this calls to use ipv6_skb_net() instead ?
--- net/ipv6/exthdrs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv6/exthdrs.c +2 -2
@@ -306,7 +306,7 @@ fail_and_free:#endif if (ip6_parse_tlv (tlvprocdestopt_lst, skb, - init_net.ipv6.sysctl.max_dst_opts_cnt)) { + net->ipv6.sysctl.max_dst_opts_cnt)) { skb->transport_header += extlen; opt =IP6CB (skb);#if IS_ENABLED (CONFIG_IPV6_MIP6 )
@@ -1041,7 +1041,7 @@ fail_and_free: opt->flags |=IP6SKB_HOPBYHOP ;if (ip6_parse_tlv (tlvprochopopt_lst, skb, - init_net.ipv6.sysctl.max_hbh_opts_cnt)) { + net->ipv6.sysctl.max_hbh_opts_cnt)) { skb->transport_header += extlen; opt =IP6CB (skb); opt->nhoff =sizeof (struct ipv6hdr );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 394/593 can: j1939: j1939_sk_setsockopt(): prevent allocation of j1939 filter for optlen == 0
In reply to Greg Kroah-HartmanFrom: Norbert Slusarek <[email protected]>
[ Upstream commit aaf473d0100f64abc88560e2bea905805bcf2a8e ]
If optval != NULL and optlen == 0 are specified for SO_J1939_FILTER in j1939_sk_setsockopt(), memdup_sockptr() will return ZERO_PTR for 0 size allocation. The new filter will be mistakenly assigned ZERO_PTR. This patch checks for optlen != 0 and filter will be assigned NULL in case of optlen == 0.
--- net/can/j1939/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/can/j1939/socket.c +1 -1
@@ -676,7 +676,7 @@ static int j1939_sk_setsockopt(struct socket *sock, int level, int optname,switch (optname) {case SO_J1939_FILTER : -if (!sockptr_is_null (optval)) { +if (!sockptr_is_null (optval) && optlen !=0 ) {struct j1939_filter *f;int c;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 395/593 bpf: Do not change gso_size during bpf_skb_change_proto()
In reply to Greg Kroah-HartmanFrom: Maciej Żenczykowski <[email protected]>
[ Upstream commit 364745fbe981a4370f50274475da4675661104df ]
This is technically a backwards incompatible change in behaviour, but I'm going to argue that it is very unlikely to break things, and likely to fix *far* more then it breaks.
In no particular order, various reasons follow:
(a) I've long had a bug assigned to myself to debug a super rare kernel crash on Android Pixel phones which can (per stacktrace) be traced back to BPF clat IPv6 to IPv4 protocol conversion causing some sort of ugly failure much later on during transmit deep in the GSO engine, AFAICT precisely because of this change to gso_size, though I've never been able to manually reproduce it. I believe it may be related to the particular network offload support of attached USB ethernet dongle being used for tethering off of an IPv6-only cellular connection. The reason might be we end up with more segments than max permitted, or with a GSO packet with only one segment... (either way we break some assumption and hit a BUG_ON)
(b) There is no check that the gso_size is > 20 when reducing it by 20, so we might end up with a negative (or underflowing) gso_size or a gso_size of 0. This can't possibly be good. Indeed this is probably somehow exploitable (or at least can result in a kernel crash) by delivering crafted packets and perhaps triggering an infinite loop or a divide by zero... As a reminder: gso_size (MSS) is related to MTU, but not directly derived from it: gso_size/MSS may be significantly smaller then one would get by deriving from local MTU. And on some NICs (which do loose MTU checking on receive, it may even potentially be larger, for example my work pc with 1500 MTU can receive 1520 byte frames [and sometimes does due to bugs in a vendor plat46 implementation]). Indeed even just going from 21 to 1 is potentially problematic because it increases the number of segments by a factor of 21 (think DoS, or some other crash due to too many segments).
(c) It's always safe to not increase the gso_size, because it doesn't result in the max packet size increasing. So the skb_increase_gso_size() call was always unnecessary for correctness (and outright undesirable, see later). As such the only part which is potentially dangerous (ie. could cause backwards compatibility issues) is the removal of the skb_decrease_gso_size() call.
(d) If the packets are ultimately destined to the local device, then there is absolutely no benefit to playing around with gso_size. It only matters if the packets will egress the device. ie. we're either forwarding, or transmitting from the device.
(e) This logic only triggers for packets which are GSO. It does not trigger for skbs which are not GSO. It will not convert a non-GSO MTU sized packet into a GSO packet (and you don't even know what the MTU is, so you can't even fix it). As such your transmit path must *already* be able to handle an MTU 20 bytes larger then your receive path (for IPv4 to IPv6 translation) - and indeed 28 bytes larger due to IPv4 fragments. Thus removing the skb_decrease_gso_size() call doesn't actually increase the size of the packets your transmit side must be able to handle. ie. to handle non-GSO max-MTU packets, the IPv4/IPv6 device/ route MTUs must already be set correctly. Since for example with an IPv4 egress MTU of 1500, IPv4 to IPv6 translation will already build 1520 byte IPv6 frames, so you need a 1520 byte device MTU. This means if your IPv6 device's egress MTU is 1280, your IPv4 route must be 1260 (and actually 1252, because of the need to handle fragments). This is to handle normal non-GSO packets. Thus the reduction is simply not needed for GSO packets, because when they're correctly built, they will already be the right size.
(f) TSO/GSO should be able to exactly undo GRO: the number of packets (TCP segments) should not be modified, so that TCP's MSS counting works correctly (this matters for congestion control). If protocol conversion changes the gso_size, then the number of TCP segments may increase or decrease. Packet loss after protocol conversion can result in partial loss of MSS segments that the sender sent. How's the sending TCP stack going to react to receiving ACKs/SACKs in the middle of the segments it sent?
(g) skb_{decrease,increase}_gso_size() are already no-ops for GSO_BY_FRAGS case (besides triggering WARN_ON_ONCE). This means you already cannot guarantee that gso_size (and thus resulting packet MTU) is changed. ie. you must assume it won't be changed.
(h) changing gso_size is outright buggy for UDP GSO packets, where framing matters (I believe that's also the case for SCTP, but it's already excluded by [g]). So the only remaining case is TCP, which also doesn't want it (see [f]).
(i) see also the reasoning on the previous attempt at fixing this (commit fa7b83bf3b156c767f3e4a25bbf3817b08f3ff8e) which shows that the current behaviour causes TCP packet loss:
In the forwarding path GRO -> BPF 6 to 4 -> GSO for TCP traffic, the coalesced packet payload can be > MSS, but < MSS + 20.
bpf_skb_proto_6_to_4() will upgrade the MSS and it can be > the payload length. After then tcp_gso_segment checks for the payload length if it is <= MSS. The condition is causing the packet to be dropped.
tcp_gso_segment():
[...]
mss = skb_shinfo(skb)->gso_size;
if (unlikely(skb->len <= mss)) goto out;
[...]Thus changing the gso_size is simply a very bad idea. Increasing is unnecessary and buggy, and decreasing can go negative.
--- net/core/filter.c | 4 ---- 1 file changed, 4 deletions(-)
net/core/filter.c +0 -4
@@ -3266,8 +3266,6 @@ static int bpf_skb_proto_4_to_6(struct sk_buff *skb) shinfo->gso_type |=SKB_GSO_TCPV6 ; } -/* Due to IPv6 header, MSS needs to be downgraded. */ -skb_decrease_gso_size (shinfo, len_diff);/* Header must be checked, and gso_segs recomputed. */ shinfo->gso_type |=SKB_GSO_DODGY ; shinfo->gso_segs =0 ;
@@ -3307,8 +3305,6 @@ static int bpf_skb_proto_6_to_4(struct sk_buff *skb) shinfo->gso_type |=SKB_GSO_TCPV4 ; } -/* Due to IPv4 header, MSS can be upgraded. */ -skb_increase_gso_size (shinfo, len_diff);/* Header must be checked, and gso_segs recomputed. */ shinfo->gso_type |=SKB_GSO_DODGY ; shinfo->gso_segs =0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 396/593 i40e: Fix error handling in i40e_vsi_open
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 9c04cfcd4aad232e36306cdc5c74cd9fc9148a7e ]
When vsi->type == I40E_VSI_FDIR, we have caught the return value of i40e_vsi_request_irq() but without further handling. Check and execute memory clean on failure just like the other i40e_vsi_request_irq().
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -0
@@ -8347,6 +8347,8 @@ int i40e_vsi_open(struct i40e_vsi *vsi)dev_driver_string (&pf->pdev->dev), dev_name(&pf->pdev->dev)); err =i40e_vsi_request_irq (vsi, int_name); +if (err) + goto err_setup_rx; }else { err = -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 397/593 i40e: Fix autoneg disabling for non-10GBaseT links
In reply to Greg Kroah-HartmanFrom: Mateusz Palczewski <[email protected]>
[ Upstream commit 9262793e59f0423437166a879a73d056b1fe6f9a ]
Disabling autonegotiation was allowed only for 10GBaseT PHY. The condition was changed to check if link media type is BaseT.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 -2
@@ -1262,8 +1262,7 @@ static int i40e_set_link_ksettings(struct net_device *netdev,if (ethtool_link_ksettings_test_link_mode (&safe_ks, supported, Autoneg) && - hw->phy.link_info.phy_type != -I40E_PHY_TYPE_10GBASE_T ) { + hw->phy.media_type !=I40E_MEDIA_TYPE_BASET ) {netdev_info (netdev,"Autoneg cannot be disabled on this phy\n" ); err = -EINVAL ; goto done;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 398/593 i40e: Fix missing rtnl locking when setting up pf switch
In reply to Greg Kroah-HartmanFrom: Jan Sokolowski <[email protected]>
[ Upstream commit 956e759d5f8e0859e86b951a8779c60af633aafd ]
A recent change that made i40e use new udp_tunnel infrastructure uses a method that expects to be called under rtnl lock.
However, not all codepaths do the lock prior to calling i40e_setup_pf_switch.
Fix that by adding additional rtnl locking and unlocking.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +11 -4
@@ -31,7 +31,7 @@ static void i40e_vsi_reinit_locked(struct i40e_vsi *vsi);static void i40e_handle_reset_warning (struct i40e_pf *pf,bool lock_acquired);static int i40e_add_vsi (struct i40e_vsi *vsi);static int i40e_add_veb (struct i40e_veb *veb,struct i40e_vsi *vsi); -static int i40e_setup_pf_switch (struct i40e_pf *pf,bool reinit); +static int i40e_setup_pf_switch (struct i40e_pf *pf,bool reinit,bool lock_acquired);static int i40e_setup_misc_vector (struct i40e_pf *pf);static void i40e_determine_queue_usage (struct i40e_pf *pf);static int i40e_setup_pf_filter_control (struct i40e_pf *pf);
@@ -10114,7 +10114,7 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)/* do basic switch setup */ if (!lock_acquired)rtnl_lock (); - ret =i40e_setup_pf_switch (pf, reinit); + ret =i40e_setup_pf_switch (pf, reinit, true);if (ret) goto end_unlock;
@@ -14169,10 +14169,11 @@ int i40e_fetch_switch_configuration(struct i40e_pf *pf, bool printconfig)* i40e_setup_pf_switch - Setup the HW switch on startup or after reset * @pf: board private structure * @reinit: if the Main VSI needs to re-initialized. +* @lock_acquired: indicates whether or not the lock has been acquired * * Returns 0 on success, negative value on failure **/ -static int i40e_setup_pf_switch (struct i40e_pf *pf,bool reinit) +static int i40e_setup_pf_switch (struct i40e_pf *pf,bool reinit,bool lock_acquired) {u16 flags =0 ;int ret;
@@ -14274,9 +14275,15 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)i40e_ptp_init (pf); +if (!lock_acquired) +rtnl_lock (); +/* repopulate tunnel port filters */ udp_tunnel_nic_reset_ntf (pf->vsi[pf->lan_vsi]->netdev); +if (!lock_acquired) +rtnl_unlock (); +return ret; }
@@ -15048,7 +15055,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; }#endif - err =i40e_setup_pf_switch (pf, false); + err =i40e_setup_pf_switch (pf, false, false);if (err) {dev_info (&pdev->dev,"setup_pf_switch failed: %d\n" , err); goto err_vsis;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 399/593 Revert "ibmvnic: remove duplicate napi_schedule call in open function"
In reply to Greg Kroah-HartmanFrom: Dany Madden <[email protected]>
[ Upstream commit 2ca220f92878470c6ba03f9946e412323093cc94 ]
This reverts commit 7c451f3ef676c805a4b77a743a01a5c21a250a73.
When a vnic interface is taken down and then up, connectivity is not restored. We bisected it to this commit. Reverting this commit until we can fully investigate the issue/benefit of the change.
--- drivers/net/ethernet/ibm/ibmvnic.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/ibm/ibmvnic.c +5 -0
@@ -1166,6 +1166,11 @@ static int __ibmvnic_open(struct net_device *netdev)netif_tx_start_all_queues (netdev); +if (prev_state ==VNIC_CLOSED ) { +for (i =0 ; i < adapter->req_rx_queues; i++) +napi_schedule (&adapter->napi[i]); + } + adapter->state =VNIC_OPEN ;return rc; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 400/593 ibmvnic: set ltb->buff to NULL after freeing
In reply to Greg Kroah-HartmanFrom: Sukadev Bhattiprolu <[email protected]>
[ Upstream commit 552a33729f1a7cc5115d0752064fe9abd6e3e336 ]
free_long_term_buff() checks ltb->buff to decide whether we have a long term buffer to free. So set ltb->buff to NULL afer freeing. While here, also clear ->map_id, fix up some coding style and log an error.
--- drivers/net/ethernet/ibm/ibmvnic.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +15 -11
@@ -212,12 +212,11 @@ static int alloc_long_term_buff(struct ibmvnic_adapter *adapter,mutex_lock (&adapter->fw_lock); adapter->fw_done_rc =0 ;reinit_completion (&adapter->fw_done); - rc =send_request_map (adapter, ltb->addr, - ltb->size, ltb->map_id); + + rc =send_request_map (adapter, ltb->addr, ltb->size, ltb->map_id);if (rc) { -dma_free_coherent (dev, ltb->size, ltb->buff, ltb->addr); -mutex_unlock (&adapter->fw_lock); -return rc; +dev_err (dev,"send_request_map failed, rc = %d\n" , rc); + goto out; } rc =ibmvnic_wait_for_completion (adapter, &adapter->fw_done,10000 );
@@ -225,20 +224,23 @@ static int alloc_long_term_buff(struct ibmvnic_adapter *adapter,dev_err (dev,"Long term map request aborted or timed out,rc = %d\n" , rc); -dma_free_coherent (dev, ltb->size, ltb->buff, ltb->addr); -mutex_unlock (&adapter->fw_lock); -return rc; + goto out; }if (adapter->fw_done_rc) {dev_err (dev,"Couldn't map long term buffer,rc = %d\n" , adapter->fw_done_rc); + rc =-1 ; + goto out; + } + rc =0 ; +out: +if (rc) {dma_free_coherent (dev, ltb->size, ltb->buff, ltb->addr); -mutex_unlock (&adapter->fw_lock); -return -1 ; + ltb->buff =NULL ; }mutex_unlock (&adapter->fw_lock); -return 0 ; +return rc; } static void free_long_term_buff(struct ibmvnic_adapter *adapter,
@@ -258,6 +260,8 @@ static void free_long_term_buff(struct ibmvnic_adapter *adapter, adapter->reset_reason != VNIC_RESET_TIMEOUT)send_request_unmap (adapter, ltb->map_id);dma_free_coherent (dev, ltb->size, ltb->buff, ltb->addr); + ltb->buff =NULL ; + ltb->map_id =0 ; } static int reset_long_term_buff(struct ibmvnic_adapter *adapter,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 401/593 ibmvnic: free tx_pool if tso_pool alloc fails
In reply to Greg Kroah-HartmanFrom: Sukadev Bhattiprolu <[email protected]>
[ Upstream commit f6ebca8efa52e4ae770f0325d618e7bcf08ada0c ]
Free tx_pool and clear it, if allocation of tso_pool fails.
release_tx_pools() assumes we have both tx and tso_pools if ->tx_pool is non-NULL. If allocation of tso_pool fails in init_tx_pools(), the assumption will not be true and we would end up dereferencing ->tx_buff, ->free_map fields from a NULL pointer.
--- drivers/net/ethernet/ibm/ibmvnic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/ibm/ibmvnic.c +4 -1
@@ -751,8 +751,11 @@ static int init_tx_pools(struct net_device *netdev) adapter->tso_pool =kcalloc (tx_subcrqs,sizeof (struct ibmvnic_tx_pool ),GFP_KERNEL ); -if (!adapter->tso_pool) +if (!adapter->tso_pool) { +kfree (adapter->tx_pool); + adapter->tx_pool =NULL ;return -1 ; + } adapter->num_active_tx_pools = tx_subcrqs;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 402/593 RDMA/cma: Protect RMW with qp_mutex
In reply to Greg Kroah-HartmanFrom: Håkon Bugge <[email protected]>
[ Upstream commit ca0c448d2b9f43e3175835d536853854ef544e22 ]
The struct rdma_id_private contains three bit-fields, tos_set, timeout_set, and min_rnr_timer_set. These are set by accessor functions without any synchronization. If two or all accessor functions are invoked in close proximity in time, there will be Read-Modify-Write from several contexts to the same variable, and the result will be intermittent.
Fixed by protecting the bit-fields by the qp_mutex in the accessor functions.
The consumer of timeout_set and min_rnr_timer_set is in rdma_init_qp_attr(), which is called with qp_mutex held for connected QPs. Explicit locking is added for the consumers of tos and tos_set.
This commit depends on ("RDMA/cma: Remove unnecessary INIT->INIT transition"), since the call to rdma_init_qp_attr() from cma_init_conn_qp() does not hold the qp_mutex.
--- drivers/infiniband/core/cma.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/infiniband/core/cma.c +17 -1
@@ -2476,8 +2476,10 @@ static int cma_iw_listen(struct rdma_id_private *id_priv, int backlog)if (IS_ERR (id))return PTR_ERR (id); +mutex_lock (&id_priv->qp_mutex); id->tos = id_priv->tos; id->tos_set = id_priv->tos_set; +mutex_unlock (&id_priv->qp_mutex); id_priv->cm_id.iw = id; memcpy(&id_priv->cm_id.iw->local_addr, cma_src_addr(id_priv),
@@ -2537,8 +2539,10 @@ static int cma_listen_on_dev(struct rdma_id_private *id_priv,cma_id_get (id_priv); dev_id_priv->internal_id =1 ; dev_id_priv->afonly = id_priv->afonly; +mutex_lock (&id_priv->qp_mutex); dev_id_priv->tos_set = id_priv->tos_set; dev_id_priv->tos = id_priv->tos; +mutex_unlock (&id_priv->qp_mutex); ret =rdma_listen (&dev_id_priv->id, id_priv->backlog);if (ret)
@@ -2585,8 +2589,10 @@ void rdma_set_service_type(struct rdma_cm_id *id, int tos)struct rdma_id_private *id_priv; id_priv = container_of(id, struct rdma_id_private, id); +mutex_lock (&id_priv->qp_mutex); id_priv->tos = (u8 ) tos; id_priv->tos_set = true; +mutex_unlock (&id_priv->qp_mutex); }EXPORT_SYMBOL (rdma_set_service_type);
@@ -2613,8 +2619,10 @@ int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout)return -EINVAL ; id_priv = container_of(id, struct rdma_id_private, id); +mutex_lock (&id_priv->qp_mutex); id_priv->timeout = timeout; id_priv->timeout_set = true; +mutex_unlock (&id_priv->qp_mutex);return 0 ; }
@@ -3000,8 +3008,11 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)u8 default_roce_tos = id_priv->cma_dev->default_roce_tos[id_priv->id.port_num -rdma_start_port (id_priv->cma_dev->device)]; -u8 tos = id_priv->tos_set ? id_priv->tos : default_roce_tos; +u8 tos; +mutex_lock (&id_priv->qp_mutex); + tos = id_priv->tos_set ? id_priv->tos : default_roce_tos; +mutex_unlock (&id_priv->qp_mutex); work =kzalloc (sizeof *work,GFP_KERNEL );if (!work)
@@ -3048,8 +3059,10 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)* PacketLifeTime = local ACK timeout/2 * as a reasonable approximation for RoCE networks. */ +mutex_lock (&id_priv->qp_mutex); route->path_rec->packet_life_time = id_priv->timeout_set ? id_priv->timeout -1 :CMA_IBOE_PACKET_LIFETIME ; +mutex_unlock (&id_priv->qp_mutex);if (!route->path_rec->mtu) { ret = -EINVAL ;
@@ -4073,8 +4086,11 @@ static int cma_connect_iw(struct rdma_id_private *id_priv,if (IS_ERR (cm_id))return PTR_ERR (cm_id); +mutex_lock (&id_priv->qp_mutex); cm_id->tos = id_priv->tos; cm_id->tos_set = id_priv->tos_set; +mutex_unlock (&id_priv->qp_mutex); + id_priv->cm_id.iw = cm_id; memcpy(&cm_id->local_addr, cma_src_addr(id_priv),
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 403/593 net: macsec: fix the length used to copy the key for offloading
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit 1f7fe5121127e037b86592ba42ce36515ea0e3f7 ]
The key length used when offloading macsec to Ethernet or PHY drivers was set to MACSEC_KEYID_LEN (16), which is an issue as:
- This was never meant to be the key length.
- The key length can be > 16.
Fix this by using MACSEC_MAX_KEY_LEN to store the key (the max length accepted in uAPI) and secy->key_len to copy it.
--- drivers/net/macsec.c | 4 ++-- include/net/macsec.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/macsec.c +2 -2
@@ -1818,7 +1818,7 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info) ctx.sa.rx_sa = rx_sa; ctx.secy = secy;memcpy (ctx.sa.key,nla_data (tb_sa[MACSEC_SA_ATTR_KEY ]), -MACSEC_KEYID_LEN ); + secy->key_len); err =macsec_offload (ops->mdo_add_rxsa, &ctx);if (err)
@@ -2060,7 +2060,7 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info) ctx.sa.tx_sa = tx_sa; ctx.secy = secy;memcpy (ctx.sa.key,nla_data (tb_sa[MACSEC_SA_ATTR_KEY ]), -MACSEC_KEYID_LEN ); + secy->key_len); err =macsec_offload (ops->mdo_add_txsa, &ctx);if (err)
include/net/macsec.h +1 -1
@@ -241,7 +241,7 @@ struct macsec_context {struct macsec_rx_sc *rx_sc;struct {unsigned char assoc_num; -u8 key[MACSEC_KEYID_LEN ]; +u8 key[MACSEC_MAX_KEY_LEN ];union {struct macsec_rx_sa *rx_sa;struct macsec_tx_sa *tx_sa;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 404/593 net: phy: mscc: fix macsec key length
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit c309217f91f2d2097c2a0a832d9bff50b88c81dc ]
The key length used to store the macsec key was set to MACSEC_KEYID_LEN (16), which is an issue as:
- This was never meant to be the key length.
- The key length can be > 16.
Fix this by using MACSEC_MAX_KEY_LEN instead (the max length accepted in uAPI).
--- drivers/net/phy/mscc/mscc_macsec.c | 2 +- drivers/net/phy/mscc/mscc_macsec.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/mscc/mscc_macsec.c +1 -1
@@ -501,7 +501,7 @@ static u32 vsc8584_macsec_flow_context_id(struct macsec_flow *flow) }/* Derive the AES key to get a key for the hash autentication */ -static int vsc8584_macsec_derive_key (const u8 key[MACSEC_KEYID_LEN ], +static int vsc8584_macsec_derive_key (const u8 key[MACSEC_MAX_KEY_LEN ],u16 key_len,u8 hkey[16 ]) {const u8 input[AES_BLOCK_SIZE ] = {0 };
drivers/net/phy/mscc/mscc_macsec.h +1 -1
@@ -81,7 +81,7 @@ struct macsec_flow {/* Highest takes precedence [0..15] */ u8 priority; -u8 key[MACSEC_KEYID_LEN ]; +u8 key[MACSEC_MAX_KEY_LEN ];union {struct macsec_rx_sa *rx_sa;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 405/593 net: atlantic: fix the macsec key length
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit d67fb4772d9a6cfd10f1109f0e7b1e6eb58c8e16 ]
The key length used to store the macsec key was set to MACSEC_KEYID_LEN (16), which is an issue as:
- This was never meant to be the key length.
- The key length can be > 16.
Fix this by using MACSEC_MAX_KEY_LEN instead (the max length accepted in uAPI).
--- drivers/net/ethernet/aquantia/atlantic/aq_macsec.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_macsec.h +2 -2
@@ -91,7 +91,7 @@ struct aq_macsec_txsc {u32 hw_sc_idx;unsigned long tx_sa_idx_busy;const struct macsec_secy *sw_secy; -u8 tx_sa_key[MACSEC_NUM_AN ][MACSEC_KEYID_LEN ]; +u8 tx_sa_key[MACSEC_NUM_AN ][MACSEC_MAX_KEY_LEN ];struct aq_macsec_tx_sc_stats stats;struct aq_macsec_tx_sa_stats tx_sa_stats[MACSEC_NUM_AN ]; };
@@ -101,7 +101,7 @@ struct aq_macsec_rxsc {unsigned long rx_sa_idx_busy;const struct macsec_secy *sw_secy;const struct macsec_rx_sc *sw_rxsc; -u8 rx_sa_key[MACSEC_NUM_AN ][MACSEC_KEYID_LEN ]; +u8 rx_sa_key[MACSEC_NUM_AN ][MACSEC_MAX_KEY_LEN ];struct aq_macsec_rx_sa_stats rx_sa_stats[MACSEC_NUM_AN ]; };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 406/593 ipv6: fix out-of-bound access in ip6_parse_tlv()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 624085a31c1ad6a80b1e53f686bf6ee92abbf6e8 ]
First problem is that optlen is fetched without checking there is more than one byte to parse.
Fix this by taking care of IPV6_TLV_PAD1 before fetching optlen (under appropriate sanity checks against len)
Second problem is that IPV6_TLV_PADN checks of zero padding are performed before the check of remaining length.
--- net/ipv6/exthdrs.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
net/ipv6/exthdrs.c +13 -14
@@ -135,18 +135,23 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs, len -=2 ;while (len >0 ) { -int optlen = nh[off +1 ] +2 ; -int i; +int optlen, i; -switch (nh[off]) { -case IPV6_TLV_PAD1 : - optlen =1 ; +if (nh[off] ==IPV6_TLV_PAD1 ) { padlen++;if (padlen >7 ) goto bad; -break ; + off++; + len--; +continue ; + } +if (len <2 ) + goto bad; + optlen = nh[off +1 ] +2 ; +if (optlen > len) + goto bad; -case IPV6_TLV_PADN : +if (nh[off] ==IPV6_TLV_PADN ) {/* RFC 2460 states that the purpose of PadN is * to align the containing header to multiples * of 8. 7 is therefore the highest valid value.
@@ -163,12 +168,7 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs,if (nh[off + i] !=0 ) goto bad; } -break ; - -default :/* Other TLV code so scan list */ -if (optlen > len) - goto bad; - + }else { tlv_count++;if (tlv_count > max_count) goto bad;
@@ -188,7 +188,6 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs,return false; padlen =0 ; -break ; } off += optlen; len -= optlen;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 407/593 e1000e: Check the PCIm state
In reply to Greg Kroah-HartmanFrom: Sasha Neftin <[email protected]>
[ Upstream commit 2e7256f12cdb16eaa2515b6231d665044a07c51a ]
Complete to commit def4ec6dce393e ("e1000e: PCIm function state support") Check the PCIm state only on CSME systems. There is no point to do this check on non CSME systems.
This patch fixes a generation a false-positive warning:
"Error in exiting dmoff"
--- drivers/net/ethernet/intel/e1000e/netdev.c | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +13 -11
@@ -5222,18 +5222,20 @@ static void e1000_watchdog_task(struct work_struct *work)pm_runtime_resume (netdev->dev.parent);/* Checking if MAC is in DMoff state*/ - pcim_state =er32 (STATUS ); -while (pcim_state &E1000_STATUS_PCIM_STATE ) { -if (tries++ == dmoff_exit_timeout) { -e_dbg ("Error in exiting dmoff\n" ); -break ; - } -usleep_range (10000 ,20000 ); +if (er32 (FWSM ) &E1000_ICH_FWSM_FW_VALID ) { pcim_state =er32 (STATUS ); - -/* Checking if MAC exited DMoff state */ -if (!(pcim_state &E1000_STATUS_PCIM_STATE )) -e1000_phy_hw_reset (&adapter->hw); +while (pcim_state &E1000_STATUS_PCIM_STATE ) { +if (tries++ == dmoff_exit_timeout) { +e_dbg ("Error in exiting dmoff\n" ); +break ; + } +usleep_range (10000 ,20000 ); + pcim_state =er32 (STATUS ); + +/* Checking if MAC exited DMoff state */ +if (!(pcim_state &E1000_STATUS_PCIM_STATE )) +e1000_phy_hw_reset (&adapter->hw); + } }/* update snapshot of PHY registers on LSC */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 408/593 net: dsa: sja1105: fix NULL pointer dereference in sja1105_reload_cbs()
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit be7f62eebaff2f86c1467a2d33930a0a7a87675b ]
priv->cbs is an array of priv->info->num_cbs_shapers elements of type struct sja1105_cbs_entry which only get allocated if CONFIG_NET_SCH_CBS is enabled.
However, sja1105_reload_cbs() is called from sja1105_static_config_reload() which in turn is called for any of the items in sja1105_reset_reasons, therefore during the normal runtime of the driver and not just from a code path which can be triggered by the tc-cbs offload.
The sja1105_reload_cbs() function does not contain a check whether the priv->cbs array is NULL or not, it just assumes it isn't and proceeds to iterate through the credit-based shaper elements. This leads to a NULL pointer dereference.
The solution is to return success if the priv->cbs array has not been allocated, since sja1105_reload_cbs() has nothing to do.
--- drivers/net/dsa/sja1105/sja1105_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/dsa/sja1105/sja1105_main.c +6 -0
@@ -1711,6 +1711,12 @@ static int sja1105_reload_cbs(struct sja1105_private *priv) {int rc =0 , i; +/* The credit based shapers are only allocated if +* CONFIG_NET_SCH_CBS is enabled. +*/ +if (!priv->cbs) +return 0 ; +for (i =0 ; i < priv->info->num_cbs_shapers; i++) {struct sja1105_cbs_entry *cbs = &priv->cbs[i];
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 409/593 bpfilter: Specify the log level for the kmsg message
In reply to Greg Kroah-HartmanFrom: Gary Lin <[email protected]>
[ Upstream commit a196fa78a26571359740f701cf30d774eb8a72cb ]
Per the kmsg document [0], if we don't specify the log level with a prefix "<N>" in the message string, the default log level will be applied to the message. Since the default level could be warning(4), this would make the log utility such as journalctl treat the message, "Started bpfilter", as a warning. To avoid confusion, this commit adds the prefix "<5>" to make the message always a notice.
[0] https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg
--- net/bpfilter/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bpfilter/main.c +1 -1
@@ -57,7 +57,7 @@ int main(void) { debug_f =fopen ("/dev/kmsg" ,"w" );setvbuf (debug_f,0 , _IOLBF,0 ); -fprintf (debug_f,"Started bpfilter\n" ); +fprintf (debug_f,"<5>Started bpfilter\n" );loop ();fclose (debug_f);return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 410/593 RDMA/cma: Fix incorrect Packet Lifetime calculation
In reply to Greg Kroah-HartmanFrom: Håkon Bugge <[email protected]>
[ Upstream commit e84045eab69c625bc0b0bf24d8e05bc65da1eed1 ]
An approximation for the PacketLifeTime is half the local ACK timeout. The encoding for both timers are logarithmic.
If the local ACK timeout is set, but zero, it means the timer is disabled. In this case, we choose the CMA_IBOE_PACKET_LIFETIME value, since 50% of infinite makes no sense.
Before this commit, the PacketLifeTime became 255 if local ACK timeout was zero (not running).
Fixed by explicitly testing for timeout being zero.
--- drivers/infiniband/core/cma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/core/cma.c +4 -2
@@ -3060,8 +3060,10 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)* as a reasonable approximation for RoCE networks. */ mutex_lock (&id_priv->qp_mutex); - route->path_rec->packet_life_time = id_priv->timeout_set ? - id_priv->timeout -1 :CMA_IBOE_PACKET_LIFETIME ; +if (id_priv->timeout_set && id_priv->timeout) + route->path_rec->packet_life_time = id_priv->timeout -1 ; +else + route->path_rec->packet_life_time =CMA_IBOE_PACKET_LIFETIME ;mutex_unlock (&id_priv->qp_mutex);if (!route->path_rec->mtu) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 411/593 gve: Fix swapped vars when fetching max queues
In reply to Greg Kroah-HartmanFrom: Bailey Forrest <[email protected]>
[ Upstream commit 1db1a862a08f85edc36aad091236ac9b818e949e ]
--- drivers/net/ethernet/google/gve/gve_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/google/gve/gve_main.c +2 -2
@@ -1286,8 +1286,8 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)gve_write_version (®_bar->driver_version);/* Get max queues to alloc etherdev */ - max_rx_queues =ioread32be (®_bar->max_tx_queues); - max_tx_queues =ioread32be (®_bar->max_rx_queues); + max_tx_queues =ioread32be (®_bar->max_tx_queues); + max_rx_queues =ioread32be (®_bar->max_rx_queues);/* Alloc and setup the netdev and priv */ dev =alloc_etherdev_mqs (sizeof (*priv), max_tx_queues, max_rx_queues);if (!dev) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 412/593 Revert "be2net: disable bh with spin_lock in be_process_mcc"
In reply to Greg Kroah-HartmanFrom: Petr Oros <[email protected]>
[ Upstream commit d6765985a42a660f078896d5c5b27f97c580a490 ]
Patch was based on wrong presumption that be_poll can be called only from bh context. It reintroducing old regression (also reverted) and causing deadlock when we use netconsole with benet in bonding.
Old revert: commit 072a9c486004 ("netpoll: revert 6bdb7fe3104 and fix be_poll() instead")
[ 331.269715] bond0: (slave enp0s7f0): Releasing backup interface [ 331.270121] CPU: 4 PID: 1479 Comm: ifenslave Not tainted 5.13.0-rc7+ #2 [ 331.270122] Call Trace: [ 331.270122] [c00000001789f200] [c0000000008c505c] dump_stack+0x100/0x174 (unreliable) [ 331.270124] [c00000001789f240] [c008000001238b9c] be_poll+0x64/0xe90 [be2net] [ 331.270125] [c00000001789f330] [c000000000d1e6e4] netpoll_poll_dev+0x174/0x3d0 [ 331.270127] [c00000001789f400] [c008000001bc167c] bond_poll_controller+0xb4/0x130 [bonding] [ 331.270128] [c00000001789f450] [c000000000d1e624] netpoll_poll_dev+0xb4/0x3d0 [ 331.270129] [c00000001789f520] [c000000000d1ed88] netpoll_send_skb+0x448/0x470 [ 331.270130] [c00000001789f5d0] [c0080000011f14f8] write_msg+0x180/0x1b0 [netconsole] [ 331.270131] [c00000001789f640] [c000000000230c0c] console_unlock+0x54c/0x790 [ 331.270132] [c00000001789f7b0] [c000000000233098] vprintk_emit+0x2d8/0x450 [ 331.270133] [c00000001789f810] [c000000000234758] vprintk+0xc8/0x270 [ 331.270134] [c00000001789f850] [c000000000233c28] printk+0x40/0x54 [ 331.270135] [c00000001789f870] [c000000000ccf908] __netdev_printk+0x150/0x198 [ 331.270136] [c00000001789f910] [c000000000ccfdb4] netdev_info+0x68/0x94 [ 331.270137] [c00000001789f950] [c008000001bcbd70] __bond_release_one+0x188/0x6b0 [bonding] [ 331.270138] [c00000001789faa0] [c008000001bcc6f4] bond_do_ioctl+0x42c/0x490 [bonding] [ 331.270139] [c00000001789fb60] [c000000000d0d17c] dev_ifsioc+0x17c/0x400 [ 331.270140] [c00000001789fbc0] [c000000000d0db70] dev_ioctl+0x390/0x890 [ 331.270141] [c00000001789fc10] [c000000000c7c76c] sock_do_ioctl+0xac/0x1b0 [ 331.270142] [c00000001789fc90] [c000000000c7ffac] sock_ioctl+0x31c/0x6e0 [ 331.270143] [c00000001789fd60] [c0000000005b9728] sys_ioctl+0xf8/0x150 [ 331.270145] [c00000001789fdb0] [c0000000000336c0] system_call_exception+0x160/0x2f0 [ 331.270146] [c00000001789fe10] [c00000000000d35c] system_call_common+0xec/0x278 [ 331.270147] --- interrupt: c00 at 0x7fffa6c6ec00 [ 331.270147] NIP: 00007fffa6c6ec00 LR: 0000000105c4185c CTR: 0000000000000000 [ 331.270148] REGS: c00000001789fe80 TRAP: 0c00 Not tainted (5.13.0-rc7+) [ 331.270148] MSR: 800000000280f033 <SF,VEC,VSX,EE,PR,FP,ME,IR,DR,RI,LE> CR: 28000428 XER: 00000000 [ 331.270155] IRQMASK: 0 [ 331.270156] GPR00: 0000000000000036 00007fffd494d5b0 00007fffa6d57100 0000000000000003 [ 331.270158] GPR04: 0000000000008991 00007fffd494d6d0 0000000000000008 00007fffd494f28c [ 331.270161] GPR08: 0000000000000003 0000000000000000 0000000000000000 0000000000000000 [ 331.270164] GPR12: 0000000000000000 00007fffa6dfa220 0000000000000000 0000000000000000 [ 331.270167] GPR16: 0000000105c44880 0000000000000000 0000000105c60088 0000000105c60318 [ 331.270170] GPR20: 0000000105c602c0 0000000105c44560 0000000000000000 0000000000000000 [ 331.270172] GPR24: 00007fffd494dc50 00007fffd494d6a8 0000000105c60008 00007fffd494d6d0 [ 331.270175] GPR28: 00007fffd494f27e 0000000105c6026c 00007fffd494f284 0000000000000000 [ 331.270178] NIP [00007fffa6c6ec00] 0x7fffa6c6ec00 [ 331.270178] LR [0000000105c4185c] 0x105c4185c [ 331.270179] --- interrupt: c00
This reverts commit d0d006a43e9a7a796f6f178839c92fcc222c564d.
--- drivers/net/ethernet/emulex/benet/be_cmds.c | 6 ++++-- drivers/net/ethernet/emulex/benet/be_main.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/emulex/benet/be_cmds.c +4 -2
@@ -550,7 +550,7 @@ int be_process_mcc(struct be_adapter *adapter)int num =0 , status =0 ;struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; -spin_lock_bh (&adapter->mcc_cq_lock); +spin_lock (&adapter->mcc_cq_lock);while ((compl =be_mcc_compl_get (adapter))) {if (compl->flags &CQE_FLAGS_ASYNC_MASK ) {
@@ -566,7 +566,7 @@ int be_process_mcc(struct be_adapter *adapter)if (num)be_cq_notify (adapter, mcc_obj->cq.id, mcc_obj->rearm_cq, num); -spin_unlock_bh (&adapter->mcc_cq_lock); +spin_unlock (&adapter->mcc_cq_lock);return status; }
@@ -581,7 +581,9 @@ static int be_mcc_wait_compl(struct be_adapter *adapter)if (be_check_error (adapter,BE_ERROR_ANY ))return -EIO ; +local_bh_disable (); status =be_process_mcc (adapter); +local_bh_enable ();if (atomic_read (&mcc_obj->q.used) ==0 )break ;
drivers/net/ethernet/emulex/benet/be_main.c +2 -0
@@ -5509,7 +5509,9 @@ static void be_worker(struct work_struct *work)* mcc completions */ if (!netif_running (adapter->netdev)) { +local_bh_disable ();be_process_mcc (adapter); +local_bh_enable (); goto reschedule; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 413/593 Bluetooth: mgmt: Fix slab-out-of-bounds in tlv_data_is_valid
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 799acb9347915bfe4eac0ff2345b468f0a1ca207 ]
This fixes parsing of LTV entries when the length is 0.
Found with:
tools/mgmt-tester -s "Add Advertising - Success (ScRsp only)"
Add Advertising - Success (ScRsp only) - run
Sending Add Advertising (0x003e)
Test condition added, total 1
[ 11.004577] ================================================================== [ 11.005292] BUG: KASAN: slab-out-of-bounds in tlv_data_is_valid+0x87/0xe0 [ 11.005984] Read of size 1 at addr ffff888002c695b0 by task mgmt-tester/87 [ 11.006711] [ 11.007176] [ 11.007429] Allocated by task 87: [ 11.008151] [ 11.008438] The buggy address belongs to the object at ffff888002c69580 [ 11.008438] which belongs to the cache kmalloc-64 of size 64 [ 11.010526] The buggy address is located 48 bytes inside of [ 11.010526] 64-byte region [ffff888002c69580, ffff888002c695c0) [ 11.012423] The buggy address belongs to the page: [ 11.013291] [ 11.013544] Memory state around the buggy address: [ 11.014359] ffff888002c69480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 11.015453] ffff888002c69500: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 11.016232] >ffff888002c69580: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc [ 11.017010] ^ [ 11.017547] ffff888002c69600: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc [ 11.018296] ffff888002c69680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 11.019116] ==================================================================
--- net/bluetooth/mgmt.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/mgmt.c +3 -0
@@ -7350,6 +7350,9 @@ static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data,for (i =0 , cur_len =0 ; i < len; i += (cur_len +1 )) { cur_len = data[i]; +if (!cur_len) +continue ; +if (data[i +1 ] ==EIR_FLAGS && (!is_adv_data ||flags_managed (adv_flags)))return false;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 414/593 Bluetooth: Fix not sending Set Extended Scan Response
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit a76a0d365077711594ce200a9553ed6d1ff40276 ]
Current code is actually failing on the following tests of mgmt-tester because get_adv_instance_scan_rsp_len did not account for flags that cause scan response data to be included resulting in non-scannable instance when in fact it should be scannable.
--- net/bluetooth/hci_request.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
net/bluetooth/hci_request.c +6 -8
@@ -1060,9 +1060,10 @@ static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance)if (!adv_instance)return 0 ; -/* TODO: Take into account the "appearance" and "local-name" flags here. -* These are currently being ignored as they are not supported. -*/ +if (adv_instance->flags &MGMT_ADV_FLAG_APPEARANCE || + adv_instance->flags &MGMT_ADV_FLAG_LOCAL_NAME ) +return 1 ; +return adv_instance->scan_rsp_len; }
@@ -1599,14 +1600,11 @@ void __hci_req_update_scan_rsp_data(struct hci_request *req, u8 instance)memset (&cp,0 ,sizeof (cp)); -/* Extended scan response data doesn't allow a response to be -* set if the instance isn't scannable. -*/ -if (get_adv_instance_scan_rsp_len (hdev, instance)) +if (instance) len =create_instance_scan_rsp_data (hdev, instance, cp.data);else - len =0 ; + len =create_default_scan_rsp_data (hdev, cp.data);if (hdev->scan_rsp_data_len == len && !memcmp (cp.data, hdev->scan_rsp_data, len))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 415/593 Bluetooth: Fix Set Extended (Scan Response) Data
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit c9ed0a7077306f9d41d74fb006ab5dbada8349c5 ]
These command do have variable length and the length can go up to 251, so this changes the struct to not use a fixed size and then when creating the PDU only the actual length of the data send to the controller.
--- include/net/bluetooth/hci.h | 6 ++-- include/net/bluetooth/hci_core.h | 8 ++--- net/bluetooth/hci_request.c | 51 ++++++++++++++++++-------------- 3 files changed, 37 insertions(+), 28 deletions(-)
include/net/bluetooth/hci.h +4 -2
@@ -1773,13 +1773,15 @@ struct hci_cp_ext_adv_set {__u8 max_events; } __packed; +#define HCI_MAX_EXT_AD_LENGTH 251 +#define HCI_OP_LE_SET_EXT_ADV_DATA 0x2037struct hci_cp_le_set_ext_adv_data {__u8 handle;__u8 operation;__u8 frag_pref;__u8 length; -__u8 data[HCI_MAX_AD_LENGTH ]; +__u8 data[]; } __packed;#define HCI_OP_LE_SET_EXT_SCAN_RSP_DATA 0x2038
@@ -1788,7 +1790,7 @@ struct hci_cp_le_set_ext_scan_rsp_data {__u8 operation;__u8 frag_pref;__u8 length; -__u8 data[HCI_MAX_AD_LENGTH ]; +__u8 data[]; } __packed;#define LE_SET_ADV_DATA_OP_COMPLETE 0x03
include/net/bluetooth/hci_core.h +4 -4
@@ -226,9 +226,9 @@ struct adv_info {__u16 remaining_time;__u16 duration;__u16 adv_data_len; -__u8 adv_data[HCI_MAX_AD_LENGTH ]; +__u8 adv_data[HCI_MAX_EXT_AD_LENGTH ];__u16 scan_rsp_len; -__u8 scan_rsp_data[HCI_MAX_AD_LENGTH ]; +__u8 scan_rsp_data[HCI_MAX_EXT_AD_LENGTH ];__s8 tx_power;bdaddr_t random_addr;bool rpa_expired;
@@ -523,9 +523,9 @@ struct hci_dev {DECLARE_BITMAP (dev_flags, __HCI_NUM_FLAGS);__s8 adv_tx_power; -__u8 adv_data[HCI_MAX_AD_LENGTH ]; +__u8 adv_data[HCI_MAX_EXT_AD_LENGTH ];__u8 adv_data_len; -__u8 scan_rsp_data[HCI_MAX_AD_LENGTH ]; +__u8 scan_rsp_data[HCI_MAX_EXT_AD_LENGTH ];__u8 scan_rsp_data_len;struct list_head adv_instances;
net/bluetooth/hci_request.c +29 -22
85 lines not on this page · raw message
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 416/593 Bluetooth: Fix handling of HCI_LE_Advertising_Set_Terminated event
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 23837a6d7a1a61818ed94a6b8af552d6cf7d32d5 ]
Error status of this event means that it has ended due reasons other than a connection:
'If advertising has terminated as a result of the advertising duration elapsing, the Status parameter shall be set to the error code Advertising Timeout (0x3C).'
'If advertising has terminated because the Max_Extended_Advertising_Events was reached, the Status parameter shall be set to the error code Limit Reached (0x43).'
--- net/bluetooth/hci_event.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
net/bluetooth/hci_event.c +12 -1
@@ -5256,8 +5256,19 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, struct sk_buff *skb)BT_DBG ("%s status 0x%2.2x" , hdev->name, ev->status); -if (ev->status) +if (ev->status) { +struct adv_info *adv; + + adv =hci_find_adv_instance (hdev, ev->handle); +if (!adv) +return ; + +/* Remove advertising as it has been terminated */ +hci_remove_adv_instance (hdev, ev->handle); +mgmt_advertising_removed (NULL , hdev, ev->handle); +return ; + } conn =hci_conn_hash_lookup_handle (hdev,__le16_to_cpu (ev->conn_handle));if (conn) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 417/593 clk: actions: Fix UART clock dividers on Owl S500 SoC
In reply to Greg Kroah-HartmanFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit 2dca2a619a907579e3e65e7c1789230c2b912e88 ]
Use correct divider registers for the Actions Semi Owl S500 SoC's UART clocks.
--- drivers/clk/actions/owl-s500.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/clk/actions/owl-s500.c +6 -6
@@ -305,7 +305,7 @@ static OWL_COMP_FIXED_FACTOR(i2c3_clk, "i2c3_clk", "ethernet_pll_clk", static OWL_COMP_DIV(uart0_clk, "uart0_clk", uart_clk_mux_p,OWL_MUX_HW (CMU_UART0CLK ,16 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN1 ,6 ,0 ), -OWL_DIVIDER_HW (CMU_UART1CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), +OWL_DIVIDER_HW (CMU_UART0CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), CLK_IGNORE_UNUSED); static OWL_COMP_DIV(uart1_clk, "uart1_clk", uart_clk_mux_p,
@@ -317,31 +317,31 @@ static OWL_COMP_DIV(uart1_clk, "uart1_clk", uart_clk_mux_p, static OWL_COMP_DIV(uart2_clk, "uart2_clk", uart_clk_mux_p,OWL_MUX_HW (CMU_UART2CLK ,16 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN1 ,8 ,0 ), -OWL_DIVIDER_HW (CMU_UART1CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), +OWL_DIVIDER_HW (CMU_UART2CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), CLK_IGNORE_UNUSED); static OWL_COMP_DIV(uart3_clk, "uart3_clk", uart_clk_mux_p,OWL_MUX_HW (CMU_UART3CLK ,16 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN1 ,19 ,0 ), -OWL_DIVIDER_HW (CMU_UART1CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), +OWL_DIVIDER_HW (CMU_UART3CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), CLK_IGNORE_UNUSED); static OWL_COMP_DIV(uart4_clk, "uart4_clk", uart_clk_mux_p,OWL_MUX_HW (CMU_UART4CLK ,16 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN1 ,20 ,0 ), -OWL_DIVIDER_HW (CMU_UART1CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), +OWL_DIVIDER_HW (CMU_UART4CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), CLK_IGNORE_UNUSED); static OWL_COMP_DIV(uart5_clk, "uart5_clk", uart_clk_mux_p,OWL_MUX_HW (CMU_UART5CLK ,16 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN1 ,21 ,0 ), -OWL_DIVIDER_HW (CMU_UART1CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), +OWL_DIVIDER_HW (CMU_UART5CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), CLK_IGNORE_UNUSED); static OWL_COMP_DIV(uart6_clk, "uart6_clk", uart_clk_mux_p,OWL_MUX_HW (CMU_UART6CLK ,16 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN1 ,18 ,0 ), -OWL_DIVIDER_HW (CMU_UART1CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), +OWL_DIVIDER_HW (CMU_UART6CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), CLK_IGNORE_UNUSED); static OWL_COMP_DIV(i2srx_clk, "i2srx_clk", i2s_clk_mux_p,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 418/593 clk: actions: Fix SD clocks factor table on Owl S500 SoC
In reply to Greg Kroah-HartmanFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit fe1f71e338d77814da3ef44e9f64d32981a6ccdf ]
Drop the unsupported entries in the factor table used for the SD[0-2] clocks definitions on the Actions Semi Owl S500 SoC.
--- drivers/clk/actions/owl-s500.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/clk/actions/owl-s500.c +2 -4
@@ -127,8 +127,7 @@ static struct clk_factor_table sd_factor_table[] = { { 12, 1, 13 }, { 13, 1, 14 }, { 14, 1, 15 }, { 15, 1, 16 }, { 16, 1, 17 }, { 17, 1, 18 }, { 18, 1, 19 }, { 19, 1, 20 }, { 20, 1, 21 }, { 21, 1, 22 }, { 22, 1, 23 }, { 23, 1, 24 }, - { 24, 1, 25 }, { 25, 1, 26 }, { 26, 1, 27 }, { 27, 1, 28 }, - { 28, 1, 29 }, { 29, 1, 30 }, { 30, 1, 31 }, { 31, 1, 32 }, + { 24, 1, 25 },/* bit8: /128 */ { 256, 1, 1 * 128 }, { 257, 1, 2 * 128 }, { 258, 1, 3 * 128 }, { 259, 1, 4 * 128 },
@@ -137,8 +136,7 @@ static struct clk_factor_table sd_factor_table[] = { { 268, 1, 13 * 128 }, { 269, 1, 14 * 128 }, { 270, 1, 15 * 128 }, { 271, 1, 16 * 128 }, { 272, 1, 17 * 128 }, { 273, 1, 18 * 128 }, { 274, 1, 19 * 128 }, { 275, 1, 20 * 128 }, { 276, 1, 21 * 128 }, { 277, 1, 22 * 128 }, { 278, 1, 23 * 128 }, { 279, 1, 24 * 128 }, - { 280, 1, 25 * 128 }, { 281, 1, 26 * 128 }, { 282, 1, 27 * 128 }, { 283, 1, 28 * 128 }, - { 284, 1, 29 * 128 }, { 285, 1, 30 * 128 }, { 286, 1, 31 * 128 }, { 287, 1, 32 * 128 }, + { 280, 1, 25 * 128 }, { 0, 0, 0 }, };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 419/593 clk: actions: Fix bisp_factor_table based clocks on Owl S500 SoC
In reply to Greg Kroah-HartmanFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit a8f1f03caa51aa7a69c671aa87c475034db7d368 ]
The following clocks of the Actions Semi Owl S500 SoC have been defined to use a shared clock factor table 'bisp_factor_table[]': DE[1-2], VCE, VDE, BISP, SENSOR[0-1]
There are several issues involved in this approach:
* 'bisp_factor_table[]' describes the configuration of a regular 8-rates divider, so its usage is redundant. Additionally, judging by the BISP clock context, it is incomplete since it maps only 8 out of 12 possible entries.
* The clocks mentioned above are not identical in terms of the available rates, therefore cannot rely on the same factor table. Specifically, BISP and SENSOR* are standard 12-rate dividers so their configuration should rely on a proper clock div table, while VCE and VDE require a factor table that is a actually a subset of the one needed for DE[1-2] clocks.
Let's fix this by implementing the following:
* Add new factor tables 'de_factor_table' and 'hde_factor_table' to properly handle DE[1-2], VCE and VDE clocks.
* Add a common div table 'std12rate_div_table' for BISP and SENSOR[0-1] clocks converted to OWL_COMP_DIV.
* Drop the now unused 'bisp_factor_table[]'.
Additionally, drop the CLK_IGNORE_UNUSED flag for SENSOR[0-1] since there is no reason to always keep ON those clocks.
--- drivers/clk/actions/owl-s500.c | 44 ++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 15 deletions(-)
drivers/clk/actions/owl-s500.c +29 -15
@@ -140,9 +140,16 @@ static struct clk_factor_table sd_factor_table[] = { { 0, 0, 0 }, }; -static struct clk_factor_table bisp_factor_table[] = { - {0 ,1 ,1 }, {1 ,1 ,2 }, {2 ,1 ,3 }, {3 ,1 ,4 }, - {4 ,1 ,5 }, {5 ,1 ,6 }, {6 ,1 ,7 }, {7 ,1 ,8 }, +static struct clk_factor_table de_factor_table[] = { + {0 ,1 ,1 }, {1 ,2 ,3 }, {2 ,1 ,2 }, {3 ,2 ,5 }, + {4 ,1 ,3 }, {5 ,1 ,4 }, {6 ,1 ,6 }, {7 ,1 ,8 }, + {8 ,1 ,12 }, + {0 ,0 ,0 }, +}; + +static struct clk_factor_table hde_factor_table[] = { + {0 ,1 ,1 }, {1 ,2 ,3 }, {2 ,1 ,2 }, {3 ,2 ,5 }, + {4 ,1 ,3 }, {5 ,1 ,4 }, {6 ,1 ,6 }, {7 ,1 ,8 }, {0 ,0 ,0 }, };
@@ -156,6 +163,13 @@ static struct clk_div_table rmii_ref_div_table[] = { { 0, 0 }, }; +static struct clk_div_table std12rate_div_table[] = { + {0 ,1 }, {1 ,2 }, {2 ,3 }, {3 ,4 }, + {4 ,5 }, {5 ,6 }, {6 ,7 }, {7 ,8 }, + {8 ,9 }, {9 ,10 }, {10 ,11 }, {11 ,12 }, + {0 ,0 }, +}; +static struct clk_div_table i2s_div_table[] = { {0 ,1 }, {1 ,2 }, {2 ,3 }, {3 ,4 }, { 4, 6 }, { 5, 8 }, { 6, 12 }, { 7, 16 },
@@ -191,39 +205,39 @@ static OWL_DIVIDER(rmii_ref_clk, "rmii_ref_clk", "ethernet_pll_clk", CMU_ETHERNE/* factor clocks */ static OWL_FACTOR(ahb_clk, "ahb_clk", "h_clk", CMU_BUSCLK1, 2, 2, ahb_factor_table, 0, 0); -static OWL_FACTOR(de1_clk, "de_clk1", "de_clk", CMU_DECLK, 0, 3, bisp_factor_table, 0, 0); -static OWL_FACTOR(de2_clk, "de_clk2", "de_clk", CMU_DECLK, 4, 3, bisp_factor_table, 0, 0); +static OWL_FACTOR(de1_clk, "de_clk1", "de_clk", CMU_DECLK, 0, 4, de_factor_table, 0, 0); +static OWL_FACTOR(de2_clk, "de_clk2", "de_clk", CMU_DECLK, 4, 4, de_factor_table, 0, 0);/* composite clocks */ static OWL_COMP_FACTOR(vce_clk, "vce_clk", hde_clk_mux_p,OWL_MUX_HW (CMU_VCECLK ,4 ,2 ),OWL_GATE_HW (CMU_DEVCLKEN0 ,26 ,0 ), -OWL_FACTOR_HW (CMU_VCECLK ,0 ,3 ,0 , bisp_factor_table), +OWL_FACTOR_HW (CMU_VCECLK ,0 ,3 ,0 , hde_factor_table), 0); static OWL_COMP_FACTOR(vde_clk, "vde_clk", hde_clk_mux_p,OWL_MUX_HW (CMU_VDECLK ,4 ,2 ),OWL_GATE_HW (CMU_DEVCLKEN0 ,25 ,0 ), -OWL_FACTOR_HW (CMU_VDECLK ,0 ,3 ,0 , bisp_factor_table), +OWL_FACTOR_HW (CMU_VDECLK ,0 ,3 ,0 , hde_factor_table), 0); -static OWL_COMP_FACTOR(bisp_clk, "bisp_clk", bisp_clk_mux_p, +static OWL_COMP_DIV(bisp_clk, "bisp_clk", bisp_clk_mux_p,OWL_MUX_HW (CMU_BISPCLK ,4 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN0 ,14 ,0 ), -OWL_FACTOR_HW (CMU_BISPCLK ,0 ,3 ,0 , bisp_factor_table), +OWL_DIVIDER_HW (CMU_BISPCLK ,0 ,4 ,0 , std12rate_div_table), 0); -static OWL_COMP_FACTOR(sensor0_clk, "sensor0_clk", sensor_clk_mux_p, +static OWL_COMP_DIV(sensor0_clk, "sensor0_clk", sensor_clk_mux_p,OWL_MUX_HW (CMU_SENSORCLK ,4 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN0 ,14 ,0 ), -OWL_FACTOR_HW (CMU_SENSORCLK ,0 ,3 ,0 , bisp_factor_table), - CLK_IGNORE_UNUSED); +OWL_DIVIDER_HW (CMU_SENSORCLK ,0 ,4 ,0 , std12rate_div_table), + 0); -static OWL_COMP_FACTOR(sensor1_clk, "sensor1_clk", sensor_clk_mux_p, +static OWL_COMP_DIV(sensor1_clk, "sensor1_clk", sensor_clk_mux_p,OWL_MUX_HW (CMU_SENSORCLK ,4 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN0 ,14 ,0 ), -OWL_FACTOR_HW (CMU_SENSORCLK ,8 ,3 ,0 , bisp_factor_table), - CLK_IGNORE_UNUSED); +OWL_DIVIDER_HW (CMU_SENSORCLK ,8 ,4 ,0 , std12rate_div_table), + 0); static OWL_COMP_FACTOR(sd0_clk, "sd0_clk", sd_clk_mux_p, OWL_MUX_HW(CMU_SD0CLK, 9, 1),
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 420/593 clk: actions: Fix AHPPREDIV-H-AHB clock chain on Owl S500 SoC
In reply to Greg Kroah-HartmanFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit fd90b5b9045274360b12cea0f2ce50f3bcfb25cc ]
There are a few issues with the setup of the Actions Semi Owl S500 SoC's clock chain involving AHPPREDIV, H and AHB clocks:
* AHBPREDIV clock is defined as a muxer only, although it also acts as a divider.
* H clock is using a wrong divider register offset
* AHB is defined as a multi-rate factor clock, but it is actually just a fixed pass clock.
Let's provide the following fixes:
* Change AHBPREDIV clock to an ungated OWL_COMP_DIV definition.
* Use the correct register shift value in the OWL_DIVIDER definition for H clock
* Drop the unneeded 'ahb_factor_table[]' and change AHB clock to an ungated OWL_COMP_FIXED_FACTOR definition.
--- drivers/clk/actions/owl-s500.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/clk/actions/owl-s500.c +11 -8
@@ -153,11 +153,6 @@ static struct clk_factor_table hde_factor_table[] = { { 0, 0, 0 }, }; -static struct clk_factor_table ahb_factor_table[] = { - {1 ,1 ,2 }, {2 ,1 ,3 }, - {0 ,0 ,0 }, -}; -static struct clk_div_table rmii_ref_div_table[] = { {0 ,4 }, {1 ,10 }, { 0, 0 },
@@ -186,7 +181,6 @@ static struct clk_div_table nand_div_table[] = {/* mux clock */ static OWL_MUX(dev_clk, "dev_clk", dev_clk_mux_p, CMU_DEVPLL, 12, 1, CLK_SET_RATE_PARENT); -static OWL_MUX(ahbprediv_clk, "ahbprediv_clk", ahbprediv_clk_mux_p, CMU_BUSCLK1, 8, 3, CLK_SET_RATE_PARENT);/* gate clocks */ static OWL_GATE(gpio_clk, "gpio_clk", "apb_clk", CMU_DEVCLKEN0, 18, 0, 0);
@@ -199,16 +193,25 @@ static OWL_GATE(timer_clk, "timer_clk", "hosc", CMU_DEVCLKEN1, 27, 0, 0); static OWL_GATE(hdmi_clk, "hdmi_clk", "hosc", CMU_DEVCLKEN1, 3, 0, 0);/* divider clocks */ -static OWL_DIVIDER(h_clk, "h_clk", "ahbprediv_clk", CMU_BUSCLK1, 12, 2, NULL, 0, 0); +static OWL_DIVIDER(h_clk, "h_clk", "ahbprediv_clk", CMU_BUSCLK1, 2, 2, NULL, 0, 0); static OWL_DIVIDER(apb_clk, "apb_clk", "ahb_clk", CMU_BUSCLK1, 14, 2, NULL, 0, 0); static OWL_DIVIDER(rmii_ref_clk, "rmii_ref_clk", "ethernet_pll_clk", CMU_ETHERNETPLL, 1, 1, rmii_ref_div_table, 0, 0);/* factor clocks */ -static OWL_FACTOR(ahb_clk, "ahb_clk", "h_clk", CMU_BUSCLK1, 2, 2, ahb_factor_table, 0, 0); static OWL_FACTOR(de1_clk, "de_clk1", "de_clk", CMU_DECLK, 0, 4, de_factor_table, 0, 0); static OWL_FACTOR(de2_clk, "de_clk2", "de_clk", CMU_DECLK, 4, 4, de_factor_table, 0, 0);/* composite clocks */ +static OWL_COMP_DIV(ahbprediv_clk, "ahbprediv_clk", ahbprediv_clk_mux_p, +OWL_MUX_HW (CMU_BUSCLK1 ,8 ,3 ), + { 0 }, +OWL_DIVIDER_HW (CMU_BUSCLK1 ,12 ,2 ,0 ,NULL ), + CLK_SET_RATE_PARENT); + +static OWL_COMP_FIXED_FACTOR(ahb_clk, "ahb_clk", "h_clk", + { 0 }, + 1, 1, 0); + static OWL_COMP_FACTOR(vce_clk, "vce_clk", hde_clk_mux_p,OWL_MUX_HW (CMU_VCECLK ,4 ,2 ), OWL_GATE_HW(CMU_DEVCLKEN0, 26, 0),
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 421/593 clk: qcom: clk-alpha-pll: fix CAL_L write in alpha_pll_fabia_prepare
In reply to Greg Kroah-HartmanFrom: Jonathan Marek <[email protected]>
[ Upstream commit 7f54bf2640e877c8a9b4cc7e2b29f82e3ca1a284 ]
Caught this when looking at alpha-pll code. Untested but it is clear that this was intended to write to PLL_CAL_L_VAL and not PLL_ALPHA_VAL.
--- drivers/clk/qcom/clk-alpha-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/clk-alpha-pll.c +1 -1
@@ -1214,7 +1214,7 @@ static int alpha_pll_fabia_prepare(struct clk_hw *hw)return -EINVAL ;/* Setup PLL for calibration frequency */ -regmap_write (pll->clkr.regmap,PLL_ALPHA_VAL (pll), cal_l); +regmap_write (pll->clkr.regmap,PLL_CAL_L_VAL (pll), cal_l);/* Bringup the PLL at calibration frequency */ ret =clk_alpha_pll_enable (hw);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 422/593 clk: si5341: Wait for DEVICE_READY on startup
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 6e7d2de1e000d36990923ed80d2e78dfcb545cee ]
The Si5341 datasheet warns that before accessing any other registers, including the PAGE register, we need to wait for the DEVICE_READY register to indicate the device is ready, or the process of the device loading its state from NVM can be corrupted. Wait for DEVICE_READY on startup before continuing initialization. This is done using a raw I2C register read prior to setting up regmap to avoid any potential unwanted automatic PAGE register accesses from regmap at this stage.
--- drivers/clk/clk-si5341.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/clk/clk-si5341.c +32 -0
@@ -94,6 +94,7 @@ struct clk_si5341_output_config {#define SI5341_STATUS 0x000C#define SI5341_SOFT_RST 0x001C#define SI5341_IN_SEL 0x0021 +#define SI5341_DEVICE_READY 0x00FE#define SI5341_XAXB_CFG 0x090E#define SI5341_IN_EN 0x0949#define SI5341_INX_TO_PFD_EN 0x094A
@@ -1189,6 +1190,32 @@ static const struct regmap_range_cfg si5341_regmap_ranges[] = { }, }; +static int si5341_wait_device_ready (struct i2c_client *client) +{ +int count; + +/* Datasheet warns: Any attempt to read or write any register other +* than DEVICE_READY before DEVICE_READY reads as 0x0F may corrupt the +* NVM programming and may corrupt the register contents, as they are +* read from NVM. Note that this includes accesses to the PAGE register. +* Also: DEVICE_READY is available on every register page, so no page +* change is needed to read it. +* Do this outside regmap to avoid automatic PAGE register access. +* May take up to 300ms to complete. +*/ +for (count =0 ; count <15 ; ++count) { +s32 result =i2c_smbus_read_byte_data (client, +SI5341_DEVICE_READY ); +if (result <0 ) +return result; +if (result ==0x0F ) +return 0 ; +msleep (20 ); + } +dev_err (&client->dev,"timeout waiting for DEVICE_READY\n" ); +return -EIO ; +} +static const struct regmap_config si5341_regmap_config = { .reg_bits =8 , .val_bits =8 ,
@@ -1385,6 +1412,11 @@ static int si5341_probe(struct i2c_client *client, data->i2c_client = client; +/* Must be done before otherwise touching hardware */ + err =si5341_wait_device_ready (client); +if (err) +return err; +for (i =0 ; i <SI5341_NUM_INPUTS ; ++i) { input =devm_clk_get (&client->dev, si5341_input_clock_names[i]);if (IS_ERR (input)) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 423/593 clk: si5341: Avoid divide errors due to bogus register contents
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 78f6f406026d688868223d5dbeb197a4f7e9a9fd ]
If the Si5341 is being initially programmed and has no stored NVM configuration, some of the register contents may contain unexpected values, such as zeros, which could cause divide by zero errors during driver initialization. Trap errors caused by zero registers or zero clock rates which could result in divide errors later in the code.
--- drivers/clk/clk-si5341.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/clk/clk-si5341.c +13 -2
@@ -624,6 +624,9 @@ static unsigned long si5341_synth_clk_recalc_rate(struct clk_hw *hw, SI5341_SYNTH_N_NUM(synth->index), &n_num, &n_den);if (err <0 )return err; +/* Check for bogus/uninitialized settings */ +if (!n_num || !n_den) +return 0 ;/* * n_num and n_den are shifted left as much as possible, so to prevent
@@ -807,6 +810,9 @@ static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate, {unsigned long r; +if (!rate) +return 0 ; + r = *parent_rate >>1 ;/* If rate is an even divisor, no changes to parent required */
@@ -835,11 +841,16 @@ static int si5341_output_clk_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) {struct clk_si5341_output *output =to_clk_si5341_output (hw); -/* Frequency divider is (r_div + 1) * 2 */ -u32 r_div = (parent_rate / rate) >>1 ; +u32 r_div;int err;u8 r[3 ]; +if (!rate) +return -EINVAL ; + +/* Frequency divider is (r_div + 1) * 2 */ + r_div = (parent_rate / rate) >>1 ; +if (r_div <=1 ) r_div =0 ;else if (r_div >=BIT (24 ))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 424/593 clk: si5341: Check for input clock presence and PLL lock on startup
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 71dcc4d1f7d2ad97ff7ab831281bc6893ff713a2 ]
After initializing the device, wait for it to report that the input clock is present and the PLL has locked before declaring success.
--- drivers/clk/clk-si5341.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/clk/clk-si5341.c +26 -0
@@ -92,6 +92,9 @@ struct clk_si5341_output_config {#define SI5341_PN_BASE 0x0002#define SI5341_DEVICE_REV 0x0005#define SI5341_STATUS 0x000C +#define SI5341_LOS 0x000D +#define SI5341_STATUS_STICKY 0x0011 +#define SI5341_LOS_STICKY 0x0012#define SI5341_SOFT_RST 0x001C#define SI5341_IN_SEL 0x0021#define SI5341_DEVICE_READY 0x00FE
@@ -99,6 +102,12 @@ struct clk_si5341_output_config {#define SI5341_IN_EN 0x0949#define SI5341_INX_TO_PFD_EN 0x094A +/* Status bits */ +#define SI5341_STATUS_SYSINCAL BIT(0) +#define SI5341_STATUS_LOSXAXB BIT(1) +#define SI5341_STATUS_LOSREF BIT(2) +#define SI5341_STATUS_LOL BIT(3) +/* Input selection */ #define SI5341_IN_SEL_MASK 0x06#define SI5341_IN_SEL_SHIFT 1
@@ -1416,6 +1425,7 @@ static int si5341_probe(struct i2c_client *client,unsigned int i;struct clk_si5341_output_config config[SI5341_MAX_NUM_OUTPUTS ];bool initialization_required; +u32 status; data =devm_kzalloc (&client->dev,sizeof (*data),GFP_KERNEL );if (!data)
@@ -1583,6 +1593,22 @@ static int si5341_probe(struct i2c_client *client,return err; } +/* wait for device to report input clock present and PLL lock */ + err =regmap_read_poll_timeout (data->regmap,SI5341_STATUS , status, + !(status & (SI5341_STATUS_LOSREF |SI5341_STATUS_LOL )), +10000 ,250000 ); +if (err) { +dev_err (&client->dev,"Error waiting for input clock or PLL lock\n" ); +return err; + } + +/* clear sticky alarm bits from initialization */ + err =regmap_write (data->regmap,SI5341_STATUS_STICKY ,0 ); +if (err) { +dev_err (&client->dev,"unable to clear sticky status\n" ); +return err; + } +/* Free the names, clk framework makes copies */ for (i =0 ; i < data->num_synth; ++i)devm_kfree (&client->dev, (void *)synth_clock_names[i]);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 425/593 clk: si5341: Update initialization magic
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 3c9b49b0031aefb81adfdba5ab0ddf3ca3a2cdc9 ]
Update the default register settings to include the VCO_RESET_CALCODE settings (set by the SiLabs ClockBuilder software but not described in the datasheet). Also update part of the initialization sequence to match ClockBuilder and the datasheet.
--- drivers/clk/clk-si5341.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/clk-si5341.c +3 -1
@@ -350,6 +350,8 @@ static const struct si5341_reg_default si5341_reg_defaults[] = { { 0x094A, 0x00 }, /* INx_TO_PFD_EN (disabled) */ { 0x0A02, 0x00 }, /* Not in datasheet */ { 0x0B44, 0x0F }, /* PDIV_ENB (datasheet does not mention what it is) */ + { 0x0B57, 0x10 }, /* VCO_RESET_CALCODE (not described in datasheet) */ + { 0x0B58, 0x05 }, /* VCO_RESET_CALCODE (not described in datasheet) */ };/* Read and interpret a 44-bit followed by a 32-bit value in the regmap */
@@ -1104,7 +1106,7 @@ static const struct si5341_reg_default si5341_preamble[] = { { 0x0B25, 0x00 }, { 0x0502, 0x01 }, { 0x0505, 0x03 }, - { 0x0957, 0x1F }, + { 0x0957, 0x17 }, { 0x0B4E, 0x1A }, };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 426/593 writeback: fix obtain a reference to a freeing memcg css
In reply to Greg Kroah-HartmanFrom: Muchun Song <[email protected]>
[ Upstream commit 8b0ed8443ae6458786580d36b7d5f8125535c5d4 ]
The caller of wb_get_create() should pin the memcg, because wb_get_create() relies on this guarantee. The rcu read lock only can guarantee that the memcg css returned by css_from_id() cannot be released, but the reference of the memcg can be zero.
rcu_read_lock()
memcg_css = css_from_id()
wb_get_create(memcg_css)
cgwb_create(memcg_css)
// css_get can change the ref counter from 0 back to 1
css_get(memcg_css) rcu_read_unlock()
Fix it by holding a reference to the css before calling wb_get_create(). This is not a problem I encountered in the real world. Just the result of a code review.
--- fs/fs-writeback.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/fs-writeback.c +7 -2
@@ -510,9 +510,14 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id)/* find and pin the new wb */ rcu_read_lock (); memcg_css =css_from_id (new_wb_id, &memory_cgrp_subsys); -if (memcg_css) - isw->new_wb =wb_get_create (bdi, memcg_css,GFP_ATOMIC ); +if (memcg_css && !css_tryget (memcg_css)) + memcg_css =NULL ;rcu_read_unlock (); +if (!memcg_css) + goto out_free; + + isw->new_wb =wb_get_create (bdi, memcg_css,GFP_ATOMIC ); +css_put (memcg_css);if (!isw->new_wb) goto out_free;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 427/593 net: lwtunnel: handle MTU calculation in forwading
In reply to Greg Kroah-HartmanFrom: Vadim Fedorenko <[email protected]>
[ Upstream commit fade56410c22cacafb1be9f911a0afd3701d8366 ]
Commit 14972cbd34ff ("net: lwtunnel: Handle fragmentation") moved fragmentation logic away from lwtunnel by carry encap headroom and use it in output MTU calculation. But the forwarding part was not covered and created difference in MTU for output and forwarding and further to silent drops on ipv4 forwarding path. Fix it by taking into account lwtunnel encap headroom.
The same commit also introduced difference in how to treat RTAX_MTU in IPv4 and IPv6 where latter explicitly removes lwtunnel encap headroom from route MTU. Make IPv4 version do the same.
--- include/net/ip.h | 12 ++++++++---- include/net/ip6_route.h | 16 ++++++++++++---- net/ipv4/route.c | 3 ++- 3 files changed, 22 insertions(+), 9 deletions(-)
include/net/ip.h +8 -4
@@ -31,6 +31,7 @@#include <net/flow.h> #include <net/flow_dissector.h> #include <net/netns/hash.h> +#include <net/lwtunnel.h> #define IPV4_MAX_PMTU 65535U/* RFC 2675, Section 5.1 */ #define IPV4_MIN_MTU 68/* RFC 791 */
@@ -445,22 +446,25 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,/* 'forwarding = true' case should always honour route mtu */ mtu =dst_metric_raw (dst,RTAX_MTU ); -if (mtu) -return mtu; +if (!mtu) + mtu =min (READ_ONCE (dst->dev->mtu),IP_MAX_MTU ); -return min (READ_ONCE (dst->dev->mtu),IP_MAX_MTU ); +return mtu -lwtunnel_headroom (dst->lwtstate, mtu); }static inline unsigned int ip_skb_dst_mtu (struct sock *sk,const struct sk_buff *skb) { +unsigned int mtu; +if (!sk || !sk_fullsock (sk) ||ip_sk_use_pmtu (sk)) {bool forwarding =IPCB (skb)->flags &IPSKB_FORWARDED ;return ip_dst_mtu_maybe_forward (skb_dst (skb), forwarding); } -return min (READ_ONCE (skb_dst (skb)->dev->mtu),IP_MAX_MTU ); + mtu =min (READ_ONCE (skb_dst (skb)->dev->mtu),IP_MAX_MTU ); +return mtu -lwtunnel_headroom (skb_dst (skb)->lwtstate, mtu); } struct dst_metrics *ip_fib_metrics_init(struct net *net, struct nlattr *fc_mx,
include/net/ip6_route.h +12 -4
@@ -264,11 +264,18 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,static inline int ip6_skb_dst_mtu (struct sk_buff *skb) { +int mtu; +struct ipv6_pinfo *np = skb->sk && !dev_recursion_level () ?inet6_sk (skb->sk) :NULL ; -return (np && np->pmtudisc >=IPV6_PMTUDISC_PROBE ) ? -skb_dst (skb)->dev->mtu :dst_mtu (skb_dst (skb)); +if (np && np->pmtudisc >=IPV6_PMTUDISC_PROBE ) { + mtu =READ_ONCE (skb_dst (skb)->dev->mtu); + mtu -=lwtunnel_headroom (skb_dst (skb)->lwtstate, mtu); + }else + mtu =dst_mtu (skb_dst (skb)); + +return mtu; }static inline bool ip6_sk_accept_pmtu (const struct sock *sk)
@@ -316,7 +323,7 @@ static inline unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst)if (dst_metric_locked (dst,RTAX_MTU )) { mtu =dst_metric_raw (dst,RTAX_MTU );if (mtu) -return mtu; + goto out; } mtu =IPV6_MIN_MTU ;
@@ -326,7 +333,8 @@ static inline unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst) mtu = idev->cnf.mtu6;rcu_read_unlock (); -return mtu; +out: +return mtu -lwtunnel_headroom (dst->lwtstate, mtu); } u32 ip6_mtu_from_fib6(const struct fib6_result *res,
net/ipv4/route.c +2 -1
@@ -1327,7 +1327,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst) mtu =dst_metric_raw (dst,RTAX_MTU );if (mtu) -return mtu; + goto out; mtu =READ_ONCE (dst->dev->mtu);
@@ -1336,6 +1336,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst) mtu =576 ; } +out: mtu = min_t(unsigned int, mtu, IP_MAX_MTU);return mtu -lwtunnel_headroom (dst->lwtstate, mtu);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 428/593 net: sched: fix warning in tcindex_alloc_perfect_hash
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 3f2db250099f46988088800052cdf2332c7aba61 ]
Syzbot reported warning in tcindex_alloc_perfect_hash. The problem was in too big cp->hash, which triggers warning in kmalloc. Since cp->hash comes from userspace, there is no need to warn if value is not correct
--- net/sched/cls_tcindex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/cls_tcindex.c +1 -1
@@ -304,7 +304,7 @@ static int tcindex_alloc_perfect_hash(struct net *net, struct tcindex_data *cp)int i, err =0 ; cp->perfect =kcalloc (cp->hash,sizeof (struct tcindex_filter_result ), -GFP_KERNEL ); +GFP_KERNEL | __GFP_NOWARN);if (!cp->perfect)return -ENOMEM ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 429/593 net: tipc: fix FB_MTU eat two pages
In reply to Greg Kroah-HartmanFrom: Menglong Dong <[email protected]>
[ Upstream commit 0c6de0c943dbb42831bf7502eb5c007f71e752d2 ]
FB_MTU is used in 'tipc_msg_build()' to alloc smaller skb when memory allocation fails, which can avoid unnecessary sending failures.
The value of FB_MTU now is 3744, and the data size will be:
(3744 + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
SKB_DATA_ALIGN(BUF_HEADROOM + BUF_TAILROOM + 3))which is larger than one page(4096), and two pages will be allocated.
To avoid it, replace '3744' with a calculation:
(PAGE_SIZE - SKB_DATA_ALIGN(BUF_OVERHEAD) - \
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))What's more, alloc_skb_fclone() will call SKB_DATA_ALIGN for data size, and it's not necessary to make alignment for buf_size in tipc_buf_acquire(). So, just remove it.
--- net/tipc/bcast.c | 2 +- net/tipc/msg.c | 17 ++++++++--------- net/tipc/msg.h | 3 ++- 3 files changed, 11 insertions(+), 11 deletions(-)
net/tipc/bcast.c +1 -1
@@ -699,7 +699,7 @@ int tipc_bcast_init(struct net *net)spin_lock_init (&tipc_net (net)->bclock); if (!tipc_link_bc_create(net, 0, 0, NULL, - FB_MTU, + one_page_mtu, BCLINK_WIN_DEFAULT, BCLINK_WIN_DEFAULT, 0,
net/tipc/msg.c +8 -9
@@ -44,12 +44,15 @@#define MAX_FORWARD_SIZE 1024#ifdef CONFIG_TIPC_CRYPTO #define BUF_HEADROOM ALIGN(((LL_MAX_HEADER + 48) + EHDR_MAX_SIZE), 16) -#define BUF_TAILROOM (TIPC_AES_GCM_TAG_SIZE) +#define BUF_OVERHEAD (BUF_HEADROOM + TIPC_AES_GCM_TAG_SIZE)#else #define BUF_HEADROOM (LL_MAX_HEADER + 48) -#define BUF_TAILROOM 16 +#define BUF_OVERHEAD BUF_HEADROOM#endif +const int one_page_mtu =PAGE_SIZE -SKB_DATA_ALIGN (BUF_OVERHEAD ) - +SKB_DATA_ALIGN (sizeof (struct skb_shared_info )); +static unsigned int align (unsigned int i) {return (i +3 ) & ~3u ;
@@ -67,13 +70,8 @@ static unsigned int align(unsigned int i)struct sk_buff *tipc_buf_acquire (u32 size,gfp_t gfp) {struct sk_buff *skb; -#ifdef CONFIG_TIPC_CRYPTO -unsigned int buf_size = (BUF_HEADROOM + size +BUF_TAILROOM +3 ) & ~3u ; -#else -unsigned int buf_size = (BUF_HEADROOM + size +3 ) & ~3u ; -#endif - skb =alloc_skb_fclone (buf_size, gfp); + skb =alloc_skb_fclone (BUF_OVERHEAD + size, gfp);if (skb) {skb_reserve (skb,BUF_HEADROOM );skb_put (skb, size);
@@ -395,7 +393,8 @@ int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, int offset,if (unlikely (!skb)) {if (pktmax !=MAX_MSG_SIZE )return -ENOMEM ; - rc =tipc_msg_build (mhdr, m, offset, dsz,FB_MTU , list); + rc =tipc_msg_build (mhdr, m, offset, dsz, + one_page_mtu, list);if (rc != dsz)return rc;if (tipc_msg_assemble (list))
net/tipc/msg.h +2 -1
@@ -99,9 +99,10 @@ struct plist;#define MAX_H_SIZE 60/* Largest possible TIPC header size */ #define MAX_MSG_SIZE (MAX_H_SIZE + TIPC_MAX_USER_MSG_SIZE) -#define FB_MTU 3744#define TIPC_MEDIA_INFO_OFFSET 5 +extern const int one_page_mtu; + struct tipc_skb_cb { union { struct {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 430/593 RDMA/mlx5: Dont access NULL-cleared mpi pointer
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 4a754d7637026b42b0c9ba5787ad5ee3bc2ff77f ]
The "dev->port[i].mp.mpi" is set to NULL during mlx5_ib_unbind_slave_port() execution, however that field is needed to add device to unaffiliated list.
Such flow causes to the following kernel panic while unloading mlx5_ib module in multi-port mode, hence the device should be added to the list prior to unbind call.
RPC: Unregistered rdma transport module.
RPC: Unregistered rdma backchannel transport module.
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 0 P4D 0 Oops: 0002 [#1] SMP NOPTI CPU: 4 PID: 1904 Comm: modprobe Not tainted 5.13.0-rc7_for_upstream_min_debug_2021_06_24_12_08 #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:mlx5_ib_cleanup_multiport_master+0x18b/0x2d0 [mlx5_ib] Code: 00 04 0f 85 c4 00 00 00 48 89 df e8 ef fa ff ff 48 8b 83 40 0d 00 00 48 8b 15 b9 e8 05 00 4a 8b 44 28 20 48 89 05 ad e8 05 00 <48> c7 00 d0 57 c5 a0 48 89 50 08 48 89 02 39 ab 88 0a 00 00 0f 86 RSP: 0018:ffff888116ee3df8 EFLAGS: 00010296 RAX: 0000000000000000 RBX: ffff8881154f6000 RCX: 0000000000000080 RDX: ffffffffa0c557d0 RSI: ffff88810b69d200 RDI: 000000000002d8a0 RBP: 0000000000000002 R08: ffff888110780408 R09: 0000000000000000 R10: ffff88812452e1c0 R11: fffffffffff7e028 R12: 0000000000000000 R13: 0000000000000080 R14: ffff888102c58000 R15: 0000000000000000 FS: 00007f884393a740(0000) GS:ffff8882f5a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 00000001249f6004 CR4: 0000000000370ea0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: mlx5_ib_stage_init_cleanup+0x16/0xd0 [mlx5_ib] __mlx5_ib_remove+0x33/0x90 [mlx5_ib] mlx5r_remove+0x22/0x30 [mlx5_ib] auxiliary_bus_remove+0x18/0x30 __device_release_driver+0x177/0x220 driver_detach+0xc4/0x100 bus_remove_driver+0x58/0xd0 auxiliary_driver_unregister+0x12/0x20 mlx5_ib_cleanup+0x13/0x897 [mlx5_ib] __x64_sys_delete_module+0x154/0x230 ? exit_to_user_mode_prepare+0x104/0x140 do_syscall_64+0x3f/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f8842e095c7 Code: 73 01 c3 48 8b 0d d9 48 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a9 48 2c 00 f7 d8 64 89 01 48 RSP: 002b:00007ffc68f6e758 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0 RAX: ffffffffffffffda RBX: 00005638207929c0 RCX: 00007f8842e095c7 RDX: 0000000000000000 RSI: 0000000000000800 RDI: 0000563820792a28 RBP: 00005638207929c0 R08: 00007ffc68f6d701 R09: 0000000000000000 R10: 00007f8842e82880 R11: 0000000000000206 R12: 0000563820792a28 R13: 0000000000000001 R14: 0000563820792a28 R15: 00007ffc68f6fb40 Modules linked in: xt_MASQUERADE nf_conntrack_netlink nfnetlink iptable_nat xt_addrtype xt_conntrack nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 br_netfilter overlay rdma_ucm ib_iser libiscsi scsi_transport_iscsi rdma_cm iw_cm ib_ipoib ib_cm ib_umad mlx5_ib(-) mlx4_ib ib_uverbs ib_core mlx4_en mlx4_core mlx5_core ptp pps_core [last unloaded: rpcrdma] CR2: 0000000000000000 ---[ end trace a0bb7e20804e9e9b ]---
--- drivers/infiniband/hw/mlx5/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/main.c +1 -1
@@ -3592,9 +3592,9 @@ static void mlx5_ib_cleanup_multiport_master(struct mlx5_ib_dev *dev) dev->port[i].mp.mpi =NULL ; }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); +mlx5_ib_unbind_slave_port (dev, dev->port[i].mp.mpi); } } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 431/593 RDMA/core: Always release restrack object
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 3d8287544223a3d2f37981c1f9ffd94d0b5e9ffc ]
Change location of rdma_restrack_del() to fix the bug where task_struct was acquired but not released, causing to resource leak.
ucma_create_id() {
ucma_alloc_ctx();
rdma_create_user_id() {
rdma_restrack_new();
rdma_restrack_set_name() {
rdma_restrack_attach_task.part.0(); <--- task_struct was gotten
}
}
ucma_destroy_private_ctx() {
ucma_put_ctx();
rdma_destroy_id() {
_destroy_id() <--- id_priv was freed
}
}
}--- drivers/infiniband/core/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cma.c +1 -1
@@ -1856,6 +1856,7 @@ static void _destroy_id(struct rdma_id_private *id_priv, {cma_cancel_operation (id_priv, state); +rdma_restrack_del (&id_priv->res);if (id_priv->cma_dev) {if (rdma_cap_ib_cm (id_priv->id.device,1 )) {if (id_priv->cm_id.ib)
@@ -1865,7 +1866,6 @@ static void _destroy_id(struct rdma_id_private *id_priv,iw_destroy_cm_id (id_priv->cm_id.iw); }cma_leave_mc_groups (id_priv); -rdma_restrack_del (&id_priv->res);cma_release_dev (id_priv); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 432/593 MIPS: Fix PKMAP with 32-bit MIPS huge page support
In reply to Greg Kroah-HartmanFrom: Wei Li <[email protected]>
[ Upstream commit cf02ce742f09188272bcc8b0e62d789eb671fc4c ]
When 32-bit MIPS huge page support is enabled, we halve the number of pointers a PTE page holds, making its last half go to waste. Correspondingly, we should halve the number of kmap entries, as we just initialized only a single pte table for that in pagetable_init().
--- arch/mips/include/asm/highmem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/highmem.h +1 -1
@@ -36,7 +36,7 @@ extern pte_t *pkmap_page_table;* easily, subsequent pte tables have to be allocated in one physical * chunk of RAM. */ -#ifdef CONFIG_PHYS_ADDR_T_64BIT +#if defined(CONFIG_PHYS_ADDR_T_64BIT ) || defined(CONFIG_MIPS_HUGE_TLB_SUPPORT )#define LAST_PKMAP 512#else #define LAST_PKMAP 1024
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 433/593 staging: fbtft: Rectify GPIO handling
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit ec03c2104365ead0a33627c05e685093eed3eaef ]
The infamous commit c440eee1a7a1 ("Staging: staging: fbtft: Switch to the GPIO descriptor interface") broke GPIO handling completely. It has already four commits to rectify and it seems not enough. In order to fix the mess here we:
1) Set default to "inactive" for all requested pins
2) Fix CS#, RD#, and WR# pins polarity since it's active low and GPIO descriptor interface takes it into consideration from the Device Tree or ACPI
3) Consolidate chip activation (CS# assertion) under default
->reset() callback
To summarize the expectations about polarity for GPIOs:
RD# Low
WR# Low
CS# Low
RESET# Low
DC or RS High
RW High
Data 0 .. 15 High
See also Adafruit learning course [1] for the example of the schematics.
While at it, drop unneeded NULL checks, since GPIO API is tolerant to that.
[1]: https://learn.adafruit.com/adafruit-2-8-and-3-2-color-tft-touchscreen-breakout-v2/downloads
--- drivers/staging/fbtft/fb_agm1264k-fl.c | 20 ++++++++++---------- drivers/staging/fbtft/fb_bd663474.c | 4 ---- drivers/staging/fbtft/fb_ili9163.c | 4 ---- drivers/staging/fbtft/fb_ili9320.c | 1 - drivers/staging/fbtft/fb_ili9325.c | 4 ---- drivers/staging/fbtft/fb_ili9340.c | 1 - drivers/staging/fbtft/fb_s6d1121.c | 4 ---- drivers/staging/fbtft/fb_sh1106.c | 1 - drivers/staging/fbtft/fb_ssd1289.c | 4 ---- drivers/staging/fbtft/fb_ssd1325.c | 2 -- drivers/staging/fbtft/fb_ssd1331.c | 6 ++---- drivers/staging/fbtft/fb_ssd1351.c | 1 - drivers/staging/fbtft/fb_upd161704.c | 4 ---- drivers/staging/fbtft/fb_watterott.c | 1 - drivers/staging/fbtft/fbtft-bus.c | 3 +-- drivers/staging/fbtft/fbtft-core.c | 13 ++++++------- drivers/staging/fbtft/fbtft-io.c | 12 ++++++------ 17 files changed, 25 insertions(+), 60 deletions(-)
drivers/staging/fbtft/fb_agm1264k-fl.c +10 -10
@@ -84,9 +84,9 @@ static void reset(struct fbtft_par *par)dev_dbg (par->info->device,"%s()\n" , __func__); -gpiod_set_value (par->gpio.reset,0 ); -udelay (20 );gpiod_set_value (par->gpio.reset,1 ); +udelay (20 ); +gpiod_set_value (par->gpio.reset,0 );mdelay (120 ); }
@@ -194,12 +194,12 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)/* select chip */ if (*buf) {/* cs1 */ -gpiod_set_value (par->CS0,1 ); -gpiod_set_value (par->CS1,0 ); - }else { -/* cs0 */ gpiod_set_value (par->CS0,0 );gpiod_set_value (par->CS1,1 ); + }else { +/* cs0 */ +gpiod_set_value (par->CS0,1 ); +gpiod_set_value (par->CS1,0 ); }gpiod_set_value (par->RS,0 );/* RS->0 (command mode) */
@@ -397,8 +397,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) }kfree (convert_buf); -gpiod_set_value (par->CS0,1 ); -gpiod_set_value (par->CS1,1 ); +gpiod_set_value (par->CS0,0 ); +gpiod_set_value (par->CS1,0 );return ret; }
@@ -419,10 +419,10 @@ static int write(struct fbtft_par *par, void *buf, size_t len)for (i =0 ; i <8 ; ++i)gpiod_set_value (par->gpio.db[i], data & (1 << i));/* set E */ -gpiod_set_value (par->EPIN,1 ); +gpiod_set_value (par->EPIN,0 );udelay (5 );/* unset E - write */ -gpiod_set_value (par->EPIN,0 ); +gpiod_set_value (par->EPIN,1 );udelay (1 ); }
drivers/staging/fbtft/fb_bd663474.c +0 -4
@@ -12,7 +12,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
@@ -24,9 +23,6 @@static int init_display (struct fbtft_par *par) { -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ - par->fbtftops.reset (par);/* Initialization sequence from Lib_UTFT */
drivers/staging/fbtft/fb_ili9163.c +0 -4
@@ -11,7 +11,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include <video/mipi_display.h>
@@ -77,9 +76,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ -write_reg (par,MIPI_DCS_SOFT_RESET );/* software reset */ mdelay (500 );write_reg (par,MIPI_DCS_EXIT_SLEEP_MODE );/* exit sleep */
drivers/staging/fbtft/fb_ili9320.c +0 -1
@@ -8,7 +8,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/spi/spi.h> #include <linux/delay.h>
drivers/staging/fbtft/fb_ili9325.c +0 -4
@@ -10,7 +10,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
@@ -85,9 +84,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ - bt &=0x07 ; vc &=0x07 ; vrh &=0x0f ;
drivers/staging/fbtft/fb_ili9340.c +0 -1
@@ -8,7 +8,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include <video/mipi_display.h>
drivers/staging/fbtft/fb_s6d1121.c +0 -4
@@ -12,7 +12,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
@@ -29,9 +28,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ -/* Initialization sequence from Lib_UTFT */ write_reg (par,0x0011 ,0x2004 );
drivers/staging/fbtft/fb_sh1106.c +0 -1
@@ -9,7 +9,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
drivers/staging/fbtft/fb_ssd1289.c +0 -4
@@ -10,7 +10,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include "fbtft.h"
@@ -28,9 +27,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ -write_reg (par,0x00 ,0x0001 );write_reg (par,0x03 ,0xA8A4 );write_reg (par,0x0C ,0x0000 );
drivers/staging/fbtft/fb_ssd1325.c +0 -2
@@ -35,8 +35,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -gpiod_set_value (par->gpio.cs,0 ); -write_reg (par,0xb3 );write_reg (par,0xf0 );write_reg (par,0xae );
drivers/staging/fbtft/fb_ssd1331.c +2 -4
@@ -81,8 +81,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)va_start (args, len); *buf = (u8)va_arg(args, unsigned int); -if (par->gpio.dc) -gpiod_set_value (par->gpio.dc,0 ); +gpiod_set_value (par->gpio.dc,0 ); ret = par->fbtftops.write (par, par->buf,sizeof (u8));if (ret <0 ) {va_end (args);
@@ -104,8 +103,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)return ; } } -if (par->gpio.dc) -gpiod_set_value (par->gpio.dc,1 ); +gpiod_set_value (par->gpio.dc,1 );va_end (args); }
drivers/staging/fbtft/fb_ssd1351.c +0 -1
@@ -2,7 +2,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/spi/spi.h> #include <linux/delay.h>
drivers/staging/fbtft/fb_upd161704.c +0 -4
@@ -12,7 +12,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
@@ -26,9 +25,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ -/* Initialization sequence from Lib_UTFT */ /* register reset */
drivers/staging/fbtft/fb_watterott.c +0 -1
@@ -8,7 +8,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
drivers/staging/fbtft/fbtft-bus.c +1 -2
@@ -135,8 +135,7 @@ int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len) remain = len /2 ; vmem16 = (u16 *)(par->info->screen_buffer + offset); -if (par->gpio.dc) -gpiod_set_value (par->gpio.dc,1 ); +gpiod_set_value (par->gpio.dc,1 );/* non buffered write */ if (!par->txbuf.buf)
drivers/staging/fbtft/fbtft-core.c +6 -7
@@ -38,8 +38,7 @@ int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc) {int ret; -if (par->gpio.dc) -gpiod_set_value (par->gpio.dc, dc); +gpiod_set_value (par->gpio.dc, dc); ret = par->fbtftops.write (par, buf, len);if (ret <0 )
@@ -79,7 +78,7 @@ static int fbtft_request_one_gpio(struct fbtft_par *par,int ret =0 ; *gpiop =devm_gpiod_get_index_optional (dev, name, index, -GPIOD_OUT_HIGH ); +GPIOD_OUT_LOW );if (IS_ERR (*gpiop)) { ret =PTR_ERR (*gpiop); dev_err(dev,
@@ -226,11 +225,15 @@ static void fbtft_reset(struct fbtft_par *par) {if (!par->gpio.reset)return ; +fbtft_par_dbg (DEBUG_RESET , par,"%s()\n" , __func__); +gpiod_set_value_cansleep (par->gpio.reset,1 );usleep_range (20 ,40 );gpiod_set_value_cansleep (par->gpio.reset,0 );msleep (120 ); + +gpiod_set_value_cansleep (par->gpio.cs,1 );/* Activate chip */ } static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,
@@ -922,8 +925,6 @@ static int fbtft_init_display_from_property(struct fbtft_par *par) goto out_free; par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ index =-1 ; val = values[++index];
@@ -1018,8 +1019,6 @@ int fbtft_init_display(struct fbtft_par *par) } par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ i =0 ;while (i <FBTFT_MAX_INIT_SEQUENCE ) {
drivers/staging/fbtft/fbtft-io.c +6 -6
@@ -142,12 +142,12 @@ int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len) data = *(u8 *)buf;/* Start writing by pulling down /WR */ -gpiod_set_value (par->gpio.wr,0 ); +gpiod_set_value (par->gpio.wr,1 );/* Set data */ #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO if (data == prev_data) { -gpiod_set_value (par->gpio.wr,0 );/* used as delay */ +gpiod_set_value (par->gpio.wr,1 );/* used as delay */ }else {for (i =0 ; i <8 ; i++) {if ((data &1 ) != (prev_data &1 ))
@@ -165,7 +165,7 @@ int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len)#endif /* Pullup /WR */ -gpiod_set_value (par->gpio.wr,1 ); +gpiod_set_value (par->gpio.wr,0 );#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO prev_data = *(u8 *)buf;
@@ -192,12 +192,12 @@ int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len) data = *(u16 *)buf;/* Start writing by pulling down /WR */ -gpiod_set_value (par->gpio.wr,0 ); +gpiod_set_value (par->gpio.wr,1 );/* Set data */ #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO if (data == prev_data) { -gpiod_set_value (par->gpio.wr,0 );/* used as delay */ +gpiod_set_value (par->gpio.wr,1 );/* used as delay */ }else {for (i =0 ; i <16 ; i++) {if ((data &1 ) != (prev_data &1 ))
@@ -215,7 +215,7 @@ int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len)#endif /* Pullup /WR */ -gpiod_set_value (par->gpio.wr,1 ); +gpiod_set_value (par->gpio.wr,0 );#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO prev_data = *(u16 *)buf;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 434/593 staging: fbtft: Dont spam logs when probe is deferred
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 37667f6e57712cef5652fa67f1cbd1299e204d94 ]
When requesting GPIO line the probe can be deferred. In such case don't spam logs with an error message. This can be achieved by switching to dev_err_probe().
--- drivers/staging/fbtft/fbtft-core.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/staging/fbtft/fbtft-core.c +4 -8
@@ -75,20 +75,16 @@ static int fbtft_request_one_gpio(struct fbtft_par *par, struct gpio_desc **gpiop) {struct device *dev = par->info->device; -int ret =0 ; *gpiop =devm_gpiod_get_index_optional (dev, name, index,GPIOD_OUT_LOW ); -if (IS_ERR (*gpiop)) { - ret =PTR_ERR (*gpiop); -dev_err (dev, -"Failed to request %s GPIO: %d\n" , name, ret); -return ret; - } +if (IS_ERR (*gpiop)) +return dev_err_probe (dev,PTR_ERR (*gpiop),"Failed to request %s GPIO\n" , name); +fbtft_par_dbg (DEBUG_REQUEST_GPIOS , par,"%s: '%s' GPIO\n" , __func__, name); -return ret; +return 0 ; }static int fbtft_request_gpios (struct fbtft_par *par)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 435/593 ASoC: rt5682: Disable irq on shutdown
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
[ Upstream commit 47bcb1c7108363418cd578283333d72e310dfeaa ]
We cancel the work queues, and reset the device on shutdown, but the irq isn't disabled so the work queues could be queued again. Let's disable the irq during shutdown so that we don't have to worry about this device trying to do anything anymore. This fixes a problem seen where the i2c bus is shutdown at reboot but this device irq still comes in and tries to make another i2c transaction when the bus doesn't work.
--- sound/soc/codecs/rt5682-i2c.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/rt5682-i2c.c +1 -0
@@ -268,6 +268,7 @@ static void rt5682_i2c_shutdown(struct i2c_client *client) {struct rt5682_priv *rt5682 =i2c_get_clientdata (client); +disable_irq (client->irq);cancel_delayed_work_sync (&rt5682->jack_detect_work);cancel_delayed_work_sync (&rt5682->jd_check_work);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 436/593 rcu: Invoke rcu_spawn_core_kthreads() from rcu_spawn_gp_kthread()
In reply to Greg Kroah-HartmanFrom: Paul E. McKenney <[email protected]>
[ Upstream commit 8e4b1d2bc198e34b48fc7cc3a3c5a2fcb269e271 ]
Currently, rcu_spawn_core_kthreads() is invoked via an early_initcall(), which works, except that rcu_spawn_gp_kthread() is also invoked via an early_initcall() and rcu_spawn_core_kthreads() relies on adjustments to kthread_prio that are carried out by rcu_spawn_gp_kthread(). There is no guaranttee of ordering among early_initcall() handlers, and thus no guarantee that kthread_prio will be properly checked and range-limited at the time that rcu_spawn_core_kthreads() needs it.
In most cases, this bug is harmless. After all, the only reason that rcu_spawn_gp_kthread() adjusts the value of kthread_prio is if the user specified a nonsensical value for this boot parameter, which experience indicates is rare.
Nevertheless, a bug is a bug. This commit therefore causes the rcu_spawn_core_kthreads() function to be invoked directly from rcu_spawn_gp_kthread() after any needed adjustments to kthread_prio have been carried out.
--- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree.c +1 -1
@@ -2837,7 +2837,6 @@ static int __init rcu_spawn_core_kthreads(void) "%s: Could not start rcuc kthread, OOM is now expected behavior\n", __func__);return 0 ; } -early_initcall (rcu_spawn_core_kthreads);/* * Handle any core-RCU processing required by a call_rcu() invocation.
@@ -4273,6 +4272,7 @@ static int __init rcu_spawn_gp_kthread(void)wake_up_process (t);rcu_spawn_nocb_kthreads ();rcu_spawn_boost_kthreads (); +rcu_spawn_core_kthreads ();return 0 ; }early_initcall (rcu_spawn_gp_kthread);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 437/593 serial: fsl_lpuart: dont modify arbitrary data on lpuart32
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit ccf08fd1204bcb5311cc10aea037c71c6e74720a ]
lpuart_rx_dma_startup() is used for both the 8 bit and the 32 bit version of the LPUART. Modify the UARTCR only for the 8 bit version.
--- drivers/tty/serial/fsl_lpuart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/fsl_lpuart.c +1 -1
@@ -1625,7 +1625,7 @@ static void lpuart_rx_dma_startup(struct lpuart_port *sport) sport->lpuart_dma_rx_use = true;rx_dma_timer_init (sport); -if (sport->port.has_sysrq) { +if (sport->port.has_sysrq && !lpuart_is_32 (sport)) { cr3 =readb (sport->port.membase +UARTCR3 ); cr3 |=UARTCR3_FEIE ;writeb (cr3, sport->port.membase +UARTCR3 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 438/593 serial: fsl_lpuart: remove RTSCTS handling from get_mctrl()
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit e60c2991f18bf221fa9908ff10cb24eaedaa9bae ]
The wrong code in set_mctrl() was already removed in commit 2b30efe2e88a ("tty: serial: lpuart: Remove unnecessary code from set_mctrl"), but the code in get_mctrl() wasn't removed. It will not return the state of the RTS or CTS line but whether automatic flow control is enabled, which is wrong for the get_mctrl(). Thus remove it.
--- drivers/tty/serial/fsl_lpuart.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/tty/serial/fsl_lpuart.c +1 -11
@@ -1408,17 +1408,7 @@ static unsigned int lpuart_get_mctrl(struct uart_port *port)static unsigned int lpuart32_get_mctrl (struct uart_port *port) { -unsigned int temp =0 ; -unsigned long reg; - - reg =lpuart32_read (port,UARTMODIR ); -if (reg &UARTMODIR_TXCTSE ) - temp |=TIOCM_CTS ; - -if (reg &UARTMODIR_RXRTSE ) - temp |=TIOCM_RTS ; - -return temp; +return 0 ; }static void lpuart_set_mctrl (struct uart_port *port,unsigned int mctrl)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 439/593 serial: 8250_omap: fix a timeout loop condition
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit d7e325aaa8c3593b5a572b583ecad79e95f32e7f ]
This loop ends on -1 so the error message will never be printed.
--- drivers/tty/serial/8250/8250_omap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_omap.c +1 -1
@@ -784,7 +784,7 @@ static void __dma_rx_do_complete(struct uart_8250_port *p) poll_count--)cpu_relax (); -if (!poll_count) +if (poll_count ==-1 )dev_err (p->port.dev,"teardown incomplete\n" ); } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 440/593 tty: nozomi: Fix a resource leak in an error handling function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 31a9a318255960d32ae183e95d0999daf2418608 ]
A 'request_irq()' call is not balanced by a corresponding 'free_irq()' in the error handling path, as already done in the remove function.
Add it.
--- drivers/tty/nozomi.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/nozomi.c +1 -0
@@ -1436,6 +1436,7 @@ err_free_tty:tty_unregister_device (ntty_driver, dc->index_start + i);tty_port_destroy (&dc->port[i].port); } +free_irq (pdev->irq, dc); err_free_kfifo:for (i =0 ; i <MAX_PORT ; i++)kfifo_free (&dc->port[i].fifo_ul);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 441/593 mwifiex: re-fix for unaligned accesses
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 8f4e3d48bb50765ab27ae5bebed2595b20de80a1 ]
A patch from 2017 changed some accesses to DMA memory to use get_unaligned_le32() and similar interfaces, to avoid problems with doing unaligned accesson uncached memory.
However, the change in the mwifiex_pcie_alloc_sleep_cookie_buf() function ended up changing the size of the access instead, as it operates on a pointer to u8.
Change this function back to actually access the entire 32 bits. Note that the pointer is aligned by definition because it came from dma_alloc_coherent().
--- drivers/net/wireless/marvell/mwifiex/pcie.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/wireless/marvell/mwifiex/pcie.c +4 -6
@@ -1232,7 +1232,7 @@ static int mwifiex_pcie_delete_cmdrsp_buf(struct mwifiex_adapter *adapter)static int mwifiex_pcie_alloc_sleep_cookie_buf (struct mwifiex_adapter *adapter) {struct pcie_service_card *card = adapter->card; -u32 tmp; +u32 *cookie; card->sleep_cookie_vbase = dma_alloc_coherent(&card->dev->dev, sizeof(u32),
@@ -1243,13 +1243,11 @@ static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) "dma_alloc_coherent failed!\n");return -ENOMEM ; } + cookie = (u32 *)card->sleep_cookie_vbase;/* Init val of Sleep Cookie */ - tmp =FW_AWAKE_COOKIE ; -put_unaligned (tmp, card->sleep_cookie_vbase); + *cookie =FW_AWAKE_COOKIE ; -mwifiex_dbg (adapter,INFO , -"alloc_scook: sleep cookie=0x%x\n" , -get_unaligned (card->sleep_cookie_vbase)); +mwifiex_dbg (adapter,INFO ,"alloc_scook: sleep cookie=0x%x\n" , *cookie);return 0 ; }
Signature · 1 line
2.30.2