4.19.47-stable review
Subsystems (13)
Greg Kroah-Hartman
maintainerPATCH 57/276 pinctrl: zte: fix leaked of_node references
In reply to Greg Kroah-Hartman[ Upstream commit 02d15f0d80720545f1f4922a1550ea4aaad4e152 ]
The call to of_parse_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/zte/pinctrl-zx.c:415:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. ./drivers/pinctrl/zte/pinctrl-zx.c:422:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. ./drivers/pinctrl/zte/pinctrl-zx.c:436:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. ./drivers/pinctrl/zte/pinctrl-zx.c:444:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. ./drivers/pinctrl/zte/pinctrl-zx.c:448:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
--- drivers/pinctrl/zte/pinctrl-zx.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/zte/pinctrl-zx.c +1 -0
@@ -411,6 +411,7 @@ int zx_pinctrl_init(struct platform_device *pdev, } zpctl->aux_base =of_iomap (np,0 ); +of_node_put (np);if (!zpctl->aux_base)return -ENOMEM ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 79/276 x86/modules: Avoid breaking W^X while loading modules
In reply to Greg Kroah-Hartman[ Upstream commit f2c65fb3221adc6b73b0549fc7ba892022db9797 ]
When modules and BPF filters are loaded, there is a time window in which some memory is both writable and executable. An attacker that has already found another vulnerability (e.g., a dangling pointer) might be able to exploit this behavior to overwrite kernel code. Prevent having writable executable PTEs in this stage.
In addition, avoiding having W+X mappings can also slightly simplify the patching of modules code on initialization (e.g., by alternatives and static-key), as would be done in the next patch. This was actually the main motivation for this patch.
To avoid having W+X mappings, set them initially as RW (NX) and after they are set as RO set them as X as well. Setting them as executable is done as a separate step to avoid one core in which the old PTE is cached (hence writable), and another which sees the updated PTE (executable), which would break the W^X protection.
--- arch/x86/kernel/alternative.c | 28 +++++++++++++++++++++------- arch/x86/kernel/module.c | 2 +- include/linux/filter.h | 1 + kernel/module.c | 5 +++++ 4 files changed, 28 insertions(+), 8 deletions(-)
arch/x86/kernel/alternative.c +21 -7
@@ -662,15 +662,29 @@ void __init alternative_instructions(void)* handlers seeing an inconsistent instruction while you patch. */ void *__init_or_module text_poke_early(void *addr, const void *opcode, -size_t len) +size_t len) {unsigned long flags; -local_irq_save (flags); -memcpy (addr, opcode, len); -local_irq_restore (flags); -sync_core (); -/* Could also do a CLFLUSH here to speed up CPU recovery; but -that causes hangs on some VIA CPUs. */ + +if (boot_cpu_has (X86_FEATURE_NX ) && +is_module_text_address ((unsigned long )addr)) { +/* +* Modules text is marked initially as non-executable, so the +* code cannot be running and speculative code-fetches are +* prevented. Just change the code. +*/ +memcpy (addr, opcode, len); + }else { +local_irq_save (flags); +memcpy (addr, opcode, len); +local_irq_restore (flags); +sync_core (); + +/* +* Could also do a CLFLUSH here to speed up CPU recovery; but +* that causes hangs on some VIA CPUs. +*/ + }return addr; }
arch/x86/kernel/module.c +1 -1
@@ -87,7 +87,7 @@ void *module_alloc(unsigned long size) p =__vmalloc_node_range (size,MODULE_ALIGN ,MODULES_VADDR +get_module_load_offset (),MODULES_END ,GFP_KERNEL , -PAGE_KERNEL_EXEC ,0 ,NUMA_NO_NODE , +PAGE_KERNEL ,0 ,NUMA_NO_NODE ,__builtin_return_address (0 ));if (p && (kasan_module_alloc (p, size) <0 )) {vfree (p);
include/linux/filter.h +1 -0
@@ -684,6 +684,7 @@ static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)static inline void bpf_jit_binary_lock_ro (struct bpf_binary_header *hdr) {set_memory_ro ((unsigned long )hdr, hdr->pages); +set_memory_x ((unsigned long )hdr, hdr->pages); }static inline void bpf_jit_binary_unlock_ro (struct bpf_binary_header *hdr)
kernel/module.c +5 -0
@@ -1949,8 +1949,13 @@ void module_enable_ro(const struct module *mod, bool after_init)return ;frob_text (&mod->core_layout, set_memory_ro); +frob_text (&mod->core_layout, set_memory_x); +frob_rodata (&mod->core_layout, set_memory_ro); +frob_text (&mod->init_layout, set_memory_ro); +frob_text (&mod->init_layout, set_memory_x); +frob_rodata (&mod->init_layout, set_memory_ro);if (after_init)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 116/276 pinctrl: pistachio: fix leaked of_node references
In reply to Greg Kroah-Hartman[ Upstream commit 44a4455ac2c6b0981eace683a2b6eccf47689022 ]
The call to of_get_child_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/pinctrl-pistachio.c:1422:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1360, but without a corresponding object release within this function.
--- drivers/pinctrl/pinctrl-pistachio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/pinctrl-pistachio.c +2 -0
@@ -1368,6 +1368,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)if (!of_find_property (child,"gpio-controller" ,NULL )) {dev_err (pctl->dev,"No gpio-controller property for bank %u\n" , i); +of_node_put (child); ret = -ENODEV ; goto err; }
@@ -1375,6 +1376,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) irq =irq_of_parse_and_map (child,0 );if (irq <0 ) {dev_err (pctl->dev,"No IRQ for bank %u: %d\n" , i, irq); +of_node_put (child); ret = irq; goto err; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 117/276 pinctrl: samsung: fix leaked of_node references
In reply to Greg Kroah-Hartman[ Upstream commit 44b9f86cd41db6c522effa5aec251d664a52fbc0 ]
The call to of_find_compatible_node returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/samsung/pinctrl-exynos-arm.c:76:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function. ./drivers/pinctrl/samsung/pinctrl-exynos-arm.c:82:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
--- drivers/pinctrl/samsung/pinctrl-exynos-arm.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/samsung/pinctrl-exynos-arm.c +1 -0
@@ -71,6 +71,7 @@ s5pv210_retention_init(struct samsung_pinctrl_drv_data *drvdata, } clk_base =of_iomap (np,0 ); +of_node_put (np);if (!clk_base) {pr_err ("%s: failed to map clock registers\n" , __func__);return ERR_PTR (-EINVAL );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 140/276 drm/msm: a5xx: fix possible object reference leak
In reply to Greg Kroah-Hartman[ Upstream commit 6cd5235c3135ea84b32469ea51b2aae384eda8af ]
The call to of_get_child_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
drivers/gpu/drm/msm/adreno/a5xx_gpu.c:57:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 47, but without a corresponding object release within this function. drivers/gpu/drm/msm/adreno/a5xx_gpu.c:66:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 47, but without a corresponding object release within this function. drivers/gpu/drm/msm/adreno/a5xx_gpu.c:118:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 47, but without a corresponding object release within this function. drivers/gpu/drm/msm/adreno/a5xx_gpu.c:57:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 51, but without a corresponding object release within this function. drivers/gpu/drm/msm/adreno/a5xx_gpu.c:66:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 51, but without a corresponding object release within this function. drivers/gpu/drm/msm/adreno/a5xx_gpu.c:118:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 51, but without a corresponding object release within this function.
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +6 -4
@@ -35,7 +35,7 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname) {struct device *dev = &gpu->pdev->dev;const struct firmware *fw; -struct device_node *np; +struct device_node *np, *mem_np;struct resource r;phys_addr_t mem_phys;ssize_t mem_size;
@@ -49,11 +49,13 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname)if (!np)return -ENODEV ; - np =of_parse_phandle (np,"memory-region" ,0 ); -if (!np) + mem_np =of_parse_phandle (np,"memory-region" ,0 ); +of_node_put (np); +if (!mem_np)return -EINVAL ; - ret =of_address_to_resource (np,0 , &r); + ret =of_address_to_resource (mem_np,0 , &r); +of_node_put (mem_np);if (ret)return ret;
Signature · 8 lines
2.20.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Greg Kroah-Hartman
maintainerPATCH 12/276 kvm: svm/avic: fix off-by-one in checking host APIC ID
In reply to Greg Kroah-HartmanFrom: Suthikulpanit, Suravee <[email protected]>
commit c9bcd3e3335d0a29d89fabd2c385e1b989e6f1b0 upstream.
Current logic does not allow VCPU to be loaded onto CPU with APIC ID 255. This should be allowed since the host physical APIC ID field in the AVIC Physical APIC table entry is an 8-bit value, and APIC ID 255 is valid in system with x2APIC enabled. Instead, do not allow VCPU load if the host APIC ID cannot be represented by an 8-bit value.
Also, use the more appropriate AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK instead of AVIC_MAX_PHYSICAL_ID_COUNT.
--- arch/x86/kvm/svm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/kvm/svm.c +5 -1
@@ -2022,7 +2022,11 @@ static void avic_vcpu_load(struct kvm_vcif (!kvm_vcpu_apicv_active (vcpu))return ; -if (WARN_ON (h_physical_id >=AVIC_MAX_PHYSICAL_ID_COUNT )) +/* +* Since the host physical APIC id is 8 bits, +* we can support host APIC ID upto 255. +*/ +if (WARN_ON (h_physical_id >AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK ))return ; entry =READ_ONCE (*(svm->avic_physical_id_cache));
Greg Kroah-Hartman
maintainerPATCH 13/276 libnvdimm/pmem: Bypass CONFIG_HARDENED_USERCOPY overhead
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
commit 52f476a323f9efc959be1c890d0cdcf12e1582e0 upstream.
Jeff discovered that performance improves from ~375K iops to ~519K iops on a simple psync-write fio workload when moving the location of 'struct page' from the default PMEM location to DRAM. This result is surprising because the expectation is that 'struct page' for dax is only needed for third party references to dax mappings. For example, a dax-mapped buffer passed to another system call for direct-I/O requires 'struct page' for sending the request down the driver stack and pinning the page. There is no usage of 'struct page' for first party access to a file via read(2)/write(2) and friends.
However, this "no page needed" expectation is violated by CONFIG_HARDENED_USERCOPY and the check_copy_size() performed in copy_from_iter_full_nocache() and copy_to_iter_mcsafe(). The check_heap_object() helper routine assumes the buffer is backed by a slab allocator (DRAM) page and applies some checks. Those checks are invalid, dax pages do not originate from the slab, and redundant, dax_iomap_actor() has already validated that the I/O is within bounds. Specifically that routine validates that the logical file offset is within bounds of the file, then it does a sector-to-pfn translation which validates that the physical mapping is within bounds of the block device.
Bypass additional hardened usercopy overhead and call the 'no check' versions of the copy_{to,from}_iter operations directly.
--- drivers/nvdimm/pmem.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/nvdimm/pmem.c +8 -2
@@ -281,16 +281,22 @@ static long pmem_dax_direct_access(strucreturn __pmem_direct_access (pmem, pgoff, nr_pages, kaddr, pfn); } +/* +* Use the 'no check' versions of copy_from_iter_flushcache() and +* copy_to_iter_mcsafe() to bypass HARDENED_USERCOPY overhead. Bounds +* checking, both file offset and device offset, is handled by +* dax_iomap_actor() +*/ static size_t pmem_copy_from_iter (struct dax_device *dax_dev,pgoff_t pgoff,void *addr,size_t bytes,struct iov_iter *i) { -return copy_from_iter_flushcache (addr, bytes, i); +return _copy_from_iter_flushcache (addr, bytes, i); }static size_t pmem_copy_to_iter (struct dax_device *dax_dev,pgoff_t pgoff,void *addr,size_t bytes,struct iov_iter *i) { -return copy_to_iter_mcsafe (addr, bytes, i); +return _copy_to_iter_mcsafe (addr, bytes, i); }static const struct dax_operations pmem_dax_ops = {
Greg Kroah-Hartman
maintainerPATCH 14/276 arm64/kernel: kaslr: reduce module randomization range to 2 GB
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
commit b2eed9b58811283d00fa861944cb75797d4e52a7 upstream.
The following commit
7290d5809571 ("module: use relative references for __ksymtab entries")
updated the ksymtab handling of some KASLR capable architectures so that ksymtab entries are emitted as pairs of 32-bit relative references. This reduces the size of the entries, but more importantly, it gets rid of statically assigned absolute addresses, which require fixing up at boot time if the kernel is self relocating (which takes a 24 byte RELA entry for each member of the ksymtab struct).
Since ksymtab entries are always part of the same module as the symbol they export, it was assumed at the time that a 32-bit relative reference is always sufficient to capture the offset between a ksymtab entry and its target symbol.
Unfortunately, this is not always true: in the case of per-CPU variables, a per-CPU variable's base address (which usually differs from the actual address of any of its per-CPU copies) is allocated in the vicinity of the ..data.percpu section in the core kernel (i.e., in the per-CPU reserved region which follows the section containing the core kernel's statically allocated per-CPU variables).
Since we randomize the module space over a 4 GB window covering the core kernel (based on the -/+ 4 GB range of an ADRP/ADD pair), we may end up putting the core kernel out of the -/+ 2 GB range of 32-bit relative references of module ksymtab entries that refer to per-CPU variables.
So reduce the module randomization range a bit further. We lose 1 bit of randomization this way, but this is something we can tolerate.
--- arch/arm64/kernel/kaslr.c | 6 +++--- arch/arm64/kernel/module.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/kernel/kaslr.c +3 -3
@@ -145,15 +145,15 @@ u64 __init kaslr_early_init(u64 dt_phys)if (IS_ENABLED (CONFIG_RANDOMIZE_MODULE_REGION_FULL )) {/* -* Randomize the module region over a 4 GB window covering the +* Randomize the module region over a 2 GB window covering the * kernel. This reduces the risk of modules leaking information * about the address of the kernel itself, but results in * branches between modules and the core kernel that are * resolved via PLTs. (Branches between modules will be * resolved normally.) */ - module_range =SZ_4G - (u64)(_end - _stext); - module_alloc_base =max ((u64 )_end + offset -SZ_4G , + module_range =SZ_2G - (u64)(_end - _stext); + module_alloc_base =max ((u64 )_end + offset -SZ_2G , (u64 )MODULES_VADDR ); }else {/*
arch/arm64/kernel/module.c +1 -1
@@ -56,7 +56,7 @@ void *module_alloc(unsigned long size)* can simply omit this fallback in that case. */ p =__vmalloc_node_range (size,MODULE_ALIGN , module_alloc_base, - module_alloc_base +SZ_4G ,GFP_KERNEL , + module_alloc_base +SZ_2G ,GFP_KERNEL ,PAGE_KERNEL_EXEC ,0 ,NUMA_NO_NODE ,__builtin_return_address (0 ));
Greg Kroah-Hartman
maintainerPATCH 15/276 arm64/iommu: handle non-remapped addresses in ->mmap and ->get_sgtable
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
commit a98d9ae937d256ed679a935fc82d9deaa710d98e upstream.
DMA allocations that can't sleep may return non-remapped addresses, but we do not properly handle them in the mmap and get_sgtable methods. Resolve non-vmalloc addresses using virt_to_page to handle this corner case.
--- arch/arm64/mm/dma-mapping.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/mm/dma-mapping.c +10 -0
@@ -664,6 +664,11 @@ static int __iommu_mmap_attrs(struct devif (dma_mmap_from_dev_coherent (dev, vma, cpu_addr, size, &ret))return ret; +if (!is_vmalloc_addr (cpu_addr)) { +unsigned long pfn =page_to_pfn (virt_to_page (cpu_addr)); +return __swiotlb_mmap_pfn (vma, pfn, size); + } +if (attrs &DMA_ATTR_FORCE_CONTIGUOUS ) {/* * DMA_ATTR_FORCE_CONTIGUOUS allocations are always remapped,
@@ -687,6 +692,11 @@ static int __iommu_get_sgtable(struct deunsigned int count =PAGE_ALIGN (size) >>PAGE_SHIFT ;struct vm_struct *area =find_vm_area (cpu_addr); +if (!is_vmalloc_addr (cpu_addr)) { +struct page *page =virt_to_page (cpu_addr); +return __swiotlb_get_sgtable_page (sgt, page, size); + } +if (attrs &DMA_ATTR_FORCE_CONTIGUOUS ) {/* * DMA_ATTR_FORCE_CONTIGUOUS allocations are always remapped,
Greg Kroah-Hartman
maintainerPATCH 17/276 btrfs: dont double unlock on error in btrfs_punch_hole
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 8fca955057b9c58467d1b231e43f19c4cf26ae8c upstream.
If we have an error writing out a delalloc range in btrfs_punch_hole_lock_range we'll unlock the inode and then goto out_only_mutex, where we will again unlock the inode. This is bad, don't do this.
--- fs/btrfs/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/btrfs/file.c +1 -3
@@ -2565,10 +2565,8 @@ static int btrfs_punch_hole(struct inode ret =btrfs_punch_hole_lock_range (inode, lockstart, lockend, &cached_state); -if (ret) { -inode_unlock (inode); +if (ret) goto out_only_mutex; - } path =btrfs_alloc_path ();if (!path) {
Greg Kroah-Hartman
maintainerPATCH 21/276 btrfs: sysfs: Fix error path kobject memory leak
In reply to Greg Kroah-HartmanFrom: Tobin C. Harding <[email protected]>
commit 450ff8348808a89cc27436771aa05c2b90c0eef1 upstream.
If a call to kobject_init_and_add() fails we must call kobject_put() otherwise we leak memory.
Calling kobject_put() when kobject_init_and_add() fails drops the refcount back to 0 and calls the ktype release method (which in turn calls the percpu destroy and kfree).
Add call to kobject_put() in the error path of call to kobject_init_and_add().
--- fs/btrfs/extent-tree.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/btrfs/extent-tree.c +1 -2
@@ -3911,8 +3911,7 @@ static int create_space_info(struct btrf info->space_info_kobj,"%s" , alloc_name(space_info->flags));if (ret) { -percpu_counter_destroy (&space_info->total_bytes_pinned); -kfree (space_info); +kobject_put (&space_info->kobj);return ret; }
Greg Kroah-Hartman
maintainerPATCH 5/276 KVM: x86: fix return value for reserved EFER
In reply to Greg Kroah-HartmanFrom: Paolo Bonzini <[email protected]>
commit 66f61c92889ff3ca365161fb29dd36d6354682ba upstream.
Commit 11988499e62b ("KVM: x86: Skip EFER vs. guest CPUID checks for host-initiated writes", 2019-04-02) introduced a "return false" in a function returning int, and anyway set_efer has a "nonzero on error" conventon so it should be returning 1.
--- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
@@ -1188,7 +1188,7 @@ static int set_efer(struct kvm_vcpu *vcpu64 efer = msr_info->data;if (efer & efer_reserved_bits) -return false; +return 1 ;if (!msr_info->host_initiated) {if (!__kvm_valid_efer (vcpu, efer))
Greg Kroah-Hartman
maintainerPATCH 8/276 Revert "scsi: sd: Keep disk read-only when re-reading partition"
In reply to Greg Kroah-HartmanFrom: Martin K. Petersen <[email protected]>
commit 8acf608e602f6ec38b7cc37b04c80f1ce9a1a6cc upstream.
This reverts commit 20bd1d026aacc5399464f8328f305985c493cde3.
This patch introduced regressions for devices that come online in read-only state and subsequently switch to read-write.
Given how the partition code is currently implemented it is not possible to persist the read-only flag across a device revalidate call. This may need to get addressed in the future since it is common for user applications to proactively call BLKRRPART.
Reverting this commit will re-introduce a regression where a device-initiated revalidate event will cause the admin state to be forgotten. A separate patch will address this issue.
--- drivers/scsi/sd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/sd.c +1 -2
@@ -2605,7 +2605,6 @@ sd_read_write_protect_flag(struct scsi_dint res;struct scsi_device *sdp = sdkp->device;struct scsi_mode_data data; -int disk_ro =get_disk_ro (sdkp->disk);int old_wp = sdkp->write_prot;set_disk_ro (sdkp->disk,0 );
@@ -2646,7 +2645,7 @@ sd_read_write_protect_flag(struct scsi_d "Test WP failed, assume Write Enabled\n"); }else { sdkp->write_prot = ((data.device_specific &0x80 ) !=0 ); -set_disk_ro (sdkp->disk, sdkp->write_prot || disk_ro); +set_disk_ro (sdkp->disk, sdkp->write_prot);if (sdkp->first_scan || old_wp != sdkp->write_prot) {sd_printk (KERN_NOTICE , sdkp,"Write Protect is %s\n" , sdkp->write_prot ?"on" :"off" );
Greg Kroah-Hartman
maintainerPATCH 9/276 crypto: vmx - CTR: always increment IV as quadword
In reply to Greg Kroah-HartmanFrom: Daniel Axtens <[email protected]>
commit 009b30ac7444c17fae34c4f435ebce8e8e2b3250 upstream.
The kernel self-tests picked up an issue with CTR mode:
alg: skcipher: p8_aes_ctr encryption test failed (wrong result) on test vector 3, cfg="uneven misaligned splits, may sleep"
Test vector 3 has an IV of FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD, so after 3 increments it should wrap around to 0.
In the aesp8-ppc code from OpenSSL, there are two paths that increment IVs: the bulk (8 at a time) path, and the individual path which is used when there are fewer than 8 AES blocks to process.
In the bulk path, the IV is incremented with vadduqm: "Vector Add Unsigned Quadword Modulo", which does 128-bit addition.
In the individual path, however, the IV is incremented with
vadduwm: "Vector Add Unsigned Word Modulo", which instead does 4 32-bit additions. Thus the IV would instead become FFFFFFFFFFFFFFFFFFFFFFFF00000000, throwing off the result.
Use vadduqm.
This was probably a typo originally, what with q and w being adjacent. It is a pretty narrow edge case: I am really impressed by the quality of the kernel self-tests!
--- drivers/crypto/vmx/aesp8-ppc.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/vmx/aesp8-ppc.pl +1 -1
@@ -1357,7 +1357,7 @@ Loop_ctr32_enc: addi $idx,$idx,16 bdnz Loop_ctr32_enc - vadduwm $ivec,$ivec,$one + vadduqm $ivec,$ivec,$one vmr $dat,$inptail lvx $inptail,0,$inp addi $inp,$inp,16
Greg Kroah-Hartman
maintainerPATCH 29/276 brcmfmac: add subtype check for event handling in data path
In reply to Greg Kroah-HartmanFrom: Arend van Spriel <[email protected]>
commit a4176ec356c73a46c07c181c6d04039fafa34a9f upstream.
For USB there is no separate channel being used to pass events from firmware to the host driver and as such are passed over the data path. In order to detect mock event messages an additional check is needed on event subtype. This check is added conditionally using unlikely() keyword.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 5 ++-- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h | 16 ++++++++++---- drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 - 3 files changed, 16 insertions(+), 7 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +3 -2
@@ -464,7 +464,8 @@ void brcmf_rx_frame(struct device *dev, }else {/* Process special event packets */ if (handle_event) -brcmf_fweh_process_skb (ifp->drvr, skb); +brcmf_fweh_process_skb (ifp->drvr, skb, +BCMILCP_SUBTYPE_VENDOR_LONG );brcmf_netif_rx (ifp, skb); }
@@ -481,7 +482,7 @@ void brcmf_rx_event(struct device *dev,if (brcmf_rx_hdrpull (drvr, skb, &ifp))return ; -brcmf_fweh_process_skb (ifp->drvr, skb); +brcmf_fweh_process_skb (ifp->drvr, skb,0 );brcmu_pkt_buf_free_skb (skb); }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h +12 -4
@@ -211,7 +211,7 @@ enum brcmf_fweh_event_code {*/ #define BRCM_OUI "\x00\x10\x18"#define BCMILCP_BCM_SUBTYPE_EVENT 1 - +#define BCMILCP_SUBTYPE_VENDOR_LONG 32769/** * struct brcm_ethhdr - broadcom specific ether header.
@@ -334,10 +334,10 @@ void brcmf_fweh_process_event(struct brcvoid brcmf_fweh_p2pdev_setup (struct brcmf_if *ifp,bool ongoing);static inline void brcmf_fweh_process_skb (struct brcmf_pub *drvr, -struct sk_buff *skb) +struct sk_buff *skb,u16 stype) {struct brcmf_event *event_packet; -u16 usr_stype; +u16 subtype, usr_stype;/* only process events when protocol matches */ if (skb->protocol !=cpu_to_be16 (ETH_P_LINK_CTL ))
@@ -346,8 +346,16 @@ static inline void brcmf_fweh_process_skif ((skb->len +ETH_HLEN ) <sizeof (*event_packet))return ; -/* check for BRCM oui match */ event_packet = (struct brcmf_event *)skb_mac_header (skb); + +/* check subtype if needed */ +if (unlikely (stype)) { + subtype =get_unaligned_be16 (&event_packet->hdr.subtype); +if (subtype != stype) +return ; + } + +/* check for BRCM oui match */ if (memcmp (BRCM_OUI , &event_packet->hdr.oui[0 ],sizeof (event_packet->hdr.oui)))return ;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +1 -1
@@ -1116,7 +1116,7 @@ static void brcmf_msgbuf_process_event(s skb->protocol =eth_type_trans (skb, ifp->ndev); -brcmf_fweh_process_skb (ifp->drvr, skb); +brcmf_fweh_process_skb (ifp->drvr, skb,0 ); exit:brcmu_pkt_buf_free_skb (skb);
Greg Kroah-Hartman
maintainercover 4.19.47-stable review
This is the start of the stable review cycle for the 4.19.47 release. There are 276 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat 01 Jun 2019 03:02:08 AM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.47-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.19.47-rc1
Benjamin Coddington <[email protected]>
NFS: Fix a double unlock from nfs_match,get_client
Maxime Ripard <[email protected]>
drm/sun4i: dsi: Enforce boundaries on the start delay
Farhan Ali <[email protected]>
vfio-ccw: Prevent quiesce function going into an infinite loop
Maxime Ripard <[email protected]>
drm/sun4i: dsi: Change the start delay calculation
Chris Wilson <[email protected]>
drm: Wake up next in drm_read() chain if we are forced to putback the event
Noralf Trønnes <[email protected]>
drm/drv: Hold ref on parent device during drm_device lifetime
Eric Anholt <[email protected]>
drm/v3d: Handle errors from IRQ setup.
Arnd Bergmann <[email protected]>
ASoC: davinci-mcasp: Fix clang warning without CONFIG_PM
Chris Lesiak <[email protected]>
spi: Fix zero length xfer bug
Trent Piepho <[email protected]>
spi: imx: stop buffer overflow in RX FIFO flush
Geert Uytterhoeven <[email protected]>
spi: rspi: Fix sequencer reset during initialization
Tony Lindgren <[email protected]>
drm/omap: dsi: Fix PM for display blank with paired dss_pll calls
Aditya Pakki <[email protected]>
spi : spi-topcliff-pch: Fix to handle empty DMA buffers
James Smart <[email protected]>
scsi: lpfc: Fix SLI3 commands being issued on SLI4 devices
Arnd Bergmann <[email protected]>
media: saa7146: avoid high stack usage with clang
James Smart <[email protected]>
scsi: lpfc: Fix fc4type information for FDMI
James Smart <[email protected]>
scsi: lpfc: Fix FDMI manufacturer attribute value
Hans Verkuil <[email protected]>
media: vimc: zero the media_device on probe
Arnd Bergmann <[email protected]>
media: go7007: avoid clang frame overflow warning with KASAN
Hans Verkuil <[email protected]>
media: gspca: do not resubmit URBs when streaming has stopped
Helen Fornazier <[email protected]>
media: vimc: stream: fix thread state before sleep
Kangjie Lu <[email protected]>
scsi: ufs: fix a missing check of devm_reset_control_get
Nicholas Kazlauskas <[email protected]>
drm/amd/display: Set stream->mode_changed when connectors change
Murton Liu <[email protected]>
drm/amd/display: Fix Divide by 0 in memory calculations
Arnd Bergmann <[email protected]>
media: staging: davinci_vpfe: disallow building with COMPILE_TEST
James Hutchinson <[email protected]>
media: m88ds3103: serialize reset messages in m88ds3103_set_frontend
Stefan Brüns <[email protected]>
media: dvbsky: Avoid leaking dvb frontend
Kangjie Lu <[email protected]>
media: si2165: fix a missing check of return value
Kai-Heng Feng <[email protected]>
igb: Exclude device from suspend direct complete optimization
Noralf Trønnes <[email protected]>
tinydrm/mipi-dbi: Use dma-safe buffers for all SPI transfers
Kai-Heng Feng <[email protected]>
e1000e: Disable runtime PM on CNP+
Kangjie Lu <[email protected]>
thunderbolt: property: Fix a NULL pointer dereference
Dmytro Laktyushkin <[email protected]>
drm/amd/display: fix releasing planes when exiting odm
Aditya Pakki <[email protected]>
thunderbolt: Fix to check for kmemdup failure
Aditya Pakki <[email protected]>
thunderbolt: Fix to check return value of ida_simple_get
Rouven Czerwinski <[email protected]>
hwrng: omap - Set default quality
Sameer Pujar <[email protected]>
dmaengine: tegra210-adma: use devm_clk_*() helpers
Linus Lüssing <[email protected]>
batman-adv: allow updating DAT entry timeouts on incoming ARP Replies
Arnd Bergmann <[email protected]>
selinux: avoid uninitialized variable warning
Arnd Bergmann <[email protected]>
scsi: lpfc: avoid uninitialized variable warning
Arnd Bergmann <[email protected]>
scsi: qla4xxx: avoid freeing unallocated dma memory
Tony Lindgren <[email protected]>
usb: core: Add PM runtime calls to usb_hcd_platform_shutdown
Paul E. McKenney <[email protected]>
rcuperf: Fix cleanup path for invalid perf_type strings
Yazen Ghannam <[email protected]>
x86/mce: Handle varying MCA bank counts
Paul E. McKenney <[email protected]>
rcutorture: Fix cleanup path for invalid torture_type strings
Tony Luck <[email protected]>
x86/mce: Fix machine_check_poll() tests for error types
Leon Romanovsky <[email protected]>
overflow: Fix -Wtype-limits compilation warnings
Kangjie Lu <[email protected]>
tty: ipwireless: fix missing checks for ioremap
Pankaj Gupta <[email protected]>
virtio_console: initialize vtermno value for ports
Chad Dupuis <[email protected]>
scsi: qedf: Add missing return in qedf_post_io_req() in the fcport offload check
Thomas Gleixner <[email protected]>
timekeeping: Force upper bound for setting CLOCK_REALTIME
Aditya Pakki <[email protected]>
thunderbolt: Fix to check the return value of kmemdup
Kangjie Lu <[email protected]>
thunderbolt: property: Fix a missing check of kzalloc
Ard Biesheuvel <[email protected]>
efifb: Omit memory map check on legacy boot
Ezequiel Garcia <[email protected]>
media: gspca: Kill URBs on USB device disconnect
Dan Carpenter <[email protected]>
media: wl128x: prevent two potential buffer overflows
Kangjie Lu <[email protected]>
media: video-mux: fix null pointer dereferences
Tetsuo Handa <[email protected]>
kobject: Don't trigger kobject_uevent(KOBJ_REMOVE) twice.
Sowjanya Komatineni <[email protected]>
spi: tegra114: reset controller on probe
Hans de Goede <[email protected]>
HID: logitech-hidpp: change low battery level threshold from 31 to 30 percent
Gustavo A. R. Silva <[email protected]>
cxgb3/l2t: Fix undefined behaviour
Wen Yang <[email protected]>
ASoC: fsl_utils: fix a leaked reference by adding missing of_node_put
Wen Yang <[email protected]>
ASoC: eukrea-tlv320: fix a leaked reference by adding missing of_node_put
Nicolas Saenz Julienne <[email protected]>
HID: core: move Usage Page concatenation to Main item
Geert Uytterhoeven <[email protected]>
sh: sh7786: Add explicit I/O cast to sh7786_mm_sel()
Leon Romanovsky <[email protected]>
RDMA/hns: Fix bad endianess of port_pd variable
Chengguang Xu <[email protected]>
chardev: add additional check for minor range overlap
Peter Zijlstra <[email protected]>
x86/uaccess: Fix up the fixup
Peter Zijlstra <[email protected]>
x86/ia32: Fix ia32_restore_sigcontext() AC leak
Peter Zijlstra <[email protected]>
x86/uaccess, signal: Fix AC=1 bloat
Peter Zijlstra <[email protected]>
x86/uaccess, ftrace: Fix ftrace_likely_update() vs. SMAP
Lior David <[email protected]>
wil6210: fix return code of wmi_mgmt_tx and wmi_mgmt_tx_ext
Wen Yang <[email protected]>
arm64: cpu_ops: fix a leaked reference by adding missing of_node_put
Yannick Fertré <[email protected]>
drm/panel: otm8009a: Add delay at the end of initialization
Stanley Chu <[email protected]>
scsi: ufs: Avoid configuring regulator with undefined voltage range
Stanley Chu <[email protected]>
scsi: ufs: Fix regulator load and icc-level configuration
Ping-Ke Shih <[email protected]>
rtlwifi: fix potential NULL pointer dereference
Alexandre Belloni <[email protected]>
rtc: xgene: fix possible race condition
Piotr Figiel <[email protected]>
brcmfmac: fix Oops when bringing up interface during USB disconnect
Piotr Figiel <[email protected]>
brcmfmac: fix race during disconnect when USB completion is in progress
Piotr Figiel <[email protected]>
brcmfmac: fix WARNING during USB disconnect in case of unempty psq
Piotr Figiel <[email protected]>
brcmfmac: convert dev_init_lock mutex to completion
Arnd Bergmann <[email protected]>
b43: shut up clang -Wuninitialized variable warning
Kangjie Lu <[email protected]>
brcmfmac: fix missing checks for kmemdup
YueHaibing <[email protected]>
mwifiex: Fix mem leak in mwifiex_tm_cmd
Kangjie Lu <[email protected]>
rtlwifi: fix a potential NULL pointer dereference
Daniel T. Lee <[email protected]>
selftests/bpf: ksym_search won't check symbols exists
Justin Chen <[email protected]>
iio: adc: ti-ads7950: Fix improper use of mlock
Nathan Chancellor <[email protected]>
iio: common: ssp_sensors: Initialize calculated_time in ssp_common_process_data
Kangjie Lu <[email protected]>
iio: hmc5843: fix potential NULL pointer dereferences
Lars-Peter Clausen <[email protected]>
iio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertion
Wen Yang <[email protected]>
drm/pl111: fix possible object reference leak
Kees Cook <[email protected]>
x86/build: Keep local relocations with ld.lld
David Kozub <[email protected]>
block: sed-opal: fix IOC_OPAL_ENABLE_DISABLE_MBR
Wen Yang <[email protected]>
cpufreq: kirkwood: fix possible object reference leak
Wen Yang <[email protected]>
cpufreq: pmac32: fix possible object reference leak
Wen Yang <[email protected]>
cpufreq/pasemi: fix possible object reference leak
Wen Yang <[email protected]>
cpufreq: ppc_cbe: fix possible object reference leak
Kristian Evensen <[email protected]>
qmi_wwan: Add quirk for Quectel dynamic config
Roman Gushchin <[email protected]>
selftests: cgroup: fix cleanup path in test_memcg_subtree_control()
Arnd Bergmann <[email protected]>
s390: cio: fix cio_irb declaration
Thomas Huth <[email protected]>
s390/mm: silence compiler warning when compiling without CONFIG_PGSTE
Borislav Petkov <[email protected]>
x86/microcode: Fix the ancient deprecated microcode loading method
Arnd Bergmann <[email protected]>
s390: zcrypt: initialize variables before_use
Douglas Anderson <[email protected]>
clk: rockchip: Make rkpwm a critical clock on rk3288
Charles Keepax <[email protected]>
extcon: arizona: Disable mic detect if running when driver is removed
Douglas Anderson <[email protected]>
clk: rockchip: Fix video codec clocks on rk3288
Ulf Hansson <[email protected]>
PM / core: Propagate dev->power.wakeup_path when no callbacks
Christian König <[email protected]>
drm/amdgpu: fix old fence check in amdgpu_fence_emit
Yinbo Zhu <[email protected]>
mmc: sdhci-of-esdhc: add erratum eSDHC-A001 and A-008358 support
Yinbo Zhu <[email protected]>
mmc: sdhci-of-esdhc: add erratum A-009204 support
Yinbo Zhu <[email protected]>
mmc: sdhci-of-esdhc: add erratum eSDHC5 support
Kangjie Lu <[email protected]>
mmc_spi: add a status check for spi_sync_locked
Andrea Merello <[email protected]>
mmc: core: make pwrseq_emmc (partially) support sleepy GPIO controllers
John Garry <[email protected]>
scsi: libsas: Do discovery on empty PHY to update PHY info
Guenter Roeck <[email protected]>
hwmon: (f71805f) Use request_muxed_region for Super-IO accesses
Guenter Roeck <[email protected]>
hwmon: (pc87427) Use request_muxed_region for Super-IO accesses
Guenter Roeck <[email protected]>
hwmon: (smsc47b397) Use request_muxed_region for Super-IO accesses
Guenter Roeck <[email protected]>
hwmon: (smsc47m1) Use request_muxed_region for Super-IO accesses
Guenter Roeck <[email protected]>
hwmon: (vt1211) Use request_muxed_region for Super-IO accesses
Kan Liang <[email protected]>
perf/x86/intel/cstate: Add Icelake support
Kan Liang <[email protected]>
perf/x86/intel/rapl: Add Icelake support
Kan Liang <[email protected]>
perf/x86/msr: Add Icelake support
Colin Ian King <[email protected]>
RDMA/cxgb4: Fix null pointer dereference on alloc_skb failure
Vincenzo Frascino <[email protected]>
arm64: vdso: Fix clock_getres() for CLOCK_REALTIME
Kefeng Wang <[email protected]>
ACPI/IORT: Reject platform device creation on NUMA node mapping failure
Nicholas Nunley <[email protected]>
i40e: don't allow changes to HW VLAN stripping on active port VLANs
Adam Ludkiewicz <[email protected]>
i40e: Able to add up to 16 MAC filters on an untrusted VF
Arnd Bergmann <[email protected]>
phy: mapphone-mdm6600: add gpiolib dependency
Paul Kocialkowski <[email protected]>
phy: sun4i-usb: Make sure to disable PHY0 passby for peripheral mode
Russell King <[email protected]>
drm: etnaviv: avoid DMA API warning when importing buffers
Thomas Gleixner <[email protected]>
x86/irq/64: Limit IST stack overflow check to #DB stack
Alan Stern <[email protected]>
USB: core: Don't unbind interfaces following device reset failure
Julian Wiedmann <[email protected]>
s390/qeth: handle error from qeth_update_from_chp_desc()
Mika Westerberg <[email protected]>
thunderbolt: Take domain lock in switch sysfs attribute callbacks
Nicholas Piggin <[email protected]>
irq_work: Do not raise an IPI when queueing work on the local CPU
Wen Yang <[email protected]>
drm/msm: a5xx: fix possible object reference leak
Nicholas Mc Guire <[email protected]>
staging: vc04_services: handle kzalloc failure
Konstantin Khlebnikov <[email protected]>
sched/core: Handle overflow in cpu_shares_write_u64
Konstantin Khlebnikov <[email protected]>
sched/rt: Check integer overflow at usec to nsec conversion
Konstantin Khlebnikov <[email protected]>
sched/core: Check quota and period overflow at usec to nsec conversion
Roman Gushchin <[email protected]>
cgroup: protect cgroup->nr_(dying_)descendants by css_set_lock
Sebastian Andrzej Siewior <[email protected]>
random: add a spinlock_t to struct batched_entropy
Jon DeVree <[email protected]>
random: fix CRNG initialization when random.trust_cpu=1
Russell Currey <[email protected]>
powerpc/64: Fix booting large kernels with STRICT_KERNEL_RWX
Nathan Lynch <[email protected]>
powerpc/numa: improve control of topology updates
Yufen Yu <[email protected]>
block: fix use-after-free on gendisk
Fabrice Gasnier <[email protected]>
iio: adc: stm32-dfsdm: fix unmet direct dependencies detected
Dan Carpenter <[email protected]>
media: pvrusb2: Prevent a buffer overflow
Shuah Khan <[email protected]>
media: au0828: Fix NULL pointer dereference in au0828_analog_stream_enable()
Hugues Fruchet <[email protected]>
media: stm32-dcmi: fix crash when subdev do not expose any formats
Wenwen Wang <[email protected]>
audit: fix a memory leak bug
Akinobu Mita <[email protected]>
media: ov2659: make S_FMT succeed even if requested format doesn't match
Hans Verkuil <[email protected]>
media: au0828: stop video streaming only when last user stops
Janusz Krzysztofik <[email protected]>
media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper
Philipp Zabel <[email protected]>
media: coda: clear error return value before picture run
Nicolas Ferre <[email protected]>
dmaengine: at_xdmac: remove BUG_ON macro in tasklet
Robin Murphy <[email protected]>
perf/arm-cci: Remove broken race mitigation
Douglas Anderson <[email protected]>
clk: rockchip: undo several noc and special clocks as critical on rk3288
Wen Yang <[email protected]>
pinctrl: samsung: fix leaked of_node references
Wen Yang <[email protected]>
pinctrl: pistachio: fix leaked of_node references
Hans de Goede <[email protected]>
HID: logitech-hidpp: use RAP instead of FAP to get the protocol version
Balakrishna Godavarthi <[email protected]>
Bluetooth: hci_qca: Give enough time to ROME controller to bootup.
Peter Zijlstra <[email protected]>
mm/uaccess: Use 'unsigned long' to placate UBSAN warnings on older GCC versions
Jiri Kosina <[email protected]>
x86/mm: Remove in_nmi() warning from 64-bit implementation of vmalloc_fault()
Sebastian Andrzej Siewior <[email protected]>
smpboot: Place the __percpu annotation correctly
Kees Cook <[email protected]>
x86/build: Move _etext to actual end of .text
Farhan Ali <[email protected]>
vfio-ccw: Release any channel program when releasing/removing vfio-ccw mdev
Farhan Ali <[email protected]>
vfio-ccw: Do not call flush_workqueue while holding the spinlock
Parav Pandit <[email protected]>
RDMA/cma: Consider scope_id while binding to ipv6 ll address
Arnd Bergmann <[email protected]>
bcache: avoid clang -Wunintialized warning
Coly Li <[email protected]>
bcache: add failure check to run_cache_set() for journal replay
Tang Junhui <[email protected]>
bcache: fix failure in journal relplay
Coly Li <[email protected]>
bcache: return error immediately in bch_journal_replay()
Shenghui Wang <[email protected]>
bcache: avoid potential memleak of list of journal_replay(s) in the CACHE_SYNC branch of run_cache_set
Corentin Labbe <[email protected]>
crypto: sun4i-ss - Fix invalid calculation of hash end
Sagi Grimberg <[email protected]>
nvme-rdma: fix a NULL deref when an admin connect times out
Sagi Grimberg <[email protected]>
nvme: set 0 capacity if namespace block size exceeds PAGE_SIZE
Kangjie Lu <[email protected]>
net: cw1200: fix a NULL pointer dereference
Aditya Pakki <[email protected]>
rsi: Fix NULL pointer dereference in kmalloc
Dan Carpenter <[email protected]>
mwifiex: prevent an array overflow
Daniel Baluta <[email protected]>
ASoC: fsl_sai: Update is_slave_mode with correct value
Kangjie Lu <[email protected]>
slimbus: fix a potential NULL pointer dereference in of_qcom_slim_ngd_register
Daniel T. Lee <[email protected]>
libbpf: fix samples/bpf build failure due to undefined UINT32_MAX
Sergey Matyukevich <[email protected]>
mac80211/cfg80211: update bss channel on channel switch
Sugar Zhang <[email protected]>
dmaengine: pl330: _stop: clear interrupt status
Arnd Bergmann <[email protected]>
s390: qeth: address type mismatch warning
Mariusz Bialonczyk <[email protected]>
w1: fix the resume command API
Nicholas Piggin <[email protected]>
sched/nohz: Run NOHZ idle load balancer on HK_FLAG_MISC CPUs
Philipp Rudo <[email protected]>
s390/kexec_file: Fix detection of text segment in ELF loader
Manish Rangankar <[email protected]>
scsi: qedi: Abort ep termination if offload not scheduled
Fabien Dessenne <[email protected]>
rtc: stm32: manage the get_irq probe defer case
Sven Van Asbroeck <[email protected]>
rtc: 88pm860x: prevent use-after-free on device remove
Johannes Berg <[email protected]>
iwlwifi: pcie: don't crash on invalid RX interrupt
Qu Wenruo <[email protected]>
btrfs: Don't panic when we can't find a root key
Josef Bacik <[email protected]>
btrfs: fix panic during relocation after ENOSPC before writeback happens
Robbie Ko <[email protected]>
Btrfs: fix data bytes_may_use underflow with fallocate due to failed quota reserve
Nadav Amit <[email protected]>
x86/modules: Avoid breaking W^X while loading modules
Bart Van Assche <[email protected]>
scsi: qla2xxx: Fix hardirq-unsafe locking
Bart Van Assche <[email protected]>
scsi: qla2xxx: Avoid that lockdep complains about unsafe locking in tcm_qla2xxx_close_session()
Bart Van Assche <[email protected]>
scsi: qla2xxx: Fix abort handling in tcm_qla2xxx_write_pending()
Bart Van Assche <[email protected]>
scsi: qla2xxx: Fix a qla24xx_enable_msix() error path
Viresh Kumar <[email protected]>
sched/cpufreq: Fix kobject memleak
Nicholas Piggin <[email protected]>
powerpc/watchdog: Use hrtimers for per-CPU heartbeat
Qian Cai <[email protected]>
arm64: Fix compiler warning from pte_unmap() with -Wunused-but-set-variable
Marc Zyngier <[email protected]>
ARM: vdso: Remove dependency with the arch_timer driver internals
Fabien Dessenne <[email protected]>
media: stm32-dcmi: return appropriate error codes during probe
Jon Derrick <[email protected]>
drm/nouveau/bar/nv50: ensure BAR is mapped
Pierre-Louis Bossart <[email protected]>
ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
Dan Carpenter <[email protected]>
brcm80211: potential NULL dereference in brcmf_cfg80211_vndr_cmds_dcmd_handler()
Flavio Suligoi <[email protected]>
spi: pxa2xx: fix SCR (divisor) calculation
Arnd Bergmann <[email protected]>
ASoC: imx: fix fiq dependencies
Anju T Sudhakar <[email protected]>
powerpc/perf: Fix loop exit condition in nest_imc_event_init
Bo YU <[email protected]>
powerpc/boot: Fix missing check of lseek() return value
Anju T Sudhakar <[email protected]>
powerpc/perf: Return accordingly on invalid chip-id in
Jerome Brunet <[email protected]>
ASoC: hdmi-codec: unlock the device on startup errors
Marek Szyprowski <[email protected]>
usb: dwc3: move synchronize_irq() out of the spinlock protected block
Minas Harutyunyan <[email protected]>
usb: dwc2: gadget: Increase descriptors count for ISOC's
Mac Chiang <[email protected]>
ASoC: Intel: kbl_da7219_max98357a: Map BTN_0 to KEY_PLAYPAUSE
Wen Yang <[email protected]>
pinctrl: zte: fix leaked of_node references
João Paulo Rechi Vita <[email protected]>
Bluetooth: Ignore CC events not matching the last HCI command
Haiyang Zhang <[email protected]>
hv_netvsc: fix race that may miss tx queue wakeup
Sameeh Jubran <[email protected]>
net: ena: gcc 8: fix compilation warning
Sameer Pujar <[email protected]>
dmaengine: tegra210-dma: free dma controller in remove()
Masahiro Yamada <[email protected]>
bpftool: exclude bash-completion/bpftool from .gitignore pattern
Yonghong Song <[email protected]>
selftests/bpf: set RLIMIT_MEMLOCK properly for test_libbpf_open.c
Vineet Gupta <[email protected]>
tools/bpf: fix perf build error with uClibc (seen on ARC)
Raul E Rangel <[email protected]>
mmc: core: Verify SD bus width
Andreas Gruenbacher <[email protected]>
gfs2: Fix occasional glock use-after-free
Mike Marciniszyn <[email protected]>
IB/hfi1: Fix WQ_MEM_RECLAIM warning
Roberto Bergantinos Corpas <[email protected]>
NFS: make nfs_match_client killable
YueHaibing <[email protected]>
cxgb4: Fix error path in cxgb4_init_module
Ross Lagerwall <[email protected]>
gfs2: Fix lru_count going negative
David Sterba <[email protected]>
Revert "btrfs: Honour FITRIM range constraints during free space trim"
Al Viro <[email protected]>
acct_on(): don't mess with freeze protection
YueHaibing <[email protected]>
at76c50x-usb: Don't register led_trigger if usb_register_driver failed
Linus Lüssing <[email protected]>
batman-adv: mcast: fix multicast tt/tvlv worker locking
Eric Dumazet <[email protected]>
bpf: devmap: fix use-after-free Read in __dev_map_entry_free
YueHaibing <[email protected]>
ssb: Fix possible NULL pointer dereference in ssb_host_pcmcia_exit
Alexander Potapenko <[email protected]>
media: vivid: use vfree() instead of kfree() for dev->bitmap_cap
Hans Verkuil <[email protected]>
media: vb2: add waiting_in_dqbuf flag
YueHaibing <[email protected]>
media: serial_ir: Fix use-after-free in serial_ir_init_module
YueHaibing <[email protected]>
media: cpia2: Fix use-after-free in cpia2_exit
Jiufei Xue <[email protected]>
fbdev: fix WARNING in __alloc_pages_nodemask bug
Amir Goldstein <[email protected]>
ovl: relax WARN_ON() for overlapping layers use case
Josef Bacik <[email protected]>
btrfs: honor path->skip_locking in backref code
Will Deacon <[email protected]>
arm64: errata: Add workaround for Cortex-A76 erratum #1463225
Arend van Spriel <[email protected]>
brcmfmac: add subtype check for event handling in data path
Arend van Spriel <[email protected]>
brcmfmac: assure SSID length from firmware is limited
Daniel Borkmann <[email protected]>
bpf: add bpf_jit_limit knob to restrict unpriv allocations
Olga Kornievskaia <[email protected]>
NFSv4.1 fix incorrect return value in copy_file_range
Olga Kornievskaia <[email protected]>
NFSv4.2 fix unnecessary retry in nfs4_copy_file_range
Shile Zhang <[email protected]>
fbdev: fix divide error in fb_var_to_videomode
Dan Carpenter <[email protected]>
udlfb: fix some inconsistent NULL checking
Tobin C. Harding <[email protected]>
btrfs: sysfs: don't leak memory when failing add fsid
Tobin C. Harding <[email protected]>
btrfs: sysfs: Fix error path kobject memory leak
Filipe Manana <[email protected]>
Btrfs: fix race between ranged fsync and writeback of adjacent ranges
Filipe Manana <[email protected]>
Btrfs: avoid fallback to transaction commit during fsync of files with holes
Filipe Manana <[email protected]>
Btrfs: do not abort transaction at btrfs_update_root() after failure to COW path
Josef Bacik <[email protected]>
btrfs: don't double unlock on error in btrfs_punch_hole
Andreas Gruenbacher <[email protected]>
gfs2: Fix sign extension bug in gfs2_update_stats
Christoph Hellwig <[email protected]>
arm64/iommu: handle non-remapped addresses in ->mmap and ->get_sgtable
Ard Biesheuvel <[email protected]>
arm64/kernel: kaslr: reduce module randomization range to 2 GB
Dan Williams <[email protected]>
libnvdimm/pmem: Bypass CONFIG_HARDENED_USERCOPY overhead
Suthikulpanit, Suravee <[email protected]>
kvm: svm/avic: fix off-by-one in checking host APIC ID
Trac Hoang <[email protected]>
mmc: sdhci-iproc: Set NO_HISPD bit to fix HS50 data hold time problem
Trac Hoang <[email protected]>
mmc: sdhci-iproc: cygnus: Set NO_HISPD bit to fix HS50 data hold time problem
Daniel Axtens <[email protected]>
crypto: vmx - CTR: always increment IV as quadword
Martin K. Petersen <[email protected]>
Revert "scsi: sd: Keep disk read-only when re-reading partition"
Andrea Parri <[email protected]>
sbitmap: fix improper use of smp_mb__before_atomic()
Andrea Parri <[email protected]>
bio: fix improper use of smp_mb__before_atomic()
Paolo Bonzini <[email protected]>
KVM: x86: fix return value for reserved EFER
Damien Le Moal <[email protected]>
f2fs: Fix use of number of devices
Jan Kara <[email protected]>
ext4: wait for outstanding dio during truncate in nojournal mode
Jan Kara <[email protected]>
ext4: do not delete unlinked inode from orphan list on failed truncate
Steven Rostedt (VMware) <[email protected]>
x86: Hide the int3_emulate_call/jmp functions from UML
-------------
Diffstat:
Documentation/arm64/silicon-errata.txt | 1 + Documentation/sysctl/net.txt | 8 +++ Makefile | 4 +- arch/arm/include/asm/cp15.h | 2 + arch/arm/vdso/vgettimeofday.c | 5 +- arch/arm64/Kconfig | 18 +++++ arch/arm64/include/asm/cpucaps.h | 3 +- arch/arm64/include/asm/cputype.h | 2 + arch/arm64/include/asm/pgtable.h | 3 +- arch/arm64/include/asm/vdso_datapage.h | 1 + arch/arm64/kernel/asm-offsets.c | 2 +- arch/arm64/kernel/cpu_errata.c | 24 +++++++ arch/arm64/kernel/cpu_ops.c | 1 + arch/arm64/kernel/kaslr.c | 6 +- arch/arm64/kernel/module.c | 2 +- arch/arm64/kernel/syscall.c | 31 +++++++++ arch/arm64/kernel/vdso.c | 3 + arch/arm64/kernel/vdso/gettimeofday.S | 7 +- arch/arm64/mm/dma-mapping.c | 10 +++ arch/arm64/mm/fault.c | 37 +++++++++- arch/powerpc/boot/addnote.c | 6 +- arch/powerpc/kernel/head_64.S | 4 +- arch/powerpc/kernel/watchdog.c | 81 +++++++++++----------- arch/powerpc/mm/numa.c | 18 +++-- arch/powerpc/perf/imc-pmu.c | 7 +- arch/powerpc/platforms/powernv/opal-imc.c | 2 +- arch/s390/kernel/kexec_elf.c | 7 +- arch/s390/mm/pgtable.c | 2 + arch/sh/include/cpu-sh4/cpu/sh7786.h | 2 +- arch/x86/Makefile | 2 +- arch/x86/events/intel/cstate.c | 2 + arch/x86/events/intel/rapl.c | 2 + arch/x86/events/msr.c | 1 + arch/x86/ia32/ia32_signal.c | 29 ++++---- arch/x86/include/asm/text-patching.h | 4 +- arch/x86/kernel/alternative.c | 28 ++++++-- arch/x86/kernel/cpu/mcheck/mce-inject.c | 14 ++-- arch/x86/kernel/cpu/mcheck/mce.c | 66 ++++++++++++------ arch/x86/kernel/cpu/microcode/core.c | 3 +- arch/x86/kernel/irq_64.c | 19 +++-- arch/x86/kernel/module.c | 2 +- arch/x86/kernel/signal.c | 29 ++++---- arch/x86/kernel/vmlinux.lds.S | 6 +- arch/x86/kvm/svm.c | 6 +- arch/x86/kvm/x86.c | 2 +- arch/x86/lib/memcpy_64.S | 3 +- arch/x86/mm/fault.c | 2 - block/genhd.c | 19 +++++ block/partition-generic.c | 7 ++ block/sed-opal.c | 9 ++- drivers/acpi/arm64/iort.c | 19 +++-- drivers/acpi/property.c | 8 +++ drivers/base/power/main.c | 4 ++ drivers/bluetooth/hci_qca.c | 2 + drivers/char/hw_random/omap-rng.c | 1 + drivers/char/random.c | 57 ++++++++------- drivers/char/virtio_console.c | 3 +- drivers/clk/rockchip/clk-rk3288.c | 21 +++--- drivers/cpufreq/cpufreq.c | 1 + drivers/cpufreq/cpufreq_governor.c | 2 + drivers/cpufreq/kirkwood-cpufreq.c | 19 ++--- drivers/cpufreq/pasemi-cpufreq.c | 1 + drivers/cpufreq/pmac32-cpufreq.c | 2 + drivers/cpufreq/ppc_cbe_cpufreq.c | 1 + drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 5 +- drivers/crypto/vmx/aesp8-ppc.pl | 2 +- drivers/dma/at_xdmac.c | 6 +- drivers/dma/pl330.c | 10 ++- drivers/dma/tegra210-adma.c | 28 ++++---- drivers/extcon/extcon-arizona.c | 10 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 24 +++++-- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 6 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c | 20 ++++-- drivers/gpu/drm/drm_drv.c | 5 +- drivers/gpu/drm/drm_file.c | 1 + drivers/gpu/drm/etnaviv/etnaviv_drv.c | 5 ++ drivers/gpu/drm/etnaviv/etnaviv_drv.h | 1 + drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 10 +-- drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c | 12 +++- drivers/gpu/drm/omapdrm/dss/dsi.c | 60 ++++++++-------- drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 3 + drivers/gpu/drm/pl111/pl111_versatile.c | 4 ++ drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 ++- drivers/gpu/drm/tinydrm/ili9225.c | 6 +- drivers/gpu/drm/tinydrm/mipi-dbi.c | 58 +++++++++++----- drivers/gpu/drm/v3d/v3d_drv.c | 8 ++- drivers/gpu/drm/v3d/v3d_drv.h | 2 +- drivers/gpu/drm/v3d/v3d_irq.c | 13 +++- drivers/hid/hid-core.c | 36 ++++++---- drivers/hid/hid-logitech-hidpp.c | 23 ++++-- drivers/hwmon/f71805f.c | 15 +++- drivers/hwmon/pc87427.c | 14 +++- drivers/hwmon/smsc47b397.c | 13 +++- drivers/hwmon/smsc47m1.c | 28 +++++--- drivers/hwmon/vt1211.c | 15 +++- drivers/iio/adc/Kconfig | 1 + drivers/iio/adc/ad_sigma_delta.c | 16 +++-- drivers/iio/adc/ti-ads7950.c | 19 +++-- drivers/iio/common/ssp_sensors/ssp_iio.c | 2 +- drivers/iio/magnetometer/hmc5843_i2c.c | 7 +- drivers/iio/magnetometer/hmc5843_spi.c | 7 +- drivers/infiniband/core/cma.c | 25 +++++-- drivers/infiniband/hw/cxgb4/cm.c | 2 + drivers/infiniband/hw/hfi1/init.c | 3 +- drivers/infiniband/hw/hns/hns_roce_ah.c | 2 +- drivers/md/bcache/alloc.c | 5 +- drivers/md/bcache/journal.c | 26 ++++++- drivers/md/bcache/super.c | 25 +++++-- drivers/media/common/videobuf2/videobuf2-core.c | 22 ++++++ drivers/media/dvb-frontends/m88ds3103.c | 9 ++- drivers/media/dvb-frontends/si2165.c | 8 ++- drivers/media/i2c/ov2659.c | 6 +- drivers/media/i2c/ov6650.c | 25 ++++--- drivers/media/pci/saa7146/hexium_gemini.c | 5 +- drivers/media/pci/saa7146/hexium_orion.c | 5 +- drivers/media/platform/coda/coda-bit.c | 3 + drivers/media/platform/stm32/stm32-dcmi.c | 20 ++++-- drivers/media/platform/video-mux.c | 5 ++ drivers/media/platform/vimc/vimc-core.c | 2 + drivers/media/platform/vimc/vimc-streamer.c | 2 +- drivers/media/platform/vivid/vivid-vid-cap.c | 2 +- drivers/media/radio/wl128x/fmdrv_common.c | 7 +- drivers/media/rc/serial_ir.c | 9 +-- drivers/media/usb/au0828/au0828-video.c | 16 +++-- drivers/media/usb/cpia2/cpia2_v4l.c | 3 +- drivers/media/usb/dvb-usb-v2/dvbsky.c | 18 ++--- drivers/media/usb/go7007/go7007-fw.c | 4 +- drivers/media/usb/gspca/gspca.c | 12 +++- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 2 + drivers/media/usb/pvrusb2/pvrusb2-hdw.h | 1 + drivers/mmc/core/pwrseq_emmc.c | 38 +++++----- drivers/mmc/core/sd.c | 8 +++ drivers/mmc/host/mmc_spi.c | 4 ++ drivers/mmc/host/sdhci-iproc.c | 6 +- drivers/mmc/host/sdhci-of-esdhc.c | 8 +++ drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +- drivers/net/ethernet/chelsio/cxgb3/l2t.h | 2 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 15 +++- drivers/net/ethernet/intel/e1000e/netdev.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 8 +++ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 +- drivers/net/ethernet/intel/igb/igb_main.c | 3 + drivers/net/hyperv/netvsc.c | 15 ++-- drivers/net/usb/qmi_wwan.c | 65 +++++++++-------- drivers/net/wireless/ath/wil6210/cfg80211.c | 5 ++ drivers/net/wireless/ath/wil6210/wmi.c | 11 +-- drivers/net/wireless/atmel/at76c50x-usb.c | 4 +- drivers/net/wireless/broadcom/b43/phy_lp.c | 6 +- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 6 ++ .../wireless/broadcom/brcm80211/brcmfmac/core.c | 15 ++-- .../wireless/broadcom/brcm80211/brcmfmac/fweh.h | 16 +++-- .../broadcom/brcm80211/brcmfmac/fwsignal.c | 42 ++++++----- .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 +- .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 27 +++++--- .../wireless/broadcom/brcm80211/brcmfmac/vendor.c | 5 +- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 7 +- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 6 +- drivers/net/wireless/marvell/mwifiex/cfp.c | 3 + drivers/net/wireless/realtek/rtlwifi/base.c | 5 ++ .../net/wireless/realtek/rtlwifi/rtl8188ee/fw.c | 2 + .../wireless/realtek/rtlwifi/rtl8192c/fw_common.c | 2 + .../net/wireless/realtek/rtlwifi/rtl8192ee/fw.c | 2 + .../net/wireless/realtek/rtlwifi/rtl8723ae/fw.c | 2 + .../net/wireless/realtek/rtlwifi/rtl8723be/fw.c | 2 + .../net/wireless/realtek/rtlwifi/rtl8821ae/fw.c | 4 ++ drivers/net/wireless/rsi/rsi_91x_mac80211.c | 30 ++++---- drivers/net/wireless/st/cw1200/main.c | 5 ++ drivers/nvdimm/pmem.c | 10 ++- drivers/nvme/host/core.c | 7 +- drivers/nvme/host/rdma.c | 10 +-- drivers/perf/arm-cci.c | 21 +++--- drivers/phy/allwinner/phy-sun4i-usb.c | 4 ++ drivers/phy/motorola/Kconfig | 2 +- drivers/pinctrl/pinctrl-pistachio.c | 2 + drivers/pinctrl/samsung/pinctrl-exynos-arm.c | 1 + drivers/pinctrl/zte/pinctrl-zx.c | 1 + drivers/rtc/rtc-88pm860x.c | 2 +- drivers/rtc/rtc-stm32.c | 9 ++- drivers/rtc/rtc-xgene.c | 18 +++-- drivers/s390/cio/cio.h | 2 +- drivers/s390/cio/vfio_ccw_drv.c | 32 +++++---- drivers/s390/cio/vfio_ccw_ops.c | 11 ++- drivers/s390/crypto/zcrypt_api.c | 4 ++ drivers/s390/net/qeth_core.h | 10 ++- drivers/s390/net/qeth_core_main.c | 14 ++-- drivers/scsi/libsas/sas_expander.c | 5 ++ drivers/scsi/lpfc/lpfc_ct.c | 20 ++++-- drivers/scsi/lpfc/lpfc_hbadisc.c | 11 ++- drivers/scsi/lpfc/lpfc_nvme.c | 8 +-- drivers/scsi/qedf/qedf_io.c | 1 + drivers/scsi/qedi/qedi_iscsi.c | 3 + drivers/scsi/qla2xxx/qla_isr.c | 6 +- drivers/scsi/qla2xxx/qla_target.c | 25 +++---- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 7 +- drivers/scsi/qla4xxx/ql4_os.c | 2 +- drivers/scsi/sd.c | 3 +- drivers/scsi/ufs/ufs-hisi.c | 4 ++ drivers/scsi/ufs/ufshcd.c | 28 +++++--- drivers/slimbus/qcom-ngd-ctrl.c | 4 ++ drivers/spi/spi-imx.c | 2 +- drivers/spi/spi-pxa2xx.c | 8 ++- drivers/spi/spi-rspi.c | 9 ++- drivers/spi/spi-tegra114.c | 32 +++++---- drivers/spi/spi-topcliff-pch.c | 15 +++- drivers/spi/spi.c | 2 + drivers/ssb/bridge_pcmcia_80211.c | 9 ++- drivers/staging/media/davinci_vpfe/Kconfig | 2 +- .../interface/vchiq_arm/vchiq_2835_arm.c | 3 + .../vc04_services/interface/vchiq_arm/vchiq_core.c | 2 + drivers/thunderbolt/icm.c | 5 ++ drivers/thunderbolt/property.c | 12 +++- drivers/thunderbolt/switch.c | 67 +++++++++--------- drivers/thunderbolt/tb.h | 3 +- drivers/thunderbolt/xdomain.c | 8 ++- drivers/tty/ipwireless/main.c | 8 +++ drivers/usb/core/hcd.c | 3 + drivers/usb/core/hub.c | 5 +- drivers/usb/dwc2/gadget.c | 27 ++++---- drivers/usb/dwc3/core.c | 2 + drivers/usb/dwc3/gadget.c | 2 - drivers/video/fbdev/core/fbcmap.c | 2 + drivers/video/fbdev/core/modedb.c | 3 + drivers/video/fbdev/efifb.c | 3 +- drivers/video/fbdev/udlfb.c | 14 ++-- drivers/w1/w1_io.c | 3 +- fs/btrfs/backref.c | 19 +++-- fs/btrfs/extent-tree.c | 28 ++------ fs/btrfs/file.c | 19 +++-- fs/btrfs/relocation.c | 31 ++++++--- fs/btrfs/root-tree.c | 17 ++--- fs/btrfs/sysfs.c | 7 +- fs/btrfs/tree-log.c | 1 + fs/char_dev.c | 6 ++ fs/ext4/inode.c | 23 +++--- fs/f2fs/data.c | 17 +++-- fs/f2fs/f2fs.h | 13 +++- fs/f2fs/file.c | 2 +- fs/f2fs/gc.c | 2 +- fs/f2fs/segment.c | 13 ++-- fs/gfs2/glock.c | 23 +++--- fs/gfs2/lock_dlm.c | 9 +-- fs/gfs2/log.c | 3 +- fs/gfs2/lops.c | 6 +- fs/internal.h | 2 - fs/nfs/client.c | 7 +- fs/nfs/nfs42proc.c | 3 - fs/nfs/nfs4file.c | 12 ++-- fs/overlayfs/dir.c | 2 +- fs/overlayfs/inode.c | 3 +- include/drm/tinydrm/mipi-dbi.h | 5 +- include/linux/bio.h | 2 +- include/linux/cgroup-defs.h | 5 ++ include/linux/filter.h | 2 + include/linux/genhd.h | 1 + include/linux/hid.h | 1 + include/linux/iio/adc/ad_sigma_delta.h | 1 + include/linux/mount.h | 2 + include/linux/overflow.h | 12 +++- include/linux/smpboot.h | 2 +- include/linux/time64.h | 21 ++++++ include/media/videobuf2-core.h | 1 + include/net/bluetooth/hci.h | 1 + kernel/acct.c | 4 +- kernel/auditfilter.c | 12 ++-- kernel/bpf/core.c | 49 ++++++++++++- kernel/bpf/devmap.c | 3 + kernel/cgroup/cgroup.c | 6 ++ kernel/irq_work.c | 75 +++++++++++--------- kernel/module.c | 5 ++ kernel/rcu/rcuperf.c | 5 ++ kernel/rcu/rcutorture.c | 5 ++ kernel/sched/core.c | 9 ++- kernel/sched/fair.c | 16 +++-- kernel/sched/rt.c | 5 ++ kernel/time/time.c | 2 +- kernel/time/timekeeping.c | 6 +- kernel/trace/trace_branch.c | 4 ++ lib/kobject_uevent.c | 11 +-- lib/sbitmap.c | 2 +- lib/strncpy_from_user.c | 5 +- lib/strnlen_user.c | 4 +- net/batman-adv/distributed-arp-table.c | 4 +- net/batman-adv/main.c | 1 + net/batman-adv/multicast.c | 11 +-- net/batman-adv/types.h | 5 ++ net/bluetooth/hci_core.c | 5 ++ net/bluetooth/hci_event.c | 12 ++++ net/bluetooth/hci_request.c | 5 ++ net/bluetooth/hci_request.h | 1 + net/core/sysctl_net_core.c | 10 ++- net/mac80211/mlme.c | 3 - net/wireless/nl80211.c | 5 ++ security/selinux/netlabel.c | 14 ++-- sound/soc/codecs/hdmi-codec.c | 6 +- sound/soc/davinci/davinci-mcasp.c | 2 + sound/soc/fsl/Kconfig | 9 +-- sound/soc/fsl/eukrea-tlv320.c | 4 +- sound/soc/fsl/fsl_sai.c | 2 + sound/soc/fsl/fsl_utils.c | 1 + sound/soc/intel/boards/kbl_da7219_max98357a.c | 2 +- tools/bpf/bpftool/.gitignore | 2 +- tools/lib/bpf/bpf.c | 2 + tools/lib/bpf/bpf.h | 1 + tools/testing/selftests/bpf/test_libbpf_open.c | 2 + tools/testing/selftests/bpf/trace_helpers.c | 4 ++ tools/testing/selftests/cgroup/test_memcontrol.c | 38 +++++----- 307 files changed, 2130 insertions(+), 977 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 41/276 at76c50x-usb: Dont register led_trigger if usb_register_driver failed
From: YueHaibing <[email protected]>
commit 09ac2694b0475f96be895848687ebcbba97eeecf upstream.
Syzkaller report this:
[ 1213.468581] BUG: unable to handle kernel paging request at fffffbfff83bf338 [ 1213.469530] #PF error: [normal kernel read fault] [ 1213.469530] PGD 237fe4067 P4D 237fe4067 PUD 237e60067 PMD 1c868b067 PTE 0 [ 1213.473514] Oops: 0000 [#1] SMP KASAN PTI [ 1213.473514] CPU: 0 PID: 6321 Comm: syz-executor.0 Tainted: G C 5.1.0-rc3+ #8 [ 1213.473514] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 [ 1213.473514] RIP: 0010:strcmp+0x31/0xa0 [ 1213.473514] Code: 00 00 00 00 fc ff df 55 53 48 83 ec 08 eb 0a 84 db 48 89 ef 74 5a 4c 89 e6 48 89 f8 48 89 fa 48 8d 6f 01 48 c1 e8 03 83 e2 07 <42> 0f b6 04 28 38 d0 7f 04 84 c0 75 50 48 89 f0 48 89 f2 0f b6 5d [ 1213.473514] RSP: 0018:ffff8881f2b7f950 EFLAGS: 00010246 [ 1213.473514] RAX: 1ffffffff83bf338 RBX: ffff8881ea6f7240 RCX: ffffffff825350c6 [ 1213.473514] RDX: 0000000000000000 RSI: ffffffffc1ee19c0 RDI: ffffffffc1df99c0 [ 1213.473514] RBP: ffffffffc1df99c1 R08: 0000000000000001 R09: 0000000000000004 [ 1213.473514] R10: 0000000000000000 R11: ffff8881de353f00 R12: ffff8881ee727900 [ 1213.473514] R13: dffffc0000000000 R14: 0000000000000001 R15: ffffffffc1eeaaf0 [ 1213.473514] FS: 00007fa66fa01700(0000) GS:ffff8881f7200000(0000) knlGS:0000000000000000 [ 1213.473514] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1213.473514] CR2: fffffbfff83bf338 CR3: 00000001ebb9e005 CR4: 00000000007606f0 [ 1213.473514] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1213.473514] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 1213.473514] PKRU: 55555554 [ 1213.473514] Call Trace: [ 1213.473514] led_trigger_register+0x112/0x3f0 [ 1213.473514] led_trigger_register_simple+0x7a/0x110 [ 1213.473514] ? 0xffffffffc1c10000 [ 1213.473514] at76_mod_init+0x77/0x1000 [at76c50x_usb] [ 1213.473514] do_one_initcall+0xbc/0x47d [ 1213.473514] ? perf_trace_initcall_level+0x3a0/0x3a0 [ 1213.473514] ? kasan_unpoison_shadow+0x30/0x40 [ 1213.473514] ? kasan_unpoison_shadow+0x30/0x40 [ 1213.473514] do_init_module+0x1b5/0x547 [ 1213.473514] load_module+0x6405/0x8c10 [ 1213.473514] ? module_frob_arch_sections+0x20/0x20 [ 1213.473514] ? kernel_read_file+0x1e6/0x5d0 [ 1213.473514] ? find_held_lock+0x32/0x1c0 [ 1213.473514] ? cap_capable+0x1ae/0x210 [ 1213.473514] ? __do_sys_finit_module+0x162/0x190 [ 1213.473514] __do_sys_finit_module+0x162/0x190 [ 1213.473514] ? __ia32_sys_init_module+0xa0/0xa0 [ 1213.473514] ? __mutex_unlock_slowpath+0xdc/0x690 [ 1213.473514] ? wait_for_completion+0x370/0x370 [ 1213.473514] ? vfs_write+0x204/0x4a0 [ 1213.473514] ? do_syscall_64+0x18/0x450 [ 1213.473514] do_syscall_64+0x9f/0x450 [ 1213.473514] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 1213.473514] RIP: 0033:0x462e99 [ 1213.473514] Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 [ 1213.473514] RSP: 002b:00007fa66fa00c58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 1213.473514] RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99 [ 1213.473514] RDX: 0000000000000000 RSI: 0000000020000300 RDI: 0000000000000003 [ 1213.473514] RBP: 00007fa66fa00c70 R08: 0000000000000000 R09: 0000000000000000 [ 1213.473514] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fa66fa016bc [ 1213.473514] R13: 00000000004bcefa R14: 00000000006f6fb0 R15: 0000000000000004
If usb_register failed, no need to call led_trigger_register_simple.
--- drivers/net/wireless/atmel/at76c50x-usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/atmel/at76c50x-usb.c +2 -2
@@ -2585,8 +2585,8 @@ static int __init at76_mod_init(void)if (result <0 ) printk(KERN_ERR DRIVER_NAME": usb_register failed (status %d)\n" , result); - -led_trigger_register_simple ("at76_usb-tx" , &ledtrig_tx); +else +led_trigger_register_simple ("at76_usb-tx" , &ledtrig_tx);return result; }
Greg Kroah-Hartman
maintainerPATCH 44/276 gfs2: Fix lru_count going negative
In reply to Greg Kroah-Hartman[ Upstream commit 7881ef3f33bb80f459ea6020d1e021fc524a6348 ]
Under certain conditions, lru_count may drop below zero resulting in a large amount of log spam like this:
vmscan: shrink_slab: gfs2_dump_glock+0x3b0/0x630 [gfs2] \
negative objects to delete nr=-1
This happens as follows:
1) A glock is moved from lru_list to the dispose list and lru_count is decremented.
2) The dispose function calls cond_resched() and drops the lru lock.
3) Another thread takes the lru lock and tries to add the same glock to lru_list, checking if the glock is on an lru list.
4) It is on a list (actually the dispose list) and so it avoids incrementing lru_count.
5) The glock is moved to lru_list.
5) The original thread doesn't dispose it because it has been re-added to the lru list but the lru_count has still decreased by one.
Fix by checking if the LRU flag is set on the glock rather than checking if the glock is on some list and rearrange the code so that the LRU flag is added/removed precisely when the glock is added/removed from lru_list.
--- fs/gfs2/glock.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
fs/gfs2/glock.c +13 -9
@@ -183,15 +183,19 @@ static int demote_ok(const struct gfs2_glock *gl)void gfs2_glock_add_to_lru (struct gfs2_glock *gl) { +if (!(gl->gl_ops->go_flags &GLOF_LRU )) +return ; +spin_lock (&lru_lock); -if (!list_empty (&gl->gl_lru)) -list_del_init (&gl->gl_lru); -else +list_del (&gl->gl_lru); +list_add_tail (&gl->gl_lru, &lru_list); + +if (!test_bit (GLF_LRU , &gl->gl_flags)) { +set_bit (GLF_LRU , &gl->gl_flags);atomic_inc (&lru_count); + } -list_add_tail (&gl->gl_lru, &lru_list); -set_bit (GLF_LRU , &gl->gl_flags);spin_unlock (&lru_lock); }
@@ -201,7 +205,7 @@ static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl)return ;spin_lock (&lru_lock); -if (!list_empty (&gl->gl_lru)) { +if (test_bit (GLF_LRU , &gl->gl_flags)) {list_del_init (&gl->gl_lru);atomic_dec (&lru_count);clear_bit (GLF_LRU , &gl->gl_flags);
@@ -1158,8 +1162,7 @@ void gfs2_glock_dq(struct gfs2_holder *gh) !test_bit(GLF_DEMOTE, &gl->gl_flags)) fast_path =1 ; } -if (!test_bit (GLF_LFLUSH , &gl->gl_flags) &&demote_ok (gl) && - (glops->go_flags &GLOF_LRU )) +if (!test_bit (GLF_LFLUSH , &gl->gl_flags) &&demote_ok (gl))gfs2_glock_add_to_lru (gl);trace_gfs2_glock_queue (gh,0 );
@@ -1455,6 +1458,7 @@ __acquires(&lru_lock)if (!spin_trylock (&gl->gl_lockref.lock)) { add_back_to_lru:list_add (&gl->gl_lru, &lru_list); +set_bit (GLF_LRU , &gl->gl_flags);atomic_inc (&lru_count);continue ; }
@@ -1462,7 +1466,6 @@ __acquires(&lru_lock)spin_unlock (&gl->gl_lockref.lock); goto add_back_to_lru; } -clear_bit (GLF_LRU , &gl->gl_flags); gl->gl_lockref.count++;if (demote_ok (gl))handle_callback (gl,LM_ST_UNLOCKED ,0 , false);
@@ -1497,6 +1500,7 @@ static long gfs2_scan_glock_lru(int nr)if (!test_bit (GLF_LOCK , &gl->gl_flags)) {list_move (&gl->gl_lru, &dispose);atomic_dec (&lru_count); +clear_bit (GLF_LRU , &gl->gl_flags); freed++;continue ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 47/276 IB/hfi1: Fix WQ_MEM_RECLAIM warning
In reply to Greg Kroah-Hartman[ Upstream commit 4c4b1996b5db688e2dcb8242b0a3bf7b1e845e42 ]
The work_item cancels that occur when a QP is destroyed can elicit the following trace:
workqueue: WQ_MEM_RECLAIM ipoib_wq:ipoib_cm_tx_reap [ib_ipoib] is flushing !WQ_MEM_RECLAIM hfi0_0:_hfi1_do_send [hfi1]
WARNING: CPU: 7 PID: 1403 at kernel/workqueue.c:2486 check_flush_dependency+0xb1/0x100 Call Trace: __flush_work.isra.29+0x8c/0x1a0 ? __switch_to_asm+0x40/0x70 __cancel_work_timer+0x103/0x190 ? schedule+0x32/0x80 iowait_cancel_work+0x15/0x30 [hfi1] rvt_reset_qp+0x1f8/0x3e0 [rdmavt] rvt_destroy_qp+0x65/0x1f0 [rdmavt] ? _cond_resched+0x15/0x30 ib_destroy_qp+0xe9/0x230 [ib_core] ipoib_cm_tx_reap+0x21c/0x560 [ib_ipoib] process_one_work+0x171/0x370 worker_thread+0x49/0x3f0 kthread+0xf8/0x130 ? max_active_store+0x80/0x80 ? kthread_bind+0x10/0x10 ret_from_fork+0x35/0x40
Since QP destruction frees memory, hfi1_wq should have the WQ_MEM_RECLAIM.
The hfi1_wq does not allocate memory with GFP_KERNEL or otherwise become entangled with memory reclaim, so this flag is appropriate.
--- drivers/infiniband/hw/hfi1/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/init.c +2 -1
@@ -798,7 +798,8 @@ static int create_workqueues(struct hfi1_devdata *dd) ppd->hfi1_wq =alloc_workqueue ("hfi%d_%d" , -WQ_SYSFS |WQ_HIGHPRI |WQ_CPU_INTENSIVE , +WQ_SYSFS |WQ_HIGHPRI |WQ_CPU_INTENSIVE | +WQ_MEM_RECLAIM ,HFI1_MAX_ACTIVE_WORKQUEUE_ENTRIES , dd->unit, pidx);if (!ppd->hfi1_wq)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 48/276 gfs2: Fix occasional glock use-after-free
In reply to Greg Kroah-Hartman[ Upstream commit 9287c6452d2b1f24ea8e84bd3cf6f3c6f267f712 ]
This patch has to do with the life cycle of glocks and buffers. When gfs2 metadata or journaled data is queued to be written, a gfs2_bufdata object is assigned to track the buffer, and that is queued to various lists, including the glock's gl_ail_list to indicate it's on the active items list. Once the page associated with the buffer has been written, it is removed from the ail list, but its life isn't over until a revoke has been successfully written.
So after the block is written, its bufdata object is moved from the glock's gl_ail_list to a file-system-wide list of pending revokes, sd_log_le_revoke. At that point the glock still needs to track how many revokes it contributed to that list (in gl_revokes) so that things like glock go_sync can ensure all the metadata has been not only written, but also revoked before the glock is granted to a different node. This is to guarantee journal replay doesn't replay the block once the glock has been granted to another node.
Ross Lagerwall recently discovered a race in which an inode could be evicted, and its glock freed after its ail list had been synced, but while it still had unwritten revokes on the sd_log_le_revoke list. The evict decremented the glock reference count to zero, which allowed the glock to be freed. After the revoke was written, function revoke_lo_after_commit tried to adjust the glock's gl_revokes counter and clear its GLF_LFLUSH flag, at which time it referenced the freed glock.
This patch fixes the problem by incrementing the glock reference count in gfs2_add_revoke when the glock's first bufdata object is moved from the glock to the global revokes list. Later, when the glock's last such bufdata object is freed, the reference count is decremented. This guarantees that whichever process finishes last (the revoke writing or the evict) will properly free the glock, and neither will reference the glock after it has been freed.
--- fs/gfs2/glock.c | 1 + fs/gfs2/log.c | 3 ++- fs/gfs2/lops.c | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-)
fs/gfs2/glock.c +1 -0
@@ -140,6 +140,7 @@ void gfs2_glock_free(struct gfs2_glock *gl) {struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; +BUG_ON (atomic_read (&gl->gl_revokes));rhashtable_remove_fast (&gl_hash_table, &gl->gl_node, ht_parms);smp_mb ();wake_up_glock (gl);
fs/gfs2/log.c +2 -1
@@ -604,7 +604,8 @@ void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) bd->bd_bh =NULL ; bd->bd_ops = &gfs2_revoke_lops; sdp->sd_log_num_revoke++; -atomic_inc (&gl->gl_revokes); +if (atomic_inc_return (&gl->gl_revokes) ==1 ) +gfs2_glock_hold (gl);set_bit (GLF_LFLUSH , &gl->gl_flags);list_add (&bd->bd_list, &sdp->sd_log_le_revoke); }
fs/gfs2/lops.c +4 -2
@@ -662,8 +662,10 @@ static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) bd = list_entry(head->next, struct gfs2_bufdata, bd_list);list_del_init (&bd->bd_list); gl = bd->bd_gl; -atomic_dec (&gl->gl_revokes); -clear_bit (GLF_LFLUSH , &gl->gl_flags); +if (atomic_dec_return (&gl->gl_revokes) ==0 ) { +clear_bit (GLF_LFLUSH , &gl->gl_flags); +gfs2_glock_queue_put (gl); + }kmem_cache_free (gfs2_bufdata_cachep, bd); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 51/276 selftests/bpf: set RLIMIT_MEMLOCK properly for test_libbpf_open.c
In reply to Greg Kroah-Hartman[ Upstream commit 6cea33701eb024bc6c920ab83940ee22afd29139 ]
Test test_libbpf.sh failed on my development server with failure
-bash-4.4$ sudo ./test_libbpf.sh
[0] libbpf: Error in bpf_object__probe_name():Operation not permitted(1). Couldn't load basic 'r0 = 0' BPF program.
test_libbpf: failed at file test_l4lb.o
selftests: test_libbpf [FAILED]
-bash-4.4$
The reason is because my machine has 64KB locked memory by default which is not enough for this program to get locked memory.
Similar to other bpf selftests, let us increase RLIMIT_MEMLOCK to infinity, which fixed the issue.
--- tools/testing/selftests/bpf/test_libbpf_open.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/bpf/test_libbpf_open.c +2 -0
@@ -11,6 +11,8 @@ static const char *__doc__ =#include <bpf/libbpf.h> #include <getopt.h> +#include "bpf_rlimit.h" +static const struct option long_options[] = { {"help" , no_argument,NULL ,'h' }, {"debug" , no_argument,NULL ,'D' },
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 54/276 net: ena: gcc 8: fix compilation warning
In reply to Greg Kroah-Hartman[ Upstream commit f913308879bc6ae437ce64d878c7b05643ddea44 ]
GCC 8 contains a number of new warnings as well as enhancements to existing checkers. The warning - Wstringop-truncation - warns for calls to bounded string manipulation functions such as strncat, strncpy, and stpncpy that may either truncate the copied string or leave the destination unchanged.
In our case the destination string length (32 bytes) is much shorter than the source string (64 bytes) which causes this warning to show up. In general the destination has to be at least a byte larger than the length of the source string with strncpy for this warning not to showup.
This can be easily fixed by using strlcpy instead which already does the truncation to the string. Documentation for this function can be found here:
https://elixir.bootlin.com/linux/latest/source/lib/string.c#L141
--- drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +1 -1
@@ -2223,7 +2223,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev) host_info->os_type =ENA_ADMIN_OS_LINUX ; host_info->kernel_ver =LINUX_VERSION_CODE ; -strncpy (host_info->kernel_ver_str,utsname ()->version, +strlcpy (host_info->kernel_ver_str,utsname ()->version,sizeof (host_info->kernel_ver_str) -1 ); host_info->os_dist =0 ; strncpy(host_info->os_dist_str, utsname()->release,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 56/276 Bluetooth: Ignore CC events not matching the last HCI command
In reply to Greg Kroah-Hartman[ Upstream commit f80c5dad7b6467b884c445ffea45985793b4b2d0 ]
This commit makes the kernel not send the next queued HCI command until a command complete arrives for the last HCI command sent to the controller. This change avoids a problem with some buggy controllers (seen on two SKUs of QCA9377) that send an extra command complete event for the previous command after the kernel had already sent a new HCI command to the controller.
The problem was reproduced when starting an active scanning procedure, where an extra command complete event arrives for the LE_SET_RANDOM_ADDR command. When this happends the kernel ends up not processing the command complete for the following commmand, LE_SET_SCAN_PARAM, and ultimately behaving as if a passive scanning procedure was being performed, when in fact controller is performing an active scanning procedure. This makes it impossible to discover BLE devices as no device found events are sent to userspace.
This problem is reproducible on 100% of the attempts on the affected controllers. The extra command complete event can be seen at timestamp 27.420131 on the btmon logs bellow.
Bluetooth monitor ver 5.50
= Note: Linux version 5.0.0+ (x86_64) 0.352340
= Note: Bluetooth subsystem version 2.22 0.352343
= New Index: 80:C5:F2:8F:87:84 (Primary,USB,hci0) [hci0] 0.352344 = Open Index: 80:C5:F2:8F:87:84 [hci0] 0.352345 = Index Info: 80:C5:F2:8F:87:84 (Qualcomm) [hci0] 0.352346
@ MGMT Open: bluetoothd (privileged) version 1.14 {0x0001} 0.352347
@ MGMT Open: btmon (privileged) version 1.14 {0x0002} 0.352366
@ MGMT Open: btmgmt (privileged) version 1.14 {0x0003} 27.302164
@ MGMT Command: Start Discovery (0x0023) plen 1 {0x0003} [hci0] 27.302310
Address type: 0x06
LE Public
LE Random
< HCI Command: LE Set Random Address (0x08|0x0005) plen 6 #1 [hci0] 27.302496
Address: 15:60:F2:91:B2:24 (Non-Resolvable)Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 4 #2 [hci0] 27.419117
LE Set Random Address (0x08|0x0005) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7 #3 [hci0] 27.419244
Type: Active (0x01)
Interval: 11.250 msec (0x0012)
Window: 11.250 msec (0x0012)
Own address type: Random (0x01)
Filter policy: Accept all advertisement (0x00)Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 4 #4 [hci0] 27.420131
LE Set Random Address (0x08|0x0005) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 #5 [hci0] 27.420259
Scanning: Enabled (0x01)
Filter duplicates: Enabled (0x01)Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 4 #6 [hci0] 27.420969
LE Set Scan Parameters (0x08|0x000b) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 4 #7 [hci0] 27.421983
LE Set Scan Enable (0x08|0x000c) ncmd 1
Status: Success (0x00)
@ MGMT Event: Command Complete (0x0001) plen 4 {0x0003} [hci0] 27.422059
Start Discovery (0x0023) plen 1
Status: Success (0x00)
Address type: 0x06
LE Public
LE Random
@ MGMT Event: Discovering (0x0013) plen 2 {0x0003} [hci0] 27.422067
Address type: 0x06
LE Public
LE Random
Discovery: Enabled (0x01)
@ MGMT Event: Discovering (0x0013) plen 2 {0x0002} [hci0] 27.422067
Address type: 0x06
LE Public
LE Random
Discovery: Enabled (0x01)
@ MGMT Event: Discovering (0x0013) plen 2 {0x0001} [hci0] 27.422067
Address type: 0x06
LE Public
LE Random
Discovery: Enabled (0x01)--- include/net/bluetooth/hci.h | 1 + net/bluetooth/hci_core.c | 5 +++++ net/bluetooth/hci_event.c | 12 ++++++++++++ net/bluetooth/hci_request.c | 5 +++++ net/bluetooth/hci_request.h | 1 + 5 files changed, 24 insertions(+)
include/net/bluetooth/hci.h +1 -0
@@ -270,6 +270,7 @@ enum {HCI_FORCE_BREDR_SMP ,HCI_FORCE_STATIC_ADDR ,HCI_LL_RPA_RESOLUTION , +HCI_CMD_PENDING , __HCI_NUM_FLAGS, };
net/bluetooth/hci_core.c +5 -0
@@ -4274,6 +4274,9 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status,return ; } +/* If we reach this point this event matches the last command sent */ +hci_dev_clear_flag (hdev,HCI_CMD_PENDING ); +/* If the command succeeded and there's still more commands in * this request the request is not yet complete. */
@@ -4384,6 +4387,8 @@ static void hci_cmd_work(struct work_struct *work) hdev->sent_cmd =skb_clone (skb,GFP_KERNEL );if (hdev->sent_cmd) { +if (hci_req_status_pend (hdev)) +hci_dev_set_flag (hdev,HCI_CMD_PENDING );atomic_dec (&hdev->cmd_cnt);hci_send_frame (hdev, skb);if (test_bit (HCI_RESET , &hdev->flags))
net/bluetooth/hci_event.c +12 -0
@@ -3357,6 +3357,12 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb,hci_req_cmd_complete (hdev, *opcode, *status, req_complete, req_complete_skb); +if (hci_dev_test_flag (hdev,HCI_CMD_PENDING )) { +bt_dev_err (hdev, +"unexpected event for opcode 0x%4.4x" , *opcode); +return ; + } +if (atomic_read (&hdev->cmd_cnt) && !skb_queue_empty (&hdev->cmd_q))queue_work (hdev->workqueue, &hdev->cmd_work); }
@@ -3464,6 +3470,12 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb,hci_req_cmd_complete (hdev, *opcode, ev->status, req_complete, req_complete_skb); +if (hci_dev_test_flag (hdev,HCI_CMD_PENDING )) { +bt_dev_err (hdev, +"unexpected event for opcode 0x%4.4x" , *opcode); +return ; + } +if (atomic_read (&hdev->cmd_cnt) && !skb_queue_empty (&hdev->cmd_q))queue_work (hdev->workqueue, &hdev->cmd_work); }
net/bluetooth/hci_request.c +5 -0
@@ -46,6 +46,11 @@ void hci_req_purge(struct hci_request *req)skb_queue_purge (&req->cmd_q); } +bool hci_req_status_pend (struct hci_dev *hdev) +{ +return hdev->req_status ==HCI_REQ_PEND ; +} +static int req_run (struct hci_request *req,hci_req_complete_t complete,hci_req_complete_skb_t complete_skb) {
net/bluetooth/hci_request.h +1 -0
@@ -37,6 +37,7 @@ struct hci_request {void hci_req_init (struct hci_request *req,struct hci_dev *hdev);void hci_req_purge (struct hci_request *req); +bool hci_req_status_pend (struct hci_dev *hdev);int hci_req_run (struct hci_request *req,hci_req_complete_t complete);int hci_req_run_skb (struct hci_request *req,hci_req_complete_skb_t complete); void hci_req_add(struct hci_request *req, u16 opcode, u32 plen,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 59/276 usb: dwc2: gadget: Increase descriptors count for ISOCs
In reply to Greg Kroah-Hartman[ Upstream commit 54f37f56631747075f1f9a2f0edf6ba405e3e66c ]
Some function drivers queueing more than 128 ISOC requests at a time. To avoid "descriptor chain full" cases, increasing descriptors count from MAX_DMA_DESC_NUM_GENERIC to MAX_DMA_DESC_NUM_HS_ISOC for ISOC's only.
--- drivers/usb/dwc2/gadget.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/usb/dwc2/gadget.c +15 -12
@@ -675,13 +675,11 @@ static unsigned int dwc2_gadget_get_chain_limit(struct dwc2_hsotg_ep *hs_ep)unsigned int maxsize;if (is_isoc) - maxsize = hs_ep->dir_in ?DEV_DMA_ISOC_TX_NBYTES_LIMIT : -DEV_DMA_ISOC_RX_NBYTES_LIMIT ; + maxsize = (hs_ep->dir_in ?DEV_DMA_ISOC_TX_NBYTES_LIMIT : +DEV_DMA_ISOC_RX_NBYTES_LIMIT ) * +MAX_DMA_DESC_NUM_HS_ISOC ;else - maxsize =DEV_DMA_NBYTES_LIMIT ; - -/* Above size of one descriptor was chosen, multiple it */ - maxsize *=MAX_DMA_DESC_NUM_GENERIC ; + maxsize =DEV_DMA_NBYTES_LIMIT *MAX_DMA_DESC_NUM_GENERIC ;return maxsize; }
@@ -864,7 +862,7 @@ static int dwc2_gadget_fill_isoc_desc(struct dwc2_hsotg_ep *hs_ep,/* Update index of last configured entry in the chain */ hs_ep->next_desc++; -if (hs_ep->next_desc >=MAX_DMA_DESC_NUM_GENERIC ) +if (hs_ep->next_desc >=MAX_DMA_DESC_NUM_HS_ISOC ) hs_ep->next_desc =0 ;return 0 ;
@@ -896,7 +894,7 @@ static void dwc2_gadget_start_isoc_ddma(struct dwc2_hsotg_ep *hs_ep) }/* Initialize descriptor chain by Host Busy status */ -for (i =0 ; i <MAX_DMA_DESC_NUM_GENERIC ; i++) { +for (i =0 ; i <MAX_DMA_DESC_NUM_HS_ISOC ; i++) { desc = &hs_ep->desc_list[i]; desc->status =0 ; desc->status |= (DEV_DMA_BUFF_STS_HBUSY
@@ -2083,7 +2081,7 @@ static void dwc2_gadget_complete_isoc_request_ddma(struct dwc2_hsotg_ep *hs_ep)dwc2_hsotg_complete_request (hsotg, hs_ep, hs_req,0 ); hs_ep->compl_desc++; -if (hs_ep->compl_desc > (MAX_DMA_DESC_NUM_GENERIC -1 )) +if (hs_ep->compl_desc > (MAX_DMA_DESC_NUM_HS_ISOC -1 )) hs_ep->compl_desc =0 ; desc_sts = hs_ep->desc_list[hs_ep->compl_desc].status; }
@@ -3779,6 +3777,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep,unsigned int i, val, size;int ret =0 ;unsigned char ep_type; +int desc_num; dev_dbg(hsotg->dev, "%s: ep %s: a 0x%02x, attr 0x%02x, mps 0x%04x, intr %d\n",
@@ -3825,11 +3824,15 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep,dev_dbg (hsotg->dev,"%s: read DxEPCTL=0x%08x from 0x%08x\n" , __func__, epctrl, epctrl_reg); +if (using_desc_dma (hsotg) && ep_type ==USB_ENDPOINT_XFER_ISOC ) + desc_num =MAX_DMA_DESC_NUM_HS_ISOC ; +else + desc_num =MAX_DMA_DESC_NUM_GENERIC ; +/* Allocate DMA descriptor chain for non-ctrl endpoints */ if (using_desc_dma (hsotg) && !hs_ep->desc_list) { hs_ep->desc_list =dmam_alloc_coherent (hsotg->dev, -MAX_DMA_DESC_NUM_GENERIC * -sizeof (struct dwc2_dma_desc ), + desc_num *sizeof (struct dwc2_dma_desc ), &hs_ep->desc_list_dma,GFP_ATOMIC );if (!hs_ep->desc_list) { ret = -ENOMEM ;
@@ -3971,7 +3974,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, error2:if (ret &&using_desc_dma (hsotg) && hs_ep->desc_list) { -dmam_free_coherent (hsotg->dev,MAX_DMA_DESC_NUM_GENERIC * +dmam_free_coherent (hsotg->dev, desc_num *sizeof (struct dwc2_dma_desc ), hs_ep->desc_list, hs_ep->desc_list_dma); hs_ep->desc_list =NULL ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 63/276 powerpc/boot: Fix missing check of lseek() return value
In reply to Greg Kroah-Hartman[ Upstream commit 5d085ec04a000fefb5182d3b03ee46ca96d8389b ]
This is detected by Coverity scan: CID: 1440481
--- arch/powerpc/boot/addnote.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/powerpc/boot/addnote.c +5 -1
@@ -223,7 +223,11 @@ main(int ac, char **av)PUT_16 (E_PHNUM , np +2 );/* write back */ -lseek (fd, (long )0 ,SEEK_SET ); + i =lseek (fd, (long )0 ,SEEK_SET ); +if (i <0 ) { +perror ("lseek" ); +exit (1 ); + } i =write (fd, buf, n);if (i <0 ) {perror ("write" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 68/276 ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
In reply to Greg Kroah-Hartman[ Upstream commit 23583f7795025e3c783b680d906509366b0906ad ]
When the DSDT tables expose devices with subdevices and a set of hierarchical _DSD properties, the data returned by acpi_get_next_subnode() is incorrect, with the results suggesting a bad pointer assignment. The parser works fine with device_nodes or data_nodes, but not with a combination of the two.
The problem is traced to an invalid pointer used when jumping from handling device_nodes to data nodes. The existing code looks for data nodes below the last subdevice found instead of the common root. Fix by forcing the acpi_device pointer to be derived from the same fwnode for the two types of subnodes.
This same problem of handling device and data nodes was already fixed in a similar way by 'commit bf4703fdd166 ("ACPI / property: fix data node parsing in acpi_get_next_subnode()")' but broken later by 'commit 34055190b19 ("ACPI / property: Add fwnode_get_next_child_node()")', so this should probably go to linux-stable all the way to 4.12
--- drivers/acpi/property.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/property.c +8 -0
@@ -975,6 +975,14 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,const struct acpi_data_node *data =to_acpi_data_node (fwnode);struct acpi_data_node *dn; +/* +* We can have a combination of device and data nodes, e.g. with +* hierarchical _DSD properties. Make sure the adev pointer is +* restored before going through data nodes, otherwise we will +* be looking for data_nodes below the last device found instead +* of the common fwnode shared by device_nodes and data_nodes. +*/ + adev =to_acpi_device_node (fwnode);if (adev) head = &adev->data.subnodes;else if (data)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 32/276 ovl: relax WARN_ON() for overlapping layers use case
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
commit acf3062a7e1ccf67c6f7e7c28671a6708fde63b0 upstream.
This nasty little syzbot repro:
https://syzkaller.appspot.com/x/repro.syz?x=12c7a94f400000
Creates overlay mounts where the same directory is both in upper and lower layers. Simplified example:
mkdir foo work
mount -t overlay none foo -o"lowerdir=.,upperdir=foo,workdir=work"
The repro runs several threads in parallel that attempt to chdir into foo and attempt to symlink/rename/exec/mkdir the file bar.
The repro hits a WARN_ON() I placed in ovl_instantiate(), which suggests that an overlay inode already exists in cache and is hashed by the pointer of the real upper dentry that ovl_create_real() has just created. At the point of the WARN_ON(), for overlay dir inode lock is held and upper dir inode lock, so at first, I did not see how this was possible.
On a closer look, I see that after ovl_create_real(), because of the overlapping upper and lower layers, a lookup by another thread can find the file foo/bar that was just created in upper layer, at overlay path foo/foo/bar and hash the an overlay inode with the new real dentry as lower dentry. This is possible because the overlay directory foo/foo is not locked and the upper dentry foo/bar is in dcache, so ovl_lookup() can find it without taking upper dir inode shared lock.
Overlapping layers is considered a wrong setup which would result in unexpected behavior, but it shouldn't crash the kernel and it shouldn't trigger WARN_ON() either, so relax this WARN_ON() and leave a pr_warn() instead to cover all cases of failure to get an overlay inode.
The error returned from failure to insert new inode to cache with inode_insert5() was changed to -EEXIST, to distinguish from the error -ENOMEM returned on failure to get/allocate inode with iget5_locked().
--- fs/overlayfs/dir.c | 2 +- fs/overlayfs/inode.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
fs/overlayfs/dir.c +1 -1
@@ -260,7 +260,7 @@ static int ovl_instantiate(struct dentry* hashed directory inode aliases. */ inode =ovl_get_inode (dentry->d_sb, &oip); -if (WARN_ON (IS_ERR (inode))) +if (IS_ERR (inode))return PTR_ERR (inode); }else {WARN_ON (ovl_inode_real (inode) !=d_inode (newdentry));
fs/overlayfs/inode.c +2 -1
@@ -832,7 +832,7 @@ struct inode *ovl_get_inode(struct superint fsid = bylower ? oip->lowerpath->layer->fsid :0 ;bool is_dir, metacopy = false;unsigned long ino =0 ; -int err = -ENOMEM ; +int err = oip->newinode ? -EEXIST : -ENOMEM ;if (!realinode) realinode =d_inode (lowerdentry);
@@ -917,6 +917,7 @@ out:return inode; out_err: +pr_warn_ratelimited ("overlayfs: failed to get inode (%i)\n" , err); inode =ERR_PTR (err); goto out; }
Greg Kroah-Hartman
maintainerPATCH 69/276 drm/nouveau/bar/nv50: ensure BAR is mapped
In reply to Greg Kroah-Hartman[ Upstream commit f10b83de1fd49216a4c657816f48001437e4bdd5 ]
If the BAR is zero size, it indicates it was never successfully mapped. Ensure that the BAR is valid during initialization before attempting to use it.
--- drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c +9 -3
@@ -109,7 +109,7 @@ nv50_bar_oneinit(struct nvkm_bar *base)struct nvkm_device *device = bar->base.subdev.device;static struct lock_class_key bar1_lock;static struct lock_class_key bar2_lock; -u64 start, limit; +u64 start, limit, size;int ret; ret =nvkm_gpuobj_new (device,0x20000 ,0 , false,NULL , &bar->mem);
@@ -127,7 +127,10 @@ nv50_bar_oneinit(struct nvkm_bar *base)/* BAR2 */ start =0x0100000000ULL ; - limit = start + device->func->resource_size (device,3 ); + size = device->func->resource_size (device,3 ); +if (!size) +return -ENOMEM ; + limit = start + size; ret =nvkm_vmm_new (device, start, limit-- - start,NULL ,0 , &bar2_lock,"bar2" , &bar->bar2_vmm);
@@ -164,7 +167,10 @@ nv50_bar_oneinit(struct nvkm_bar *base)/* BAR1 */ start =0x0000000000ULL ; - limit = start + device->func->resource_size (device,1 ); + size = device->func->resource_size (device,1 ); +if (!size) +return -ENOMEM ; + limit = start + size; ret =nvkm_vmm_new (device, start, limit-- - start,NULL ,0 , &bar1_lock,"bar1" , &bar->bar1_vmm);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 70/276 media: stm32-dcmi: return appropriate error codes during probe
In reply to Greg Kroah-Hartman[ Upstream commit b5b5a27bee5884860798ffd0f08e611a3942064b ]
During probe, return the provided errors value instead of -ENODEV. This allows the driver to be deferred probed if needed.
--- drivers/media/platform/stm32/stm32-dcmi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/media/platform/stm32/stm32-dcmi.c +8 -6
@@ -1645,7 +1645,7 @@ static int dcmi_probe(struct platform_device *pdev) dcmi->rstc =devm_reset_control_get_exclusive (&pdev->dev,NULL );if (IS_ERR (dcmi->rstc)) {dev_err (&pdev->dev,"Could not get reset control\n" ); -return -ENODEV ; +return PTR_ERR (dcmi->rstc); }/* Get bus characteristics from devicetree */
@@ -1660,7 +1660,7 @@ static int dcmi_probe(struct platform_device *pdev)of_node_put (np);if (ret) {dev_err (&pdev->dev,"Could not parse the endpoint\n" ); -return -ENODEV ; +return ret; }if (ep.bus_type ==V4L2_MBUS_CSI2 ) {
@@ -1673,8 +1673,9 @@ static int dcmi_probe(struct platform_device *pdev) irq =platform_get_irq (pdev,0 );if (irq <=0 ) { -dev_err (&pdev->dev,"Could not get irq\n" ); -return -ENODEV ; +if (irq != -EPROBE_DEFER ) +dev_err (&pdev->dev,"Could not get irq\n" ); +return irq; } dcmi->res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -1694,12 +1695,13 @@ static int dcmi_probe(struct platform_device *pdev) dev_name(&pdev->dev), dcmi);if (ret) {dev_err (&pdev->dev,"Unable to request irq %d\n" , irq); -return -ENODEV ; +return ret; } mclk =devm_clk_get (&pdev->dev,"mclk" );if (IS_ERR (mclk)) { -dev_err (&pdev->dev,"Unable to get mclk\n" ); +if (PTR_ERR (mclk) != -EPROBE_DEFER ) +dev_err (&pdev->dev,"Unable to get mclk\n" );return PTR_ERR (mclk); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 88/276 sched/nohz: Run NOHZ idle load balancer on HK_FLAG_MISC CPUs
In reply to Greg Kroah-Hartman[ Upstream commit 9b019acb72e4b5741d88e8936d6f200ed44b66b2 ]
The NOHZ idle balancer runs on the lowest idle CPU. This can interfere with isolated CPUs, so confine it to HK_FLAG_MISC housekeeping CPUs.
HK_FLAG_SCHED is not used for this because it is not set anywhere at the moment. This could be folded into HK_FLAG_SCHED once that option is fixed.
The problem was observed with increased jitter on an application running on CPU0, caused by NOHZ idle load balancing being run on CPU1 (an SMT sibling).
--- kernel/sched/fair.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
kernel/sched/fair.c +10 -6
@@ -9083,22 +9083,26 @@ static inline int on_null_domain(struct rq *rq)* - When one of the busy CPUs notice that there may be an idle rebalancing * needed, they will kick the idle load balancer, which then does idle * load balancing for all the idle CPUs. +* - HK_FLAG_MISC CPUs are used for this task, because HK_FLAG_SCHED not set +* anywhere yet. */ static inline int find_new_ilb (void ) { -int ilb =cpumask_first (nohz.idle_cpus_mask); +int ilb; -if (ilb < nr_cpu_ids &&idle_cpu (ilb)) -return ilb; +for_each_cpu_and (ilb, nohz.idle_cpus_mask, +housekeeping_cpumask (HK_FLAG_MISC )) { +if (idle_cpu (ilb)) +return ilb; + }return nr_cpu_ids; }/* -* Kick a CPU to do the nohz balancing, if it is time for it. We pick the -* nohz_load_balancer CPU (if there is one) otherwise fallback to any idle -* CPU (if there is one). +* Kick a CPU to do the nohz balancing, if it is time for it. We pick any +* idle CPU in the HK_FLAG_MISC housekeeping set (if there is one). */ static void kick_ilb (unsigned int flags) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 104/276 bcache: fix failure in journal relplay
In reply to Greg Kroah-Hartman[ Upstream commit 631207314d88e9091be02fbdd1fdadb1ae2ed79a ]
journal replay failed with messages:
Sep 10 19:10:43 ceph kernel: bcache: error on
bb379a64-e44e-4812-b91d-a5599871a3b1: bcache: journal entries 2057493-2057567 missing! (replaying 2057493-2076601), disabling caching
The reason is in journal_reclaim(), when discard is enabled, we send discard command and reclaim those journal buckets whose seq is old than the last_seq_now, but before we write a journal with last_seq_now, the machine is restarted, so the journal with the last_seq_now is not written to the journal bucket, and the last_seq_wrote in the newest journal is old than last_seq_now which we expect to be, so when we doing replay, journals from last_seq_wrote to last_seq_now are missing.
It's hard to write a journal immediately after journal_reclaim(), and it harmless if those missed journal are caused by discarding since those journals are already wrote to btree node. So, if miss seqs are started from the beginning journal, we treat it as normal, and only print a message to show the miss journal, and point out it maybe caused by discarding.
Patch v2 add a judgement condition to ignore the missed journal only when discard enabled as Coly suggested.
(Coly Li: rebase the patch with other changes in bch_journal_replay())
--- drivers/md/bcache/journal.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
drivers/md/bcache/journal.c +21 -4
@@ -317,6 +317,18 @@ void bch_journal_mark(struct cache_set *c, struct list_head *list) } } +bool is_discard_enabled (struct cache_set *s) +{ +struct cache *ca; +unsigned int i; + +for_each_cache (ca, s, i) +if (ca->discard) +return true; + +return false; +} +int bch_journal_replay (struct cache_set *s,struct list_head *list) {int ret =0 , keys =0 , entries =0 ;
@@ -331,10 +343,15 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list)BUG_ON (i->pin &&atomic_read (i->pin) !=1 );if (n != i->j.seq) { -pr_err ("bcache: journal entries %llu-%llu missing! (replaying %llu-%llu)" , - n, i->j.seq -1 , start, end); - ret = -EIO ; - goto err; +if (n == start &&is_discard_enabled (s)) +pr_info ("bcache: journal entries %llu-%llu may be discarded! (replaying %llu-%llu)" , + n, i->j.seq -1 , start, end); +else { +pr_err ("bcache: journal entries %llu-%llu missing! (replaying %llu-%llu)" , + n, i->j.seq -1 , start, end); + ret = -EIO ; + goto err; + } } for (k = i->j.start;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 105/276 bcache: add failure check to run_cache_set() for journal replay
In reply to Greg Kroah-Hartman[ Upstream commit ce3e4cfb59cb382f8e5ce359238aa580d4ae7778 ]
Currently run_cache_set() has no return value, if there is failure in bch_journal_replay(), the caller of run_cache_set() has no idea about such failure and just continue to execute following code after run_cache_set(). The internal failure is triggered inside bch_journal_replay() and being handled in async way. This behavior is inefficient, while failure handling inside bch_journal_replay(), cache register code is still running to start the cache set. Registering and unregistering code running as same time may introduce some rare race condition, and make the code to be more hard to be understood.
This patch adds return value to run_cache_set(), and returns -EIO if bch_journal_rreplay() fails. Then caller of run_cache_set() may detect such failure and stop registering code flow immedidately inside register_cache_set().
If journal replay fails, run_cache_set() can report error immediately to register_cache_set(). This patch makes the failure handling for bch_journal_replay() be in synchronized way, easier to understand and debug, and avoid poetential race condition for register-and-unregister in same time.
--- drivers/md/bcache/super.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/md/bcache/super.c +12 -5
@@ -1770,7 +1770,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb)return NULL ; } -static void run_cache_set (struct cache_set *c) +static int run_cache_set (struct cache_set *c) {const char *err ="cannot allocate memory" ;struct cached_dev *dc, *t;
@@ -1866,7 +1866,9 @@ static void run_cache_set(struct cache_set *c)if (j->version <BCACHE_JSET_VERSION_UUID )__uuid_write (c); -bch_journal_replay (c, &journal); + err ="bcache: replay journal failed" ; +if (bch_journal_replay (c, &journal)) + goto err; }else {pr_notice ("invalidating existing data" );
@@ -1934,7 +1936,7 @@ static void run_cache_set(struct cache_set *c)flash_devs_run (c);set_bit (CACHE_SET_RUNNING , &c->flags); -return ; +return 0 ; err:while (!list_empty (&journal)) { l = list_first_entry(&journal, struct journal_replay, list);
@@ -1945,6 +1947,8 @@ static void run_cache_set(struct cache_set *c)closure_sync (&cl);/* XXX: test this, it's broken */ bch_cache_set_error (c,"%s" , err); + +return -EIO ; }static bool can_attach_cache (struct cache *ca,struct cache_set *c)
@@ -2008,8 +2012,11 @@ static const char *register_cache_set(struct cache *ca) ca->set->cache[ca->sb.nr_this_dev] = ca; c->cache_by_alloc[c->caches_loaded++] = ca; -if (c->caches_loaded == c->sb.nr_in_set) -run_cache_set (c); +if (c->caches_loaded == c->sb.nr_in_set) { + err ="failed to run cache set" ; +if (run_cache_set (c) <0 ) + goto err; + }return NULL ; err:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 115/276 HID: logitech-hidpp: use RAP instead of FAP to get the protocol version
In reply to Greg Kroah-Hartman[ Upstream commit 096377525cdb8251e4656085efc988bdf733fb4c ]
According to the logitech_hidpp_2.0_specification_draft_2012-06-04.pdf doc:
https://lekensteyn.nl/files/logitech/logitech_hidpp_2.0_specification_draft_2012-06-04.pdf
We should use a register-access-protocol request using the short input / output report ids. This is necessary because 27MHz HID++ receivers have a max-packetsize on their HIP++ endpoint of 8, so they cannot support long reports. Using a feature-access-protocol request (which is always long or very-long) with these will cause a timeout error, followed by the hidpp driver treating the device as not being HID++ capable.
This commit fixes this by switching to using a rap request to get the protocol version.
Besides being tested with a (046d:c517) 27MHz receiver with various 27MHz keyboards and mice, this has also been tested to not cause regressions on a non-unifying dual-HID++ nano receiver (046d:c534) with k270 and m185 HID++-2.0 devices connected and on a unifying/dj receiver (046d:c52b) with a HID++-2.0 Logitech Rechargeable Touchpad T650.
--- drivers/hid/hid-logitech-hidpp.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/hid/hid-logitech-hidpp.c +13 -4
@@ -725,13 +725,16 @@ static int hidpp_root_get_feature(struct hidpp_device *hidpp, u16 feature,static int hidpp_root_get_protocol_version (struct hidpp_device *hidpp) { +const u8 ping_byte =0x5a ; +u8 ping_data[3 ] = {0 ,0 , ping_byte };struct hidpp_report response;int ret; - ret =hidpp_send_fap_command_sync (hidpp, + ret =hidpp_send_rap_command_sync (hidpp, +REPORT_ID_HIDPP_SHORT ,HIDPP_PAGE_ROOT_IDX ,CMD_ROOT_GET_PROTOCOL_VERSION , -NULL ,0 , &response); + ping_data,sizeof (ping_data), &response);if (ret ==HIDPP_ERROR_INVALID_SUBID ) { hidpp->protocol_major =1 ;
@@ -751,8 +754,14 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp)if (ret)return ret; - hidpp->protocol_major = response.fap.params[0 ]; - hidpp->protocol_minor = response.fap.params[1 ]; +if (response.rap.params[2 ] != ping_byte) { +hid_err (hidpp->hid_dev,"%s: ping mismatch 0x%02x != 0x%02x\n" , + __func__, response.rap.params[2 ], ping_byte); +return -EPROTO ; + } + + hidpp->protocol_major = response.rap.params[0 ]; + hidpp->protocol_minor = response.rap.params[1 ];return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 121/276 media: coda: clear error return value before picture run
In reply to Greg Kroah-Hartman[ Upstream commit bbeefa7357a648afe70e7183914c87c3878d528d ]
The error return value is not written by some firmware codecs, such as MPEG-2 decode on CodaHx4. Clear the error return value before starting the picture run to avoid misinterpreting unrelated values returned by sequence initialization as error return value.
--- drivers/media/platform/coda/coda-bit.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/coda/coda-bit.c +3 -0
@@ -1999,6 +1999,9 @@ static int coda_prepare_decode(struct coda_ctx *ctx)/* Clear decode success flag */ coda_write (dev,0 ,CODA_RET_DEC_PIC_SUCCESS ); +/* Clear error return value */ +coda_write (dev,0 ,CODA_RET_DEC_PIC_ERR_MB ); +trace_coda_dec_pic_run (ctx, meta);coda_command_async (ctx,CODA_COMMAND_PIC_RUN );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 122/276 media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper
In reply to Greg Kroah-Hartman[ Upstream commit ccdd85d518d8b9320ace1d87271f0ba2175f21fa ]
In preparation for adding asynchronous subdevice support to the driver, don't acquire v4l2_clk from the driver .probe() callback as that may fail if the clock is provided by a bridge driver which may be not yet initialized. Move the v4l2_clk_get() to ov6650_video_probe() helper which is going to be converted to v4l2_subdev_internal_ops.registered() callback, executed only when the bridge driver is ready.
--- drivers/media/i2c/ov6650.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/media/i2c/ov6650.c +14 -11
@@ -811,9 +811,16 @@ static int ov6650_video_probe(struct i2c_client *client)u8 pidh, pidl, midh, midl;int ret; + priv->clk =v4l2_clk_get (&client->dev,NULL ); +if (IS_ERR (priv->clk)) { + ret =PTR_ERR (priv->clk); +dev_err (&client->dev,"v4l2_clk request err: %d\n" , ret); +return ret; + } + ret =ov6650_s_power (&priv->subdev,1 );if (ret <0 ) -return ret; + goto eclkput;msleep (20 );
@@ -850,6 +857,11 @@ static int ov6650_video_probe(struct i2c_client *client) done:ov6650_s_power (&priv->subdev,0 ); +if (!ret) +return 0 ; +eclkput: +v4l2_clk_put (priv->clk); +return ret; }
@@ -992,18 +1004,9 @@ static int ov6650_probe(struct i2c_client *client, priv->code =MEDIA_BUS_FMT_YUYV8_2X8 ; priv->colorspace =V4L2_COLORSPACE_JPEG ; - priv->clk =v4l2_clk_get (&client->dev,NULL ); -if (IS_ERR (priv->clk)) { - ret =PTR_ERR (priv->clk); - goto eclkget; - } - ret =ov6650_video_probe (client); -if (ret) { -v4l2_clk_put (priv->clk); -eclkget: +if (ret)v4l2_ctrl_handler_free (&priv->hdl); - }return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 86/276 scsi: qedi: Abort ep termination if offload not scheduled
In reply to Greg Kroah-Hartman[ Upstream commit f848bfd8e167210a29374e8a678892bed591684f ]
Sometimes during connection recovery when there is a failure to resolve ARP, and offload connection was not issued, driver tries to flush pending offload connection work which was not queued up.
kernel: WARNING: CPU: 19 PID: 10110 at kernel/workqueue.c:3030 __flush_work.isra.34+0x19c/0x1b0
kernel: CPU: 19 PID: 10110 Comm: iscsid Tainted: G W 5.1.0-rc4 #11
kernel: Hardware name: Dell Inc. PowerEdge R730/0599V5, BIOS 2.9.1 12/04/2018
kernel: RIP: 0010:__flush_work.isra.34+0x19c/0x1b0
kernel: Code: 8b fb 66 0f 1f 44 00 00 31 c0 eb ab 48 89 ef c6 07 00 0f 1f 40 00 fb 66 0f 1f 44 00 00 31 c0 eb 96 e8 08 16 fe ff 0f 0b eb 8d <0f> 0b 31 c0 eb 87 0f 1f 40 00 66 2e 0f 1 f 84 00 00 00 00 00 0f 1f
kernel: RSP: 0018:ffffa6b4054dba68 EFLAGS: 00010246
kernel: RAX: 0000000000000000 RBX: ffff91df21c36fc0 RCX: 0000000000000000
kernel: RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff91df21c36fc0
kernel: RBP: ffff91df21c36ef0 R08: 0000000000000000 R09: 0000000000000000
kernel: R10: 0000000000000038 R11: ffffa6b4054dbd60 R12: ffffffffc05e72c0
kernel: R13: ffff91db10280820 R14: 0000000000000048 R15: 0000000000000000
kernel: FS: 00007f5d83cc1740(0000) GS:ffff91df2f840000(0000) knlGS:0000000000000000
kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
kernel: CR2: 0000000001cc5000 CR3: 0000000465450002 CR4: 00000000001606e0
kernel: Call Trace:
kernel: ? try_to_del_timer_sync+0x4d/0x80
kernel: qedi_ep_disconnect+0x3b/0x410 [qedi]
kernel: ? 0xffffffffc083c000
kernel: ? klist_iter_exit+0x14/0x20
kernel: ? class_find_device+0x93/0xf0
kernel: iscsi_if_ep_disconnect.isra.18+0x58/0x70 [scsi_transport_iscsi]
kernel: iscsi_if_recv_msg+0x10e2/0x1510 [scsi_transport_iscsi]
kernel: ? copyout+0x22/0x30
kernel: ? _copy_to_iter+0xa0/0x430
kernel: ? _cond_resched+0x15/0x30
kernel: ? __kmalloc_node_track_caller+0x1f9/0x270
kernel: iscsi_if_rx+0xa5/0x1e0 [scsi_transport_iscsi]
kernel: netlink_unicast+0x17f/0x230
kernel: netlink_sendmsg+0x2d2/0x3d0
kernel: sock_sendmsg+0x36/0x50
kernel: ___sys_sendmsg+0x280/0x2a0
kernel: ? timerqueue_add+0x54/0x80
kernel: ? enqueue_hrtimer+0x38/0x90
kernel: ? hrtimer_start_range_ns+0x19f/0x2c0
kernel: __sys_sendmsg+0x58/0xa0
kernel: do_syscall_64+0x5b/0x180
kernel: entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- drivers/scsi/qedi/qedi_iscsi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/qedi/qedi_iscsi.c +3 -0
@@ -1001,6 +1001,9 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) qedi_ep = ep->dd_data; qedi = qedi_ep->qedi; +if (qedi_ep->state ==EP_STATE_OFLDCONN_START ) + goto ep_exit_recover; +flush_work (&qedi_ep->offload_work);if (qedi_ep->conn) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 142/276 thunderbolt: Take domain lock in switch sysfs attribute callbacks
In reply to Greg Kroah-Hartman[ Upstream commit 09f11b6c99feaf86a26444bca85dc693b3f58f8b ]
switch_lock was introduced because it allowed serialization of device authorization requests from userspace without need to take the big domain lock (tb->lock). This was fine because device authorization with ICM is just one command that is sent to the firmware. Now that we start to handle all tunneling in the driver switch_lock is not enough because we need to walk over the topology to establish paths.
For this reason drop switch_lock from the driver completely in favour of big domain lock.
There is one complication, though. If userspace is waiting for the lock in tb_switch_set_authorized(), it keeps the device_del() from removing the sysfs attribute because it waits for active users to release the attribute first which leads into following splat:
INFO: task kworker/u8:3:73 blocked for more than 61 seconds.
Tainted: G W 5.1.0-rc1+ #244
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
kworker/u8:3 D12976 73 2 0x80000000
Workqueue: thunderbolt0 tb_handle_hotplug [thunderbolt]
Call Trace:
? __schedule+0x2e5/0x740
? _raw_spin_lock_irqsave+0x12/0x40
? prepare_to_wait_event+0xc5/0x160
schedule+0x2d/0x80
__kernfs_remove.part.17+0x183/0x1f0
? finish_wait+0x80/0x80
kernfs_remove_by_name_ns+0x4a/0x90
remove_files.isra.1+0x2b/0x60
sysfs_remove_group+0x38/0x80
sysfs_remove_groups+0x24/0x40
device_remove_attrs+0x3d/0x70
device_del+0x14c/0x360
device_unregister+0x15/0x50
tb_switch_remove+0x9e/0x1d0 [thunderbolt]
tb_handle_hotplug+0x119/0x5a0 [thunderbolt]
? process_one_work+0x1b7/0x420
process_one_work+0x1b7/0x420
worker_thread+0x37/0x380
? _raw_spin_unlock_irqrestore+0xf/0x30
? process_one_work+0x420/0x420
kthread+0x118/0x130
? kthread_create_on_node+0x60/0x60
ret_from_fork+0x35/0x40We deal this by following what network stack did for some of their attributes and use mutex_trylock() with restart_syscall(). This makes userspace release the attribute allowing sysfs attribute removal to progress before the write is restarted and eventually fail when the attribute is removed.
--- drivers/thunderbolt/switch.c | 45 +++++++++++++++--------------------- drivers/thunderbolt/tb.h | 3 +-- 2 files changed, 20 insertions(+), 28 deletions(-)
drivers/thunderbolt/switch.c +19 -26
@@ -9,15 +9,13 @@#include <linux/idr.h> #include <linux/nvmem-provider.h> #include <linux/pm_runtime.h> +#include <linux/sched/signal.h> #include <linux/sizes.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include "tb.h" -/* Switch authorization from userspace is serialized by this lock */ -static DEFINE_MUTEX (switch_lock); -/* Switch NVM support */ #define NVM_DEVID 0x05
@@ -253,8 +251,8 @@ static int tb_switch_nvm_write(void *priv, unsigned int offset, void *val,struct tb_switch *sw = priv;int ret =0 ; -if (mutex_lock_interruptible (&switch_lock)) -return -ERESTARTSYS ; +if (!mutex_trylock (&sw->tb->lock)) +return restart_syscall ();/* * Since writing the NVM image might require some special steps,
@@ -274,7 +272,7 @@ static int tb_switch_nvm_write(void *priv, unsigned int offset, void *val,memcpy (sw->nvm->buf + offset, val, bytes); unlock: -mutex_unlock (&switch_lock); +mutex_unlock (&sw->tb->lock);return ret; }
@@ -363,10 +361,7 @@ static int tb_switch_nvm_add(struct tb_switch *sw) } nvm->non_active = nvm_dev; -mutex_lock (&switch_lock); sw->nvm = nvm; -mutex_unlock (&switch_lock); -return 0 ; err_nvm_active:
@@ -383,10 +378,8 @@ static void tb_switch_nvm_remove(struct tb_switch *sw) {struct tb_switch_nvm *nvm; -mutex_lock (&switch_lock); nvm = sw->nvm; sw->nvm =NULL ; -mutex_unlock (&switch_lock);if (!nvm)return ;
@@ -717,8 +710,8 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) {int ret = -EINVAL ; -if (mutex_lock_interruptible (&switch_lock)) -return -ERESTARTSYS ; +if (!mutex_trylock (&sw->tb->lock)) +return restart_syscall ();if (sw->authorized) goto unlock;
@@ -761,7 +754,7 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) } unlock: -mutex_unlock (&switch_lock); +mutex_unlock (&sw->tb->lock);return ret; }
@@ -818,15 +811,15 @@ static ssize_t key_show(struct device *dev, struct device_attribute *attr,struct tb_switch *sw =tb_to_switch (dev);ssize_t ret; -if (mutex_lock_interruptible (&switch_lock)) -return -ERESTARTSYS ; +if (!mutex_trylock (&sw->tb->lock)) +return restart_syscall ();if (sw->key) ret =sprintf (buf,"%*phN\n" ,TB_SWITCH_KEY_SIZE , sw->key);else ret =sprintf (buf,"\n" ); -mutex_unlock (&switch_lock); +mutex_unlock (&sw->tb->lock);return ret; }
@@ -843,8 +836,8 @@ static ssize_t key_store(struct device *dev, struct device_attribute *attr,else if (hex2bin (key, buf,sizeof (key)))return -EINVAL ; -if (mutex_lock_interruptible (&switch_lock)) -return -ERESTARTSYS ; +if (!mutex_trylock (&sw->tb->lock)) +return restart_syscall ();if (sw->authorized) { ret = -EBUSY ;
@@ -859,7 +852,7 @@ static ssize_t key_store(struct device *dev, struct device_attribute *attr, } } -mutex_unlock (&switch_lock); +mutex_unlock (&sw->tb->lock);return ret; } static DEVICE_ATTR(key, 0600, key_show, key_store);
@@ -905,8 +898,8 @@ static ssize_t nvm_authenticate_store(struct device *dev,bool val;int ret; -if (mutex_lock_interruptible (&switch_lock)) -return -ERESTARTSYS ; +if (!mutex_trylock (&sw->tb->lock)) +return restart_syscall ();/* If NVMem devices are not yet added */ if (!sw->nvm) {
@@ -954,7 +947,7 @@ static ssize_t nvm_authenticate_store(struct device *dev, } exit_unlock: -mutex_unlock (&switch_lock); +mutex_unlock (&sw->tb->lock);if (ret)return ret;
@@ -968,8 +961,8 @@ static ssize_t nvm_version_show(struct device *dev,struct tb_switch *sw =tb_to_switch (dev);int ret; -if (mutex_lock_interruptible (&switch_lock)) -return -ERESTARTSYS ; +if (!mutex_trylock (&sw->tb->lock)) +return restart_syscall ();if (sw->safe_mode) ret = -ENODATA ;
@@ -978,7 +971,7 @@ static ssize_t nvm_version_show(struct device *dev,else ret =sprintf (buf,"%x.%x\n" , sw->nvm->major, sw->nvm->minor); -mutex_unlock (&switch_lock); +mutex_unlock (&sw->tb->lock);return ret; }
drivers/thunderbolt/tb.h +1 -2
@@ -79,8 +79,7 @@ struct tb_switch_nvm {* @depth: Depth in the chain this switch is connected (ICM only) * * When the switch is being added or removed to the domain (other -* switches) you need to have domain lock held. For switch authorization -* internal switch_lock is enough. +* switches) you need to have domain lock held. */ struct tb_switch {struct device dev;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 143/276 s390/qeth: handle error from qeth_update_from_chp_desc()
In reply to Greg Kroah-Hartman[ Upstream commit a4cdc9baee0740748f16e50cd70c2607510df492 ]
Subsequent code relies on the values that qeth_update_from_chp_desc() reads from the CHP descriptor. Rather than dealing with weird errors later on, just handle it properly here.
--- drivers/s390/net/qeth_core_main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/s390/net/qeth_core_main.c +10 -4
@@ -1370,7 +1370,7 @@ static void qeth_set_multiple_write_queues(struct qeth_card *card) card->qdio.no_out_queues =4 ; } -static void qeth_update_from_chp_desc (struct qeth_card *card) +static int qeth_update_from_chp_desc (struct qeth_card *card) {struct ccw_device *ccwdev;struct channel_path_desc_fmt0 *chp_dsc;
@@ -1380,7 +1380,7 @@ static void qeth_update_from_chp_desc(struct qeth_card *card) ccwdev = card->data.ccwdev; chp_dsc =ccw_device_get_chp_desc (ccwdev,0 );if (!chp_dsc) - goto out; +return -ENOMEM ; card->info.func_level =0x4100 + chp_dsc->desc;if (card->info.type ==QETH_CARD_TYPE_IQD )
@@ -1395,6 +1395,7 @@ static void qeth_update_from_chp_desc(struct qeth_card *card)kfree (chp_dsc);QETH_DBF_TEXT_ (SETUP ,2 ,"nr:%x" , card->qdio.no_out_queues);QETH_DBF_TEXT_ (SETUP ,2 ,"lvl:%02x" , card->info.func_level); +return 0 ; }static void qeth_init_qdio_info (struct qeth_card *card)
@@ -5090,7 +5091,9 @@ int qeth_core_hardsetup_card(struct qeth_card *card)QETH_DBF_TEXT (SETUP ,2 ,"hrdsetup" );atomic_set (&card->force_alloc_skb,0 ); -qeth_update_from_chp_desc (card); + rc =qeth_update_from_chp_desc (card); +if (rc) +return rc; retry:if (retries <3 ) QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n",
@@ -5768,7 +5771,9 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev) gdev->cdev[2 ]->handler = qeth_irq;qeth_setup_card (card); -qeth_update_from_chp_desc (card); + rc =qeth_update_from_chp_desc (card); +if (rc) + goto err_chp_desc; card->dev =qeth_alloc_netdev (card);if (!card->dev) {
@@ -5806,6 +5811,7 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)qeth_core_free_discipline (card); err_load:free_netdev (card->dev); +err_chp_desc: err_card:qeth_core_free_card (card); err_dev:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 152/276 arm64: vdso: Fix clock_getres() for CLOCK_REALTIME
In reply to Greg Kroah-Hartman[ Upstream commit 81fb8736dd81da3fe94f28968dac60f392ec6746 ]
clock_getres() in the vDSO library has to preserve the same behaviour of posix_get_hrtimer_res().
In particular, posix_get_hrtimer_res() does:
sec = 0;
ns = hrtimer_resolution;where 'hrtimer_resolution' depends on whether or not high resolution timers are enabled, which is a runtime decision.
The vDSO incorrectly returns the constant CLOCK_REALTIME_RES. Fix this by exposing 'hrtimer_resolution' in the vDSO datapage and returning that instead.
--- arch/arm64/include/asm/vdso_datapage.h | 1 + arch/arm64/kernel/asm-offsets.c | 2 +- arch/arm64/kernel/vdso.c | 3 +++ arch/arm64/kernel/vdso/gettimeofday.S | 7 +++---- 4 files changed, 8 insertions(+), 5 deletions(-)
arch/arm64/include/asm/vdso_datapage.h +1 -0
@@ -38,6 +38,7 @@ struct vdso_data {__u32 tz_minuteswest;/* Whacky timezone stuff */ __u32 tz_dsttime;__u32 use_syscall; + __u32 hrtimer_res; };#endif /* !__ASSEMBLY__ */
arch/arm64/kernel/asm-offsets.c +1 -1
@@ -99,7 +99,7 @@ int main(void)DEFINE (CLOCK_REALTIME ,CLOCK_REALTIME );DEFINE (CLOCK_MONOTONIC ,CLOCK_MONOTONIC );DEFINE (CLOCK_MONOTONIC_RAW ,CLOCK_MONOTONIC_RAW ); -DEFINE (CLOCK_REALTIME_RES ,MONOTONIC_RES_NSEC ); +DEFINE (CLOCK_REALTIME_RES , offsetof(struct vdso_data , hrtimer_res));DEFINE (CLOCK_REALTIME_COARSE ,CLOCK_REALTIME_COARSE );DEFINE (CLOCK_MONOTONIC_COARSE ,CLOCK_MONOTONIC_COARSE );DEFINE (CLOCK_COARSE_RES ,LOW_RES_NSEC );
arch/arm64/kernel/vdso.c +3 -0
@@ -232,6 +232,9 @@ void update_vsyscall(struct timekeeper *tk) vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; +/* Read without the seqlock held by clock_getres() */ +WRITE_ONCE (vdso_data->hrtimer_res, hrtimer_resolution); +if (!use_syscall) {/* tkr_mono.cycle_last == tkr_raw.cycle_last */ vdso_data->cs_cycle_last = tk->tkr_mono.cycle_last;
arch/arm64/kernel/vdso/gettimeofday.S +3 -4
@@ -308,13 +308,14 @@ ENTRY(__kernel_clock_getres) ccmp w0, #CLOCK_MONOTONIC_RAW, #0x4, ne b.ne 1f - ldr x2, 5f + adr vdso_data, _vdso_data + ldr w2, [vdso_data, #CLOCK_REALTIME_RES] b 2f 1: cmp w0, #CLOCK_REALTIME_COARSE ccmp w0, #CLOCK_MONOTONIC_COARSE, #0x4, ne b.ne 4f - ldr x2, 6f + ldr x2, 5f 2: cbz x1, 3f stp xzr, x2, [x1]
@@ -328,8 +329,6 @@ ENTRY(__kernel_clock_getres) svc #0 ret 5: - .quad CLOCK_REALTIME_RES -6: .quad CLOCK_COARSE_RES .cfi_endproc ENDPROC(__kernel_clock_getres)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 159/276 hwmon: (smsc47b397) Use request_muxed_region for Super-IO accesses
In reply to Greg Kroah-Hartman[ Upstream commit 8c0826756744c0ac1df600a5e4cca1a341b13101 ]
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/smsc47b397.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/hwmon/smsc47b397.c +11 -2
@@ -72,14 +72,19 @@ static inline void superio_select(int ld)superio_outb (0x07 , ld); } -static inline void superio_enter (void ) +static inline int superio_enter (void ) { +if (!request_muxed_region (REG ,2 ,DRVNAME )) +return -EBUSY ; +outb (0x55 ,REG ); +return 0 ; }static inline void superio_exit (void ) {outb (0xAA ,REG ); +release_region (REG ,2 ); }#define SUPERIO_REG_DEVID 0x20
@@ -300,8 +305,12 @@ static int __init smsc47b397_find(void)u8 id, rev;char *name;unsigned short addr; +int err; + + err =superio_enter (); +if (err) +return err; -superio_enter (); id = force_id ? force_id :superio_inb (SUPERIO_REG_DEVID );switch (id) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 165/276 mmc: sdhci-of-esdhc: add erratum eSDHC5 support
In reply to Greg Kroah-Hartman[ Upstream commit a46e42712596b51874f04c73f1cdf1017f88df52 ]
Software writing to the Transfer Type configuration register (system clock domain) can cause a setup/hold violation in the CRC flops (card clock domain), which can cause write accesses to be sent with corrupt CRC values. This issue occurs only for write preceded by read. this erratum is to fix this issue.
--- drivers/mmc/host/sdhci-of-esdhc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/host/sdhci-of-esdhc.c +3 -0
@@ -917,6 +917,9 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)if (esdhc->vendor_ver >VENDOR_V_22 ) host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ ; +if (of_find_compatible_node (NULL ,NULL ,"fsl,p2020-esdhc" )) + host->quirks2 |=SDHCI_QUIRK_RESET_AFTER_REQUEST ; + if (of_device_is_compatible(np, "fsl,p5040-esdhc") || of_device_is_compatible(np, "fsl,p5020-esdhc") || of_device_is_compatible(np, "fsl,p4080-esdhc") ||
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 185/276 drm/pl111: fix possible object reference leak
In reply to Greg Kroah-Hartman[ Upstream commit bc29d3a69d4c1bd1a103e8b3c1ed81b807c1870b ]
The call to of_find_matching_node_and_match returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
drivers/gpu/drm/pl111/pl111_versatile.c:333:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:340:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:346:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:354:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:395:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:402:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
--- drivers/gpu/drm/pl111/pl111_versatile.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/pl111/pl111_versatile.c +4 -0
@@ -330,6 +330,7 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) ret =vexpress_muxfpga_init ();if (ret) {dev_err (dev,"unable to initialize muxfpga driver\n" ); +of_node_put (np);return ret; }
@@ -337,17 +338,20 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) pdev =of_find_device_by_node (np);if (!pdev) {dev_err (dev,"can't find the sysreg device, deferring\n" ); +of_node_put (np);return -EPROBE_DEFER ; } map =dev_get_drvdata (&pdev->dev);if (!map) {dev_err (dev,"sysreg has not yet probed\n" );platform_device_put (pdev); +of_node_put (np);return -EPROBE_DEFER ; } }else { map =syscon_node_to_regmap (np); } +of_node_put (np);if (IS_ERR (map)) {dev_err (dev,"no Versatile syscon regmap\n" );
Signature · 8 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Greg Kroah-Hartman
maintainerPATCH 192/276 mwifiex: Fix mem leak in mwifiex_tm_cmd
In reply to Greg Kroah-Hartman[ Upstream commit 003b686ace820ce2d635a83f10f2d7f9c147dabc ]
'hostcmd' is alloced by kzalloc, should be freed before leaving from the error handling cases, otherwise it will cause mem leak.
--- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +5 -1
@@ -4045,16 +4045,20 @@ static int mwifiex_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev,if (mwifiex_send_cmd (priv,0 ,0 ,0 , hostcmd, true)) {dev_err (priv->adapter->dev,"Failed to process hostcmd\n" ); +kfree (hostcmd);return -EFAULT ; }/* process hostcmd response*/ skb =cfg80211_testmode_alloc_reply_skb (wiphy, hostcmd->len); -if (!skb) +if (!skb) { +kfree (hostcmd);return -ENOMEM ; + } err =nla_put (skb,MWIFIEX_TM_ATTR_DATA , hostcmd->len, hostcmd->cmd);if (err) { +kfree (hostcmd);kfree_skb (skb);return -EMSGSIZE ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 196/276 brcmfmac: fix WARNING during USB disconnect in case of unempty psq
In reply to Greg Kroah-Hartman[ Upstream commit c80d26e81ef1802f30364b4ad1955c1443a592b9 ]
brcmu_pkt_buf_free_skb emits WARNING when attempting to free a sk_buff which is part of any queue. After USB disconnect this may have happened when brcmf_fws_hanger_cleanup() is called as per-interface psq was never cleaned when removing the interface.
Change brcmf_fws_macdesc_cleanup() in a way that it removes the corresponding packets from hanger table (to avoid double-free when brcmf_fws_hanger_cleanup() is called) and add a call to clean-up the interface specific packet queue.
Below is a WARNING during USB disconnect with Raspberry Pi WiFi dongle running in AP mode. This was reproducible when the interface was transmitting during the disconnect and is fixed with this commit.
------------[ cut here ]------------ WARNING: CPU: 0 PID: 1171 at drivers/net/wireless/broadcom/brcm80211/brcmutil/utils.c:49 brcmu_pkt_buf_free_skb+0x3c/0x40 Modules linked in: nf_log_ipv4 nf_log_common xt_LOG xt_limit iptable_mangle xt_connmark xt_tcpudp xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_filter ip_tables x_tables usb_f_mass_storage usb_f_rndis u_ether cdc_acm smsc95xx usbnet ci_hdrc_imx ci_hdrc ulpi usbmisc_imx 8250_exar 8250_pci 8250 8250_base libcomposite configfs udc_core CPU: 0 PID: 1171 Comm: kworker/0:0 Not tainted 4.19.23-00075-gde33ed8 #99 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) Workqueue: usb_hub_wq hub_event [<8010ff84>] (unwind_backtrace) from [<8010bb64>] (show_stack+0x10/0x14) [<8010bb64>] (show_stack) from [<80840278>] (dump_stack+0x88/0x9c) [<80840278>] (dump_stack) from [<8011f5ec>] (__warn+0xfc/0x114) [<8011f5ec>] (__warn) from [<8011f71c>] (warn_slowpath_null+0x40/0x48) [<8011f71c>] (warn_slowpath_null) from [<805a476c>] (brcmu_pkt_buf_free_skb+0x3c/0x40) [<805a476c>] (brcmu_pkt_buf_free_skb) from [<805bb6c4>] (brcmf_fws_cleanup+0x1e4/0x22c) [<805bb6c4>] (brcmf_fws_cleanup) from [<805bc854>] (brcmf_fws_del_interface+0x58/0x68) [<805bc854>] (brcmf_fws_del_interface) from [<805b66ac>] (brcmf_remove_interface+0x40/0x150) [<805b66ac>] (brcmf_remove_interface) from [<805b6870>] (brcmf_detach+0x6c/0xb0) [<805b6870>] (brcmf_detach) from [<805bdbb8>] (brcmf_usb_disconnect+0x30/0x4c) [<805bdbb8>] (brcmf_usb_disconnect) from [<805e5d64>] (usb_unbind_interface+0x5c/0x1e0) [<805e5d64>] (usb_unbind_interface) from [<804aab10>] (device_release_driver_internal+0x154/0x1ec) [<804aab10>] (device_release_driver_internal) from [<804a97f4>] (bus_remove_device+0xcc/0xf8) [<804a97f4>] (bus_remove_device) from [<804a6fc0>] (device_del+0x118/0x308) [<804a6fc0>] (device_del) from [<805e488c>] (usb_disable_device+0xa0/0x1c8) [<805e488c>] (usb_disable_device) from [<805dcf98>] (usb_disconnect+0x70/0x1d8) [<805dcf98>] (usb_disconnect) from [<805ddd84>] (hub_event+0x464/0xf50) [<805ddd84>] (hub_event) from [<80135a70>] (process_one_work+0x138/0x3f8) [<80135a70>] (process_one_work) from [<80135d5c>] (worker_thread+0x2c/0x554) [<80135d5c>] (worker_thread) from [<8013b1a0>] (kthread+0x124/0x154) [<8013b1a0>] (kthread) from [<801010e8>] (ret_from_fork+0x14/0x2c) Exception stack(0xecf8dfb0 to 0xecf8dff8) dfa0: 00000000 00000000 00000000 00000000 dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 ---[ end trace 38d234018e9e2a90 ]--- ------------[ cut here ]------------
--- .../broadcom/brcm80211/brcmfmac/fwsignal.c | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +24 -18
@@ -579,24 +579,6 @@ static bool brcmf_fws_ifidx_match(struct sk_buff *skb, void *arg)return ifidx == *(int *)arg; } -static void brcmf_fws_psq_flush (struct brcmf_fws_info *fws,struct pktq *q, -int ifidx) -{ -bool (*matchfn)(struct sk_buff *,void *) =NULL ; -struct sk_buff *skb; -int prec; - -if (ifidx !=-1 ) - matchfn = brcmf_fws_ifidx_match; -for (prec =0 ; prec < q->num_prec; prec++) { - skb =brcmu_pktq_pdeq_match (q, prec, matchfn, &ifidx); -while (skb) { -brcmu_pkt_buf_free_skb (skb); - skb =brcmu_pktq_pdeq_match (q, prec, matchfn, &ifidx); - } - } -} -static void brcmf_fws_hanger_init (struct brcmf_fws_hanger *hanger) {int i;
@@ -668,6 +650,28 @@ static inline int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,return 0 ; } +static void brcmf_fws_psq_flush (struct brcmf_fws_info *fws,struct pktq *q, +int ifidx) +{ +bool (*matchfn)(struct sk_buff *,void *) =NULL ; +struct sk_buff *skb; +int prec; +u32 hslot; + +if (ifidx !=-1 ) + matchfn = brcmf_fws_ifidx_match; +for (prec =0 ; prec < q->num_prec; prec++) { + skb =brcmu_pktq_pdeq_match (q, prec, matchfn, &ifidx); +while (skb) { + hslot =brcmf_skb_htod_tag_get_field (skb,HSLOT ); +brcmf_fws_hanger_poppkt (&fws->hanger, hslot, &skb, + true); +brcmu_pkt_buf_free_skb (skb); + skb =brcmu_pktq_pdeq_match (q, prec, matchfn, &ifidx); + } + } +} +static int brcmf_fws_hanger_mark_suppressed (struct brcmf_fws_hanger *h,u32 slot_id) {
@@ -2168,6 +2172,8 @@ void brcmf_fws_del_interface(struct brcmf_if *ifp)brcmf_fws_lock (fws); ifp->fws_desc =NULL ;brcmf_dbg (TRACE ,"deleting %s\n" , entry->name); +brcmf_fws_macdesc_cleanup (fws, &fws->desc.iface[ifp->ifidx], + ifp->ifidx);brcmf_fws_macdesc_deinit (entry);brcmf_fws_cleanup (fws, ifp->ifidx);brcmf_fws_unlock (fws);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 198/276 brcmfmac: fix Oops when bringing up interface during USB disconnect
In reply to Greg Kroah-Hartman[ Upstream commit 24d413a31afaee9bbbf79226052c386b01780ce2 ]
Fix a race which leads to an Oops with NULL pointer dereference. The dereference is in brcmf_config_dongle() when cfg_to_ndev() attempts to get net_device structure of interface with index 0 via if2bss mapping. This shouldn't fail because of check for bus being ready in brcmf_netdev_open(), but it's not synchronised with USB disconnect and there is a race: after the check the bus can be marked down and the mapping for interface 0 may be gone.
Solve this by modifying disconnect handling so that the removal of mapping of ifidx to brcmf_if structure happens after netdev removal (which is synchronous with brcmf_netdev_open() thanks to rtln being locked in devinet_ioctl()). This assures brcmf_netdev_open() returns before the mapping is removed during disconnect.
Unable to handle kernel NULL pointer dereference at virtual address 00000008 pgd = bcae2612 [00000008] *pgd=8be73831 Internal error: Oops: 17 [#1] PREEMPT SMP ARM Modules linked in: brcmfmac brcmutil nf_log_ipv4 nf_log_common xt_LOG xt_limit
iptable_mangle xt_connmark xt_tcpudp xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_filter ip_tables x_tables usb_f_mass_storage usb_f_rndis u_ether usb_serial_simple usbserial cdc_acm smsc95xx usbnet ci_hdrc_imx ci_hdrc usbmisc_imx ulpi 8250_exar 8250_pci 8250 8250_base libcomposite configfs udc_core [last unloaded: brcmutil]
CPU: 2 PID: 24478 Comm: ifconfig Not tainted 4.19.23-00078-ga62866d-dirty #115 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) PC is at brcmf_cfg80211_up+0x94/0x29c [brcmfmac] LR is at brcmf_cfg80211_up+0x8c/0x29c [brcmfmac] pc : [<7f26a91c>] lr : [<7f26a914>] psr: a0070013
sp : eca99d28 ip : 00000000 fp : ee9c6c00
r10: 00000036 r9 : 00000000 r8 : ece4002c
r7 : edb5b800 r6 : 00000000 r5 : 80f08448 r4 : edb5b968 r3 : ffffffff r2 : 00000000 r1 : 00000002 r0 : 00000000
Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
Control: 10c5387d Table: 7ca0c04a DAC: 00000051 Process ifconfig (pid: 24478, stack limit = 0xd9e85a0e)
Stack: (0xeca99d28 to 0xeca9a000)
9d20: 00000000 80f873b0 0000000d 80f08448 eca99d68 50d45f32
9d40: 7f27de94 ece40000 80f08448 80f08448 7f27de94 ece4002c 00000000 00000036
9d60: ee9c6c00 7f27262c 00001002 50d45f32 ece40000 00000000 80f08448 80772008
9d80: 00000001 00001043 00001002 ece40000 00000000 50d45f32 ece40000 00000001
9da0: 80f08448 00001043 00001002 807723d0 00000000 50d45f32 80f08448 eca99e58
9dc0: 80f87113 50d45f32 80f08448 ece40000 ece40138 00001002 80f08448 00000000
9de0: 00000000 80772434 edbd5380 eca99e58 edbd5380 80f08448 ee9c6c0c 80805f70
9e00: 00000000 ede08e00 00008914 ece40000 00000014 ee9c6c0c 600c0013 00001043
9e20: 0208a8c0 ffffffff 00000000 50d45f32 eca98000 80f08448 7ee9fc38 00008914
9e40: 80f68e40 00000051 eca98000 00000036 00000003 80808b9c 6e616c77 00000030
9e60: 00000000 00000000 00001043 0208a8c0 ffffffff 00000000 80f08448 00000000
9e80: 00000000 816d8b20 600c0013 00000001 ede09320 801763d4 00000000 50d45f32
9ea0: eca98000 80f08448 7ee9fc38 50d45f32 00008914 80f08448 7ee9fc38 80f68e40
9ec0: ed531540 8074721c 00000800 00000001 00000000 6e616c77 00000030 00000000
9ee0: 00000000 00001002 0208a8c0 ffffffff 00000000 50d45f32 80f08448 7ee9fc38
9f00: ed531560 ec8fc900 80285a6c 80285138 edb910c0 00000000 ecd91008 ede08e00
9f20: 80f08448 00000000 00000000 816d8b20 600c0013 00000001 ede09320 801763d4
9f40: 00000000 50d45f32 00021000 edb91118 edb910c0 80f08448 01b29000 edb91118
9f60: eca99f7c 50d45f32 00021000 ec8fc900 00000003 ec8fc900 00008914 7ee9fc38
9f80: eca98000 00000036 00000003 80285a6c 00086364 7ee9fe1c 000000c3 00000036
9fa0: 801011c4 80101000 00086364 7ee9fe1c 00000003 00008914 7ee9fc38 00086364
9fc0: 00086364 7ee9fe1c 000000c3 00000036 0008630c 7ee9fe1c 7ee9fc38 00000003
9fe0: 000a42b8 7ee9fbd4 00019914 76e09acc 600c0010 00000003 00000000 00000000 [<7f26a91c>] (brcmf_cfg80211_up [brcmfmac]) from [<7f27262c>] (brcmf_netdev_open+0x74/0xe8 [brcmfmac]) [<7f27262c>] (brcmf_netdev_open [brcmfmac]) from [<80772008>] (__dev_open+0xcc/0x150) [<80772008>] (__dev_open) from [<807723d0>] (__dev_change_flags+0x168/0x1b4) [<807723d0>] (__dev_change_flags) from [<80772434>] (dev_change_flags+0x18/0x48) [<80772434>] (dev_change_flags) from [<80805f70>] (devinet_ioctl+0x67c/0x79c) [<80805f70>] (devinet_ioctl) from [<80808b9c>] (inet_ioctl+0x210/0x3d4)
[<80808b9c>] (inet_ioctl) from [<8074721c>] (sock_ioctl+0x350/0x524)
[<8074721c>] (sock_ioctl) from [<80285138>] (do_vfs_ioctl+0xb0/0x9b0)
[<80285138>] (do_vfs_ioctl) from [<80285a6c>] (ksys_ioctl+0x34/0x5c)
[<80285a6c>] (ksys_ioctl) from [<80101000>] (ret_fast_syscall+0x0/0x28)
Exception stack(0xeca99fa8 to 0xeca99ff0) 9fa0: 00086364 7ee9fe1c 00000003 00008914 7ee9fc38 00086364 9fc0: 00086364 7ee9fe1c 000000c3 00000036 0008630c 7ee9fe1c 7ee9fc38 00000003 9fe0: 000a42b8 7ee9fbd4 00019914 76e09acc Code: e5970328 eb002021 e1a02006 e3a01002 (e5909008) ---[ end trace 5cbac2333f3ac5df ]---
--- .../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +7 -3
@@ -784,17 +784,17 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx, bool rtnl_locked) {struct brcmf_if *ifp; +int ifidx; ifp = drvr->iflist[bsscfgidx]; - drvr->iflist[bsscfgidx] =NULL ;if (!ifp) {brcmf_err ("Null interface, bsscfgidx=%d\n" , bsscfgidx);return ; }brcmf_dbg (TRACE ,"Enter, bsscfgidx=%d, ifidx=%d\n" , bsscfgidx, ifp->ifidx); -if (drvr->if2bss[ifp->ifidx] == bsscfgidx) - drvr->if2bss[ifp->ifidx] =BRCMF_BSSIDX_INVALID ; + ifidx = ifp->ifidx; +if (ifp->ndev) {if (bsscfgidx ==0 ) {if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
@@ -822,6 +822,10 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,brcmf_p2p_ifp_removed (ifp, rtnl_locked);kfree (ifp); } + + drvr->iflist[bsscfgidx] =NULL ; +if (drvr->if2bss[ifidx] == bsscfgidx) + drvr->if2bss[ifidx] =BRCMF_BSSIDX_INVALID ; }void brcmf_remove_interface (struct brcmf_if *ifp,bool rtnl_locked)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 206/276 x86/uaccess, ftrace: Fix ftrace_likely_update() vs. SMAP
In reply to Greg Kroah-Hartman[ Upstream commit 4a6c91fbdef846ec7250b82f2eeeb87ac5f18cf9 ]
For CONFIG_TRACE_BRANCH_PROFILING=y the likely/unlikely things get overloaded and generate callouts to this code, and thus also when AC=1.
Make it safe.
--- kernel/trace/trace_branch.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/trace/trace_branch.c +4 -0
@@ -205,6 +205,8 @@ void trace_likely_condition(struct ftrace_likely_data *f, int val, int expect)void ftrace_likely_update (struct ftrace_likely_data *f,int val,int expect,int is_constant) { +unsigned long flags =user_access_save (); +/* A constant is always correct */ if (is_constant) { f->constant++;
@@ -223,6 +225,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, f->data.correct++; else f->data.incorrect++; + +user_access_restore (flags); }EXPORT_SYMBOL (ftrace_likely_update);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 204/276 arm64: cpu_ops: fix a leaked reference by adding missing of_node_put
In reply to Greg Kroah-Hartman[ Upstream commit 92606ec9285fb84cd9b5943df23f07d741384bfc ]
The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./arch/arm64/kernel/cpu_ops.c:102:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 69, but without a corresponding object release within this function.
--- arch/arm64/kernel/cpu_ops.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kernel/cpu_ops.c +1 -0
@@ -85,6 +85,7 @@ static const char *__init cpu_read_enable_method(int cpu)pr_err ("%pOF: missing enable-method property\n" , dn); } +of_node_put (dn); }else { enable_method =acpi_get_enable_method (cpu);if (!enable_method) {
Signature · 9 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 214/276 ASoC: eukrea-tlv320: fix a leaked reference by adding missing of_node_put
In reply to Greg Kroah-Hartman[ Upstream commit b820d52e7eed7b30b2dfef5f4213a2bc3cbea6f3 ]
The call to of_parse_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./sound/soc/fsl/eukrea-tlv320.c:121:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 102, but without a correspo nding object release within this function.
./sound/soc/fsl/eukrea-tlv320.c:127:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 102, but without a correspo nding object release within this function.
--- sound/soc/fsl/eukrea-tlv320.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/fsl/eukrea-tlv320.c +2 -2
@@ -118,13 +118,13 @@ static int eukrea_tlv320_probe(struct platform_device *pdev)if (ret) {dev_err (&pdev->dev,"fsl,mux-int-port node missing or invalid.\n" ); -return ret; + goto err; } ret =of_property_read_u32 (np,"fsl,mux-ext-port" , &ext_port);if (ret) {dev_err (&pdev->dev,"fsl,mux-ext-port node missing or invalid.\n" ); -return ret; + goto err; }/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 215/276 ASoC: fsl_utils: fix a leaked reference by adding missing of_node_put
In reply to Greg Kroah-Hartman[ Upstream commit c705247136a523488eac806bd357c3e5d79a7acd ]
The call to of_parse_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./sound/soc/fsl/fsl_utils.c:74:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 38, but without a corresponding object release within this function.
--- sound/soc/fsl/fsl_utils.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/fsl/fsl_utils.c +1 -0
@@ -71,6 +71,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, iprop =of_get_property (dma_np,"cell-index" ,NULL );if (!iprop) {of_node_put (dma_np); +of_node_put (dma_channel_np);return -EINVAL ; } *dma_id =be32_to_cpup (iprop);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 236/276 scsi: qla4xxx: avoid freeing unallocated dma memory
In reply to Greg Kroah-Hartman[ Upstream commit 608f729c31d4caf52216ea00d20092a80959256d ]
Clang -Wuninitialized notices that on is_qla40XX we never allocate any DMA memory in get_fw_boot_info() but attempt to free it anyway:
drivers/scsi/qla4xxx/ql4_os.c:5915:7: error: variable 'buf_dma' is used uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
if (!(val & 0x07)) {
^~~~~~~~~~~~~
drivers/scsi/qla4xxx/ql4_os.c:5985:47: note: uninitialized use occurs here
dma_free_coherent(&ha->pdev->dev, size, buf, buf_dma);
^~~~~~~
drivers/scsi/qla4xxx/ql4_os.c:5915:3: note: remove the 'if' if its condition is always true
if (!(val & 0x07)) {
^~~~~~~~~~~~~~~~~~~
drivers/scsi/qla4xxx/ql4_os.c:5885:20: note: initialize the variable 'buf_dma' to silence this warning
dma_addr_t buf_dma;
^
= 0Skip the call to dma_free_coherent() here.
--- drivers/scsi/qla4xxx/ql4_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla4xxx/ql4_os.c +1 -1
@@ -5935,7 +5935,7 @@ static int get_fw_boot_info(struct scsi_qla_host *ha, uint16_t ddb_index[]) val =rd_nvram_byte (ha, sec_addr);if (val &BIT_7 ) ddb_index[1 ] = (val &0x7f ); - + goto exit_boot_info; }else if (is_qla80XX (ha)) { buf =dma_alloc_coherent (&ha->pdev->dev, size, &buf_dma,GFP_KERNEL );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 245/276 thunderbolt: property: Fix a NULL pointer dereference
In reply to Greg Kroah-Hartman[ Upstream commit 106204b56f60abf1bead7dceb88f2be3e34433da ]
In case kzalloc fails, the fix releases resources and returns -ENOMEM to avoid the NULL pointer dereference.
--- drivers/thunderbolt/property.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/thunderbolt/property.c +5 -0
@@ -551,6 +551,11 @@ int tb_property_add_data(struct tb_property_dir *parent, const char *key, property->length = size /4 ; property->value.data =kzalloc (size,GFP_KERNEL ); +if (!property->value.data) { +kfree (property); +return -ENOMEM ; + } +memcpy (property->value.data, buf, buflen);list_add_tail (&property->list, &parent->properties);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 246/276 e1000e: Disable runtime PM on CNP+
In reply to Greg Kroah-Hartman[ Upstream commit 459d69c407f9ba122f12216555c3012284dc9fd7 ]
There are some new e1000e devices can only be woken up from D3 one time, by plugging Ethernet cable. Subsequent cable plugging does set PME bit correctly, but it still doesn't get woken up.
Since e1000e connects to the root complex directly, we rely on ACPI to wake it up. In this case, the GPE from _PRW only works once and stops working after that. Though it appears to be a platform bug, e1000e maintainers confirmed that I219 does not support D3.
So disable runtime PM on CNP+ chips. We may need to disable earlier generations if this bug also hit older platforms.
Bugzilla: https://bugzilla.kernel.org/attachment.cgi?id=280819
--- drivers/net/ethernet/intel/e1000e/netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/e1000e/netdev.c +1 -1
@@ -7329,7 +7329,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NEVER_SKIP ); -if (pci_dev_run_wake (pdev)) +if (pci_dev_run_wake (pdev) && hw->mac.type < e1000_pch_cnp)pm_runtime_put_noidle (&pdev->dev);return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 251/276 media: m88ds3103: serialize reset messages in m88ds3103_set_frontend
In reply to Greg Kroah-Hartman[ Upstream commit 981fbe3da20a6f35f17977453bce7dfc1664d74f ]
Ref: https://bugzilla.kernel.org/show_bug.cgi?id=199323
Users are experiencing problems with the DVBSky S960/S960C USB devices since the following commit:
9d659ae: ("locking/mutex: Add lock handoff to avoid starvation")
The device malfunctions after running for an indeterminable period of time, and the problem can only be cleared by rebooting the machine.
It is possible to encourage the problem to surface by blocking the signal to the LNB.
Further debugging revealed the cause of the problem.
In the following capture:
- thread #1325 is running m88ds3103_set_frontend
- thread #42 is running ts2020_stat_work
a> [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 07 80
[1325] usb 1-1: dvb_usb_v2_generic_io: <<< 08
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 68 3f
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 08 ff
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 3d
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
b> [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 07 00
[1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 21
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 66
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11 [1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07 [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 60 02 10 0b [1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07
Two i2c messages are sent to perform a reset in m88ds3103_set_frontend:
a. 0x07, 0x80
b. 0x07, 0x00
However, as shown in the capture, the regmap mutex is being handed over to another thread (ts2020_stat_work) in between these two messages.
Quoted 1 line
From here, the device responds to every i2c message with an 07 message,
and will only return to normal operation following a power cycle.
Use regmap_multi_reg_write to group the two reset messages, ensuring both are processed before the regmap mutex is unlocked.
--- drivers/media/dvb-frontends/m88ds3103.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/media/dvb-frontends/m88ds3103.c +4 -5
@@ -309,6 +309,9 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)u16 u16tmp;u32 tuner_frequency_khz, target_mclk;s32 s32tmp; +static const struct reg_sequence reset_buf[] = { + {0x07 ,0x80 }, {0x07 ,0x00 } + }; dev_dbg(&client->dev, "delivery_system=%d modulation=%d frequency=%u symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n",
@@ -321,11 +324,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) }/* reset */ - ret =regmap_write (dev->regmap,0x07 ,0x80 ); -if (ret) - goto err; - - ret =regmap_write (dev->regmap,0x07 ,0x00 ); + ret =regmap_multi_reg_write (dev->regmap, reset_buf,2 );if (ret) goto err;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 257/276 media: gspca: do not resubmit URBs when streaming has stopped
In reply to Greg Kroah-Hartman[ Upstream commit e6f8bd59c28f758feea403a70d6c3ef28c50959f ]
When streaming is stopped all URBs are killed, but in fill_frame and in bulk_irq this results in an attempt to resubmit the killed URB. That is not what you want and causes spurious kernel messages.
So check if streaming has stopped before resubmitting.
Also check against gspca_dev->streaming rather than vb2_start_streaming_called() since vb2_start_streaming_called() will return true when in stop_streaming, but gspca_dev->streaming is set to false when stop_streaming is called.
--- drivers/media/usb/gspca/gspca.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/usb/gspca/gspca.c +6 -2
@@ -314,6 +314,8 @@ static void fill_frame(struct gspca_dev *gspca_dev, } resubmit: +if (!gspca_dev->streaming) +return ;/* resubmit the URB */ st =usb_submit_urb (urb,GFP_ATOMIC );if (st <0 )
@@ -330,7 +332,7 @@ static void isoc_irq(struct urb *urb)struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context;gspca_dbg (gspca_dev,D_PACK ,"isoc irq\n" ); -if (!vb2_start_streaming_called (&gspca_dev->queue)) +if (!gspca_dev->streaming)return ;fill_frame (gspca_dev, urb); }
@@ -344,7 +346,7 @@ static void bulk_irq(struct urb *urb)int st;gspca_dbg (gspca_dev,D_PACK ,"bulk irq\n" ); -if (!vb2_start_streaming_called (&gspca_dev->queue)) +if (!gspca_dev->streaming)return ;switch (urb->status) {case 0 :
@@ -367,6 +369,8 @@ static void bulk_irq(struct urb *urb) urb->actual_length); resubmit: +if (!gspca_dev->streaming) +return ;/* resubmit the URB */ if (gspca_dev->cam.bulk_nurbs !=0 ) { st =usb_submit_urb (urb,GFP_ATOMIC );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 259/276 media: vimc: zero the media_device on probe
In reply to Greg Kroah-Hartman[ Upstream commit f74267b51cb36321f777807b2e04ca02167ecc08 ]
The media_device is part of a static global vimc_device struct. The media framework expects this to be zeroed before it is used, however, since this is a global this is not the case if vimc is unbound and then bound again.
So call memset to ensure any left-over values are cleared.
--- drivers/media/platform/vimc/vimc-core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/vimc/vimc-core.c +2 -0
@@ -303,6 +303,8 @@ static int vimc_probe(struct platform_device *pdev)dev_dbg (&pdev->dev,"probe" ); +memset (&vimc->mdev,0 ,sizeof (vimc->mdev)); +/* Create platform_device for each entity in the topology*/ vimc->subdevs =devm_kcalloc (&vimc->pdev.dev, vimc->pipe_cfg->num_ents,sizeof (*vimc->subdevs),GFP_KERNEL );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 225/276 thunderbolt: Fix to check the return value of kmemdup
In reply to Greg Kroah-Hartman[ Upstream commit fd21b79e541e4666c938a344f3ad2df74b4f5120 ]
uuid in add_switch is allocted via kmemdup which can fail. The patch logs the error and cleans up the allocated memory for switch.
--- drivers/thunderbolt/icm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/thunderbolt/icm.c +5 -0
@@ -476,6 +476,11 @@ static void add_switch(struct tb_switch *parent_sw, u64 route, goto out; sw->uuid =kmemdup (uuid,sizeof (*uuid),GFP_KERNEL ); +if (!sw->uuid) { +tb_sw_warn (sw,"cannot allocate memory for switch\n" ); +tb_switch_put (sw); + goto out; + } sw->connection_id = connection_id; sw->connection_key = connection_key; sw->link = link;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 262/276 media: saa7146: avoid high stack usage with clang
In reply to Greg Kroah-Hartman[ Upstream commit 03aa4f191a36f33fce015387f84efa0eee94408e ]
Two saa7146/hexium files contain a construct that causes a warning when built with clang:
drivers/media/pci/saa7146/hexium_orion.c:210:12: error: stack frame size of 2272 bytes in function 'hexium_probe'
[-Werror,-Wframe-larger-than=]
static int hexium_probe(struct saa7146_dev *dev)
^
drivers/media/pci/saa7146/hexium_gemini.c:257:12: error: stack frame size of 2304 bytes in function 'hexium_attach'
[-Werror,-Wframe-larger-than=]
static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
^This one happens regardless of KASAN, and the problem is that a constructor to initialize a dynamically allocated structure leads to a copy of that structure on the stack, whereas gcc initializes it in place.
--- drivers/media/pci/saa7146/hexium_gemini.c | 5 ++--- drivers/media/pci/saa7146/hexium_orion.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/media/pci/saa7146/hexium_gemini.c +2 -3
@@ -270,9 +270,8 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d/* enable i2c-port pins */ saa7146_write (dev,MC1 , (MASK_08 |MASK_24 |MASK_10 |MASK_26 )); - hexium->i2c_adapter = (struct i2c_adapter ) { - .name ="hexium gemini" , - }; +strscpy (hexium->i2c_adapter.name,"hexium gemini" , +sizeof (hexium->i2c_adapter.name));saa7146_i2c_adapter_prepare (dev, &hexium->i2c_adapter,SAA7146_I2C_BUS_BIT_RATE_480 );if (i2c_add_adapter (&hexium->i2c_adapter) <0 ) {DEB_S ("cannot register i2c-device. skipping.\n" );
drivers/media/pci/saa7146/hexium_orion.c +2 -3
@@ -231,9 +231,8 @@ static int hexium_probe(struct saa7146_dev *dev)saa7146_write (dev,DD1_STREAM_B ,0x00000000 );saa7146_write (dev,MC2 , (MASK_09 |MASK_25 |MASK_10 |MASK_26 )); - hexium->i2c_adapter = (struct i2c_adapter ) { - .name ="hexium orion" , - }; +strscpy (hexium->i2c_adapter.name,"hexium orion" , +sizeof (hexium->i2c_adapter.name));saa7146_i2c_adapter_prepare (dev, &hexium->i2c_adapter,SAA7146_I2C_BUS_BIT_RATE_480 );if (i2c_add_adapter (&hexium->i2c_adapter) <0 ) {DEB_S ("cannot register i2c-device. skipping.\n" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 265/276 drm/omap: dsi: Fix PM for display blank with paired dss_pll calls
In reply to Greg Kroah-Hartman[ Upstream commit fe4ed1b457943113ee1138c939fbdeede4af6cf3 ]
Currently dsi_display_init_dsi() calls dss_pll_enable() but it is not paired with dss_pll_disable() in dsi_display_uninit_dsi(). This leaves the DSS clocks enabled when the display is blanked wasting about extra 5mW of power while idle.
The clock that is left on by not calling dss_pll_disable() is DSS_CLKCTRL bit 10 OPTFCLKEN_SYS_CLK that is the source clock for DSI PLL.
We can fix this issue by by making the current dsi_pll_uninit() into dsi_pll_disable(). This way we can just call dss_pll_disable() from dsi_display_uninit_dsi() and the code becomes a bit easier to follow.
However, we need to also consider that DSI PLL can be muxed for DVI too as pointed out by Tomi Valkeinen <[email protected]>. In the DVI case, we want to unconditionally disable the clocks. To get around this issue, we separate out the DSI lane handling from dsi_pll_enable() and dsi_pll_disable() as suggested by Tomi in an earlier experimental patch.
So we must only toggle the DSI regulator based on the vdds_dsi_enabled flag from dsi_display_init_dsi() and dsi_display_uninit_dsi().
We need to make these two changes together to avoid breaking things for DVI when fixing the DSI clock handling. And this all causes a slight renumbering of the error path for dsi_display_init_dsi().
--- drivers/gpu/drm/omapdrm/dss/dsi.c | 60 ++++++++++++++++--------------- 1 file changed, 31 insertions(+), 29 deletions(-)
drivers/gpu/drm/omapdrm/dss/dsi.c +31 -29
@@ -1386,12 +1386,9 @@ static int dsi_pll_enable(struct dss_pll *pll)*/ dsi_enable_scp_clk (dsi); -if (!dsi->vdds_dsi_enabled) { - r =regulator_enable (dsi->vdds_dsi_reg); -if (r) - goto err0; - dsi->vdds_dsi_enabled = true; - } + r =regulator_enable (dsi->vdds_dsi_reg); +if (r) + goto err0;/* XXX PLL does not come out of reset without this... */ dispc_pck_free_enable (dsi->dss->dispc,1 );
@@ -1416,36 +1413,25 @@ static int dsi_pll_enable(struct dss_pll *pll)return 0 ; err1: -if (dsi->vdds_dsi_enabled) { -regulator_disable (dsi->vdds_dsi_reg); - dsi->vdds_dsi_enabled = false; - } +regulator_disable (dsi->vdds_dsi_reg); err0:dsi_disable_scp_clk (dsi);dsi_runtime_put (dsi);return r; } -static void dsi_pll_uninit (struct dsi_data *dsi,bool disconnect_lanes) +static void dsi_pll_disable (struct dss_pll *pll) { + struct dsi_data *dsi = container_of(pll, struct dsi_data, pll); +dsi_pll_power (dsi,DSI_PLL_POWER_OFF ); -if (disconnect_lanes) { -WARN_ON (!dsi->vdds_dsi_enabled); -regulator_disable (dsi->vdds_dsi_reg); - dsi->vdds_dsi_enabled = false; - } + +regulator_disable (dsi->vdds_dsi_reg);dsi_disable_scp_clk (dsi);dsi_runtime_put (dsi); -DSSDBG ("PLL uninit done\n" ); -} - -static void dsi_pll_disable (struct dss_pll *pll) -{ - struct dsi_data *dsi = container_of(pll, struct dsi_data, pll); - -dsi_pll_uninit (dsi, true); +DSSDBG ("PLL disable done\n" ); }static void dsi_dump_dsi_clocks (struct dsi_data *dsi,struct seq_file *s)
@@ -4195,11 +4181,11 @@ static int dsi_display_init_dsi(struct dsi_data *dsi) r =dss_pll_enable (&dsi->pll);if (r) - goto err0; +return r; r =dsi_configure_dsi_clocks (dsi);if (r) - goto err1; + goto err0; dss_select_dsi_clk_source(dsi->dss, dsi->module_id, dsi->module_id == 0 ?
@@ -4207,6 +4193,14 @@ static int dsi_display_init_dsi(struct dsi_data *dsi)DSSDBG ("PLL OK\n" ); +if (!dsi->vdds_dsi_enabled) { + r =regulator_enable (dsi->vdds_dsi_reg); +if (r) + goto err1; + + dsi->vdds_dsi_enabled = true; + } + r =dsi_cio_init (dsi);if (r) goto err2;
@@ -4235,10 +4229,13 @@ static int dsi_display_init_dsi(struct dsi_data *dsi) err3:dsi_cio_uninit (dsi); err2: -dss_select_dsi_clk_source (dsi->dss, dsi->module_id,DSS_CLK_SRC_FCK ); +regulator_disable (dsi->vdds_dsi_reg); + dsi->vdds_dsi_enabled = false; err1: -dss_pll_disable (&dsi->pll); +dss_select_dsi_clk_source (dsi->dss, dsi->module_id,DSS_CLK_SRC_FCK ); err0: +dss_pll_disable (&dsi->pll); +return r; }
@@ -4257,7 +4254,12 @@ static void dsi_display_uninit_dsi(struct dsi_data *dsi, bool disconnect_lanes,dss_select_dsi_clk_source (dsi->dss, dsi->module_id,DSS_CLK_SRC_FCK );dsi_cio_uninit (dsi); -dsi_pll_uninit (dsi, disconnect_lanes); +dss_pll_disable (&dsi->pll); + +if (disconnect_lanes) { +regulator_disable (dsi->vdds_dsi_reg); + dsi->vdds_dsi_enabled = false; + } }static int dsi_display_enable (struct omap_dss_device *dssdev)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 269/276 ASoC: davinci-mcasp: Fix clang warning without CONFIG_PM
In reply to Greg Kroah-Hartman[ Upstream commit 8ca5104715cfd14254ea5aecc390ae583b707607 ]
Building with clang shows a variable that is only used by the suspend/resume functions but defined outside of their #ifdef block:
sound/soc/ti/davinci-mcasp.c:48:12: error: variable 'context_regs' is not needed and will not be emitted
We commonly fix these by marking the PM functions as __maybe_unused, but here that would grow the davinci_mcasp structure, so instead add another #ifdef here.
--- sound/soc/davinci/davinci-mcasp.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/davinci/davinci-mcasp.c +2 -0
@@ -43,6 +43,7 @@#define MCASP_MAX_AFIFO_DEPTH 64 +#ifdef CONFIG_PM static u32 context_regs[] = {DAVINCI_MCASP_TXFMCTL_REG , DAVINCI_MCASP_RXFMCTL_REG,
@@ -65,6 +66,7 @@ struct davinci_mcasp_context {u32 *xrsr_regs;/* for serializer configuration */ bool pm_state; }; +#endif struct davinci_mcasp_ruledata {struct davinci_mcasp *mcasp;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 226/276 timekeeping: Force upper bound for setting CLOCK_REALTIME
In reply to Greg Kroah-Hartman[ Upstream commit 7a8e61f8478639072d402a26789055a4a4de8f77 ]
Several people reported testing failures after setting CLOCK_REALTIME close to the limits of the kernel internal representation in nanoseconds, i.e. year 2262.
The failures are exposed in subsequent operations, i.e. when arming timers or when the advancing CLOCK_MONOTONIC makes the calculation of CLOCK_REALTIME overflow into negative space.
Now people start to paper over the underlying problem by clamping calculations to the valid range, but that's just wrong because such workarounds will prevent detection of real issues as well.
It is reasonable to force an upper bound for the various methods of setting CLOCK_REALTIME. Year 2262 is the absolute upper bound. Assume a maximum uptime of 30 years which is plenty enough even for esoteric embedded systems. That results in an upper bound of year 2232 for setting the time.
Once that limit is reached in reality this limit is only a small part of the problem space. But until then this stops people from trying to paper over the problem at the wrong places.
--- include/linux/time64.h | 21 +++++++++++++++++++++ kernel/time/time.c | 2 +- kernel/time/timekeeping.c | 6 +++--- 3 files changed, 25 insertions(+), 4 deletions(-)
include/linux/time64.h +21 -0
@@ -41,6 +41,17 @@ struct itimerspec64 {#define KTIME_MAX ((s64)~((u64)1 << 63))#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) +/* +* Limits for settimeofday(): +* +* To prevent setting the time close to the wraparound point time setting +* is limited so a reasonable uptime can be accomodated. Uptime of 30 years +* should be really sufficient, which means the cutoff is 2232. At that +* point the cutoff is just a small part of the larger problem. +*/ +#define TIME_UPTIME_SEC_MAX (30LL * 365 * 24 *3600) +#define TIME_SETTOD_SEC_MAX (KTIME_SEC_MAX - TIME_UPTIME_SEC_MAX) +static inline int timespec64_equal (const struct timespec64 *a,const struct timespec64 *b) {
@@ -108,6 +119,16 @@ static inline bool timespec64_valid_strict(const struct timespec64 *ts)return true; } +static inline bool timespec64_valid_settod (const struct timespec64 *ts) +{ +if (!timespec64_valid (ts)) +return false; +/* Disallow values which cause overflow issues vs. CLOCK_REALTIME */ +if ((unsigned long long )ts->tv_sec >=TIME_SETTOD_SEC_MAX ) +return false; +return true; +} +/** * timespec64_to_ns - Convert timespec64 to nanoseconds * @ts: pointer to the timespec64 variable to be converted
kernel/time/time.c +1 -1
@@ -172,7 +172,7 @@ int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone *tzstatic int firsttime =1 ;int error =0 ; -if (tv && !timespec64_valid (tv)) +if (tv && !timespec64_valid_settod (tv))return -EINVAL ; error =security_settime64 (tv, tz);
kernel/time/timekeeping.c +3 -3
@@ -1242,7 +1242,7 @@ int do_settimeofday64(const struct timespec64 *ts)unsigned long flags;int ret =0 ; -if (!timespec64_valid_strict (ts)) +if (!timespec64_valid_settod (ts))return -EINVAL ;raw_spin_lock_irqsave (&timekeeper_lock, flags);
@@ -1299,7 +1299,7 @@ static int timekeeping_inject_offset(const struct timespec64 *ts)/* Make sure the proposed value is valid */ tmp =timespec64_add (tk_xtime (tk), *ts);if (timespec64_compare (&tk->wall_to_monotonic, ts) >0 || - !timespec64_valid_strict (&tmp)) { + !timespec64_valid_settod (&tmp)) { ret = -EINVAL ; goto error; }
@@ -1556,7 +1556,7 @@ void __init timekeeping_init(void)unsigned long flags;read_persistent_wall_and_boot_offset (&wall_time, &boot_offset); -if (timespec64_valid_strict (&wall_time) && +if (timespec64_valid_settod (&wall_time) &×pec64_to_ns (&wall_time) >0 ) { persistent_clock_exists = true; }else if (timespec64_to_ns (&wall_time) !=0 ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 272/276 drm: Wake up next in drm_read() chain if we are forced to putback the event
In reply to Greg Kroah-Hartman[ Upstream commit 60b801999c48b6c1dd04e653a38e2e613664264e ]
After an event is sent, we try to copy it into the user buffer of the first waiter in drm_read() and if the user buffer doesn't have enough room we put it back onto the list. However, we didn't wake up any subsequent waiter, so that event may sit on the list until either a new vblank event is sent or a new waiter appears. Rare, but in the worst case may lead to a stuck process.
Testcase: igt/drm_read/short-buffer-wakeup
--- drivers/gpu/drm/drm_file.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_file.c +1 -0
@@ -567,6 +567,7 @@ ssize_t drm_read(struct file *filp, char __user *buffer, file_priv->event_space -= length;list_add (&e->link, &file_priv->event_list);spin_unlock_irq (&dev->event_lock); +wake_up_interruptible (&file_priv->event_wait);break ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 274/276 vfio-ccw: Prevent quiesce function going into an infinite loop
In reply to Greg Kroah-Hartman[ Upstream commit d1ffa760d22aa1d8190478e5ef555c59a771db27 ]
The quiesce function calls cio_cancel_halt_clear() and if we get an -EBUSY we go into a loop where we:
- wait for any interrupts
- flush all I/O in the workqueue
- retry cio_cancel_halt_clear
During the period where we are waiting for interrupts or flushing all I/O, the channel subsystem could have completed a halt/clear action and turned off the corresponding activity control bits in the subchannel status word. This means the next time we call cio_cancel_halt_clear(), we will again start by calling cancel subchannel and so we can be stuck between calling cancel and halt forever.
Rather than calling cio_cancel_halt_clear() immediately after waiting, let's try to disable the subchannel. If we succeed in disabling the subchannel then we know nothing else can happen with the device.
Message-Id: <4d5a4b98ab1b41ac6131b5c36de18b76c5d66898.1555449329.git.alifm@linux.ibm.com>
--- drivers/s390/cio/vfio_ccw_drv.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
drivers/s390/cio/vfio_ccw_drv.c +18 -14
@@ -40,26 +40,30 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch)if (ret != -EBUSY ) goto out_unlock; + iretry =255 ;do { - iretry =255 ; ret =cio_cancel_halt_clear (sch, &iretry); -while (ret == -EBUSY ) { -/* -* Flush all I/O and wait for -* cancel/halt/clear completion. -*/ - private->completion = &completion; -spin_unlock_irq (sch->lock); -wait_for_completion_timeout (&completion,3 *HZ ); +if (ret == -EIO ) { +pr_err ("vfio_ccw: could not quiesce subchannel 0.%x.%04x!\n" , + sch->schid.ssid, sch->schid.sch_no); +break ; + } + +/* +* Flush all I/O and wait for +* cancel/halt/clear completion. +*/ + private->completion = &completion; +spin_unlock_irq (sch->lock); - private->completion =NULL ; -flush_workqueue (vfio_ccw_work_q); -spin_lock_irq (sch->lock); - ret =cio_cancel_halt_clear (sch, &iretry); - }; +if (ret == -EBUSY ) +wait_for_completion_timeout (&completion,3 *HZ ); + private->completion =NULL ; +flush_workqueue (vfio_ccw_work_q); +spin_lock_irq (sch->lock); ret =cio_disable_subchannel (sch); }while (ret == -EBUSY ); out_unlock:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 270/276 drm/v3d: Handle errors from IRQ setup.
In reply to Greg Kroah-Hartman[ Upstream commit fc22771547e7e8a63679f0218e943d72b107de65 ]
Noted in review by Dave Emett for V3D 4.2 support.
--- drivers/gpu/drm/v3d/v3d_drv.c | 8 ++++++-- drivers/gpu/drm/v3d/v3d_drv.h | 2 +- drivers/gpu/drm/v3d/v3d_irq.c | 13 +++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.c +6 -2
@@ -305,14 +305,18 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)if (ret) goto dev_destroy; -v3d_irq_init (v3d); + ret =v3d_irq_init (v3d); +if (ret) + goto gem_destroy; ret =drm_dev_register (drm,0 );if (ret) - goto gem_destroy; + goto irq_disable;return 0 ; +irq_disable: +v3d_irq_disable (v3d); gem_destroy:v3d_gem_destroy (drm); dev_destroy:
drivers/gpu/drm/v3d/v3d_drv.h +1 -1
@@ -284,7 +284,7 @@ void v3d_invalidate_caches(struct v3d_dev *v3d);void v3d_flush_caches (struct v3d_dev *v3d);/* v3d_irq.c */ -void v3d_irq_init (struct v3d_dev *v3d); +int v3d_irq_init (struct v3d_dev *v3d);void v3d_irq_enable (struct v3d_dev *v3d);void v3d_irq_disable (struct v3d_dev *v3d);void v3d_irq_reset (struct v3d_dev *v3d);
drivers/gpu/drm/v3d/v3d_irq.c +11 -2
@@ -137,7 +137,7 @@ v3d_hub_irq(int irq, void *arg)return status; } -void +int v3d_irq_init (struct v3d_dev *v3d) {int ret, core;
@@ -154,13 +154,22 @@ v3d_irq_init(struct v3d_dev *v3d) ret =devm_request_irq (v3d->dev,platform_get_irq (v3d->pdev,0 ), v3d_hub_irq,IRQF_SHARED ,"v3d_hub" , v3d); +if (ret) + goto fail; + ret =devm_request_irq (v3d->dev,platform_get_irq (v3d->pdev,1 ), v3d_irq,IRQF_SHARED ,"v3d_core0" , v3d);if (ret) -dev_err (v3d->dev,"IRQ setup failed: %d\n" , ret); + goto fail;v3d_irq_enable (v3d); +return 0 ; + +fail: +if (ret != -EPROBE_DEFER ) +dev_err (v3d->dev,"IRQ setup failed: %d\n" , ret); +return ret; }void
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 1/276 x86: Hide the int3_emulate_call/jmp functions from UML
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
commit 693713cbdb3a4bda5a8a678c31f06560bbb14657 upstream.
User Mode Linux does not have access to the ip or sp fields of the pt_regs, and accessing them causes UML to fail to build. Hide the int3_emulate_jmp() and int3_emulate_call() instructions from UML, as it doesn't need them anyway.
--- arch/x86/include/asm/text-patching.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/include/asm/text-patching.h +3 -1
@@ -39,6 +39,7 @@ extern int poke_int3_handler(struct pt_rextern void *text_poke_bp (void *addr,const void *opcode,size_t len,void *handler);extern int after_bootmem; +#ifndef CONFIG_UML_X86 static inline void int3_emulate_jmp (struct pt_regs *regs,unsigned long ip) { regs->ip = ip;
@@ -65,6 +66,7 @@ static inline void int3_emulate_call(strint3_emulate_push (regs, regs->ip -INT3_INSN_SIZE +CALL_INSN_SIZE );int3_emulate_jmp (regs, func); } -#endif +#endif /* CONFIG_X86_64 */ +#endif /* !CONFIG_UML_X86 */ #endif /* _ASM_X86_TEXT_PATCHING_H */
Greg Kroah-Hartman
maintainerPATCH 38/276 ssb: Fix possible NULL pointer dereference in ssb_host_pcmcia_exit
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
commit b2c01aab9646ed8ffb7c549afe55d5349c482425 upstream.
Syzkaller report this:
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP KASAN PTI CPU: 0 PID: 4492 Comm: syz-executor.0 Not tainted 5.0.0-rc7+ #45 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 RIP: 0010:sysfs_remove_file_ns+0x27/0x70 fs/sysfs/file.c:468 Code: 00 00 00 41 54 55 48 89 fd 53 49 89 d4 48 89 f3 e8 ee 76 9c ff 48 8d 7d 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 75 2d 48 89 da 48 b8 00 00 00 00 00 fc ff df 48 8b 6d RSP: 0018:ffff8881e9d9fc00 EFLAGS: 00010206 RAX: dffffc0000000000 RBX: ffffffff900367e0 RCX: ffffffff81a95952 RDX: 0000000000000006 RSI: ffffc90001405000 RDI: 0000000000000030 RBP: 0000000000000000 R08: fffffbfff1fa22ed R09: fffffbfff1fa22ed R10: 0000000000000001 R11: fffffbfff1fa22ec R12: 0000000000000000 R13: ffffffffc1abdac0 R14: 1ffff1103d3b3f8b R15: 0000000000000000 FS: 00007fe409dc1700(0000) GS:ffff8881f1200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b2d721000 CR3: 00000001e98b6005 CR4: 00000000007606f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: sysfs_remove_file include/linux/sysfs.h:519 [inline] driver_remove_file+0x40/0x50 drivers/base/driver.c:122 pcmcia_remove_newid_file drivers/pcmcia/ds.c:163 [inline] pcmcia_unregister_driver+0x7d/0x2b0 drivers/pcmcia/ds.c:209 ssb_modexit+0xa/0x1b [ssb] __do_sys_delete_module kernel/module.c:1018 [inline] __se_sys_delete_module kernel/module.c:961 [inline] __x64_sys_delete_module+0x3dc/0x5e0 kernel/module.c:961 do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x462e99 Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fe409dc0c58 EFLAGS: 00000246 ORIG_RAX: 00000000000000b0 RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000200000c0 RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe409dc16bc R13: 00000000004bccaa R14: 00000000006f6bc8 R15: 00000000ffffffff Modules linked in: ssb(-) 3c59x nvme_core macvlan tap pata_hpt3x3 rt2x00pci null_blk tsc40 pm_notifier_error_inject notifier_error_inject mdio cdc_wdm nf_reject_ipv4 ath9k_common ath9k_hw ath pppox ppp_generic slhc ehci_platform wl12xx wlcore tps6507x_ts ioc4 nf_synproxy_core ide_gd_mod ax25 can_dev iwlwifi can_raw atm tm2_touchkey can_gw can sundance adp5588_keys rt2800mmio rt2800lib rt2x00mmio rt2x00lib eeprom_93cx6 pn533 lru_cache elants_i2c ip_set nfnetlink gameport tipc hampshire nhc_ipv6 nhc_hop nhc_udp nhc_fragment nhc_routing nhc_mobility nhc_dest 6lowpan silead brcmutil nfc mt76_usb mt76 mac80211 iptable_security iptable_raw iptable_mangle iptable_nat nf_nat_ipv4 nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_filter bpfilter ip6_vti ip_gre sit hsr veth vxcan batman_adv cfg80211 rfkill chnl_net caif nlmon vcan bridge stp llc ip6_gre ip6_tunnel tunnel6 tun joydev mousedev serio_raw ide_pci_generic piix floppy ide_core sch_fq_codel ip_tables x_tables ipv6 [last unloaded: 3c59x] Dumping ftrace buffer: (ftrace buffer empty) ---[ end trace 3913cbf8011e1c05 ]---
In ssb_modinit, it does not fail SSB init when ssb_host_pcmcia_init failed, however in ssb_modexit, ssb_host_pcmcia_exit calls pcmcia_unregister_driver unconditionally, which may tigger a NULL pointer dereference issue as above.
--- drivers/ssb/bridge_pcmcia_80211.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/ssb/bridge_pcmcia_80211.c +7 -2
@@ -113,16 +113,21 @@ static struct pcmcia_driver ssb_host_pcm .resume = ssb_host_pcmcia_resume, }; +static int pcmcia_init_failed; +/* * These are not module init/exit functions! * The module_pcmcia_driver() helper cannot be used here. */ int ssb_host_pcmcia_init (void ) { -return pcmcia_register_driver (&ssb_host_pcmcia_driver); + pcmcia_init_failed =pcmcia_register_driver (&ssb_host_pcmcia_driver); + +return pcmcia_init_failed; }void ssb_host_pcmcia_exit (void ) { -pcmcia_unregister_driver (&ssb_host_pcmcia_driver); +if (!pcmcia_init_failed) +pcmcia_unregister_driver (&ssb_host_pcmcia_driver); }
Greg Kroah-Hartman
maintainerPATCH 45/276 cxgb4: Fix error path in cxgb4_init_module
In reply to Greg Kroah-Hartman[ Upstream commit a3147770bea76c8dbad73eca3a24c2118da5e719 ]
BUG: unable to handle kernel paging request at ffffffffa016a270 PGD 3270067 P4D 3270067 PUD 3271063 PMD 230bbd067 PTE 0 Oops: 0000 [#1 CPU: 0 PID: 6134 Comm: modprobe Not tainted 5.1.0+ #33 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014 RIP: 0010:atomic_notifier_chain_register+0x24/0x60 Code: 1f 80 00 00 00 00 55 48 89 e5 41 54 49 89 f4 53 48 89 fb e8 ae b4 38 01 48 8b 53 38 48 8d 4b 38 48 85 d2 74 20 45 8b 44 24 10 <44> 3b 42 10 7e 08 eb 13 44 39 42 10 7c 0d 48 8d 4a 08 48 8b 52 08 RSP: 0018:ffffc90000e2bc60 EFLAGS: 00010086 RAX: 0000000000000292 RBX: ffffffff83467240 RCX: ffffffff83467278 RDX: ffffffffa016a260 RSI: ffffffff83752140 RDI: ffffffff83467240 RBP: ffffc90000e2bc70 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000000 R11: 00000000014fa61f R12: ffffffffa01c8260 R13: ffff888231091e00 R14: 0000000000000000 R15: ffffc90000e2be78 FS: 00007fbd8d7cd540(0000) GS:ffff888237a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffa016a270 CR3: 000000022c7e3000 CR4: 00000000000006f0 Call Trace: register_inet6addr_notifier+0x13/0x20 cxgb4_init_module+0x6c/0x1000 [cxgb4 ? 0xffffffffa01d7000 do_one_initcall+0x6c/0x3cc ? do_init_module+0x22/0x1f1 ? rcu_read_lock_sched_held+0x97/0xb0 ? kmem_cache_alloc_trace+0x325/0x3b0 do_init_module+0x5b/0x1f1 load_module+0x1db1/0x2690 ? m_show+0x1d0/0x1d0 __do_sys_finit_module+0xc5/0xd0 __x64_sys_finit_module+0x15/0x20 do_syscall_64+0x6b/0x1d0 entry_SYSCALL_64_after_hwframe+0x49/0xbe
If pci_register_driver fails, register inet6addr_notifier is pointless. This patch fix the error path in cxgb4_init_module.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +12 -3
@@ -6010,15 +6010,24 @@ static int __init cxgb4_init_module(void) ret =pci_register_driver (&cxgb4_driver);if (ret <0 ) -debugfs_remove (cxgb4_debugfs_root); + goto err_pci;#if IS_ENABLED (CONFIG_IPV6 )if (!inet6addr_registered) { -register_inet6addr_notifier (&cxgb4_inet6addr_notifier); - inet6addr_registered = true; + ret =register_inet6addr_notifier (&cxgb4_inet6addr_notifier); +if (ret) +pci_unregister_driver (&cxgb4_driver); +else + inet6addr_registered = true; }#endif +if (ret ==0 ) +return ret; + +err_pci: +debugfs_remove (cxgb4_debugfs_root); +return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 52/276 bpftool: exclude bash-completion/bpftool from .gitignore pattern
In reply to Greg Kroah-Hartman[ Upstream commit a7d006714724de4334c5e3548701b33f7b12ca96 ]
tools/bpf/bpftool/.gitignore has the "bpftool" pattern, which is intended to ignore the following build artifact:
tools/bpf/bpftool/bpftool
However, the .gitignore entry is effective not only for the current directory, but also for any sub-directories.
So, from the point of .gitignore grammar, the following check-in file is also considered to be ignored:
tools/bpf/bpftool/bash-completion/bpftool
As the manual gitignore(5) says "Files already tracked by Git are not affected", this is not a problem as far as Git is concerned.
However, Git is not the only program that parses .gitignore because .gitignore is useful to distinguish build artifacts from source files.
For example, tar(1) supports the --exclude-vcs-ignore option. As of writing, this option does not work perfectly, but it intends to create a tarball excluding files specified by .gitignore.
So, I believe it is better to fix this issue.
You can fix it by prefixing the pattern with a slash; the leading slash means the specified pattern is relative to the current directory.
--- tools/bpf/bpftool/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/.gitignore +1 -1
@@ -1,5 +1,5 @@ *.d -bpftool +/bpftool bpftool*.8 bpf-helpers.* FEATURE-DUMP.bpftool
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 61/276 ASoC: hdmi-codec: unlock the device on startup errors
In reply to Greg Kroah-Hartman[ Upstream commit 30180e8436046344b12813dc954b2e01dfdcd22d ]
If the hdmi codec startup fails, it should clear the current_substream pointer to free the device. This is properly done for the audio_startup() callback but for snd_pcm_hw_constraint_eld().
Make sure the pointer cleared if an error is reported.
--- sound/soc/codecs/hdmi-codec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/codecs/hdmi-codec.c +5 -1
@@ -439,8 +439,12 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream,if (!ret) { ret =snd_pcm_hw_constraint_eld (substream->runtime, hcp->eld); -if (ret) +if (ret) { +mutex_lock (&hcp->current_stream_lock); + hcp->current_stream =NULL ; +mutex_unlock (&hcp->current_stream_lock);return ret; + } }/* Select chmap supported */ hdmi_codec_eld_chmap (hcp);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 64/276 powerpc/perf: Fix loop exit condition in nest_imc_event_init
In reply to Greg Kroah-Hartman[ Upstream commit 860b7d2286236170a36f94946d03ca9888d32571 ]
The data structure (i.e struct imc_mem_info) to hold the memory address information for nest imc units is allocated based on the number of nodes in the system.
nest_imc_event_init() traverse this struct array to calculate the memory base address for the event-cpu. If we fail to find a match for the event cpu's chip-id in imc_mem_info struct array, then the do-while loop will iterate until we crash.
Fix this by changing the loop exit condition based on the number of non zero vbase elements in the array, since the allocation is done for nr_chips + 1.
--- arch/powerpc/perf/imc-pmu.c | 2 +- arch/powerpc/platforms/powernv/opal-imc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/perf/imc-pmu.c +1 -1
@@ -508,7 +508,7 @@ static int nest_imc_event_init(struct perf_event *event)break ; } pcni++; - }while (pcni); + }while (pcni->vbase !=0 );if (!flag)return -ENODEV ;
arch/powerpc/platforms/powernv/opal-imc.c +1 -1
@@ -127,7 +127,7 @@ static int imc_get_mem_addr_nest(struct device_node *node, nr_chips)) goto error; - pmu_ptr->mem_info =kcalloc (nr_chips,sizeof (*pmu_ptr->mem_info), + pmu_ptr->mem_info =kcalloc (nr_chips +1 ,sizeof (*pmu_ptr->mem_info),GFP_KERNEL );if (!pmu_ptr->mem_info) goto error;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 87/276 s390/kexec_file: Fix detection of text segment in ELF loader
In reply to Greg Kroah-Hartman[ Upstream commit 729829d775c9a5217abc784b2f16087d79c4eec8 ]
To register data for the next kernel (command line, oldmem_base, etc.) the current kernel needs to find the ELF segment that contains head.S. This is currently done by checking ifor 'phdr->p_paddr == 0'. This works fine for the current kernel build but in theory the first few pages could be skipped. Make the detection more robust by checking if the entry point lies within the segment.
--- arch/s390/kernel/kexec_elf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/s390/kernel/kexec_elf.c +6 -1
@@ -19,10 +19,15 @@ static int kexec_file_add_elf_kernel(struct kimage *image,struct kexec_buf buf;const Elf_Ehdr *ehdr;const Elf_Phdr *phdr; +Elf_Addr entry;int i, ret; ehdr = (Elf_Ehdr *)kernel; buf.image = image; +if (image->type ==KEXEC_TYPE_CRASH ) + entry =STARTUP_KDUMP_OFFSET ; +else + entry = ehdr->e_entry; phdr = (void *)ehdr + ehdr->e_phoff;for (i =0 ; i < ehdr->e_phnum; i++, phdr++) {
@@ -35,7 +40,7 @@ static int kexec_file_add_elf_kernel(struct kimage *image, buf.mem =ALIGN (phdr->p_paddr, phdr->p_align); buf.memsz = phdr->p_memsz; -if (phdr->p_paddr ==0 ) { +if (entry - phdr->p_paddr < phdr->p_memsz) { data->kernel_buf = buf.buffer; data->memsz +=STARTUP_NORMAL_OFFSET ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 91/276 dmaengine: pl330: _stop: clear interrupt status
In reply to Greg Kroah-Hartman[ Upstream commit 2da254cc7908105a60a6bb219d18e8dced03dcb9 ]
This patch kill instructs the DMAC to immediately terminate execution of a thread. and then clear the interrupt status, at last, stop generating interrupts for DMA_SEV. to guarantee the next dma start is clean. otherwise, one interrupt maybe leave to next start and make some mistake.
we can reporduce the problem as follows:
DMASEV: modify the event-interrupt resource, and if the INTEN sets function as interrupt, the DMAC will set irq<event_num> HIGH to generate interrupt. write INTCLR to clear interrupt.
DMA EXECUTING INSTRUCTS DMA TERMINATE | | | | ... _stop | | | spin_lock_irqsave DMASEV | | | | mask INTEN | | | DMAKILL | | | spin_unlock_irqrestore
in above case, a interrupt was left, and if we unmask INTEN, the DMAC will set irq<event_num> HIGH to generate interrupt.
to fix this, do as follows:
DMA EXECUTING INSTRUCTS DMA TERMINATE | | | | ... _stop | | | spin_lock_irqsave DMASEV | | | | DMAKILL | | | clear INTCLR | mask INTEN | | | spin_unlock_irqrestore
--- drivers/dma/pl330.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/dma/pl330.c +7 -3
@@ -961,6 +961,7 @@ static void _stop(struct pl330_thread *thrd) {void __iomem *regs = thrd->dmac->base;u8 insn[6 ] = {0 ,0 ,0 ,0 ,0 ,0 }; +u32 inten =readl (regs +INTEN );if (_state (thrd) ==PL330_STATE_FAULT_COMPLETING )UNTIL (thrd,PL330_STATE_FAULTING |PL330_STATE_KILLING );
@@ -973,10 +974,13 @@ static void _stop(struct pl330_thread *thrd)_emit_KILL (0 , insn); -/* Stop generating interrupts for SEV */ -writel (readl (regs +INTEN ) & ~(1 << thrd->ev), regs +INTEN ); -_execute_DBGINSN (thrd, insn,is_manager (thrd)); + +/* clear the event */ +if (inten & (1 << thrd->ev)) +writel (1 << thrd->ev, regs +INTCLR ); +/* Stop generating interrupts for SEV */ +writel (inten & ~(1 << thrd->ev), regs +INTEN ); }/* Start doing req 'idx' of thread 'thrd' */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 94/276 slimbus: fix a potential NULL pointer dereference in of_qcom_slim_ngd_register
In reply to Greg Kroah-Hartman[ Upstream commit 06d5d6b7f9948a89543e1160ef852d57892c750d ]
In case platform_device_alloc fails, the fix returns an error code to avoid the NULL pointer dereference.
--- drivers/slimbus/qcom-ngd-ctrl.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/slimbus/qcom-ngd-ctrl.c +4 -0
@@ -1331,6 +1331,10 @@ static int of_qcom_slim_ngd_register(struct device *parent,return -ENOMEM ; ngd->pdev =platform_device_alloc (QCOM_SLIM_NGD_DRV_NAME , id); +if (!ngd->pdev) { +kfree (ngd); +return -ENOMEM ; + } ngd->id = id; ngd->pdev->dev.parent = parent; ngd->pdev->driver_override =QCOM_SLIM_NGD_DRV_NAME ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 96/276 mwifiex: prevent an array overflow
In reply to Greg Kroah-Hartman[ Upstream commit b4c35c17227fe437ded17ce683a6927845f8c4a4 ]
The "rate_index" is only used as an index into the phist_data->rx_rate[] array in the mwifiex_hist_data_set() function. That array has MWIFIEX_MAX_AC_RX_RATES (74) elements and it's used to generate some debugfs information. The "rate_index" variable comes from the network skb->data[] and it is a u8 so it's in the 0-255 range. We need to cap it to prevent an array overflow.
--- drivers/net/wireless/marvell/mwifiex/cfp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/marvell/mwifiex/cfp.c +3 -0
@@ -531,5 +531,8 @@ u8 mwifiex_adjust_data_rate(struct mwifiex_private *priv, rate_index = (rx_rate >MWIFIEX_RATE_INDEX_OFDM0 ) ? rx_rate -1 : rx_rate; +if (rate_index >=MWIFIEX_MAX_AC_RX_RATES ) + rate_index =MWIFIEX_MAX_AC_RX_RATES -1 ; +return rate_index; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 108/276 vfio-ccw: Do not call flush_workqueue while holding the spinlock
In reply to Greg Kroah-Hartman[ Upstream commit cea5dde42a83b5f0a039da672f8686455936b8d8 ]
Currently we call flush_workqueue while holding the subchannel spinlock. But flush_workqueue function can go to sleep, so do not call the function while holding the spinlock.
Fixes the following bug:
[ 285.203430] BUG: scheduling while atomic: bash/14193/0x00000002 [ 285.203434] INFO: lockdep is turned off. .... [ 285.203485] Preemption disabled at: [ 285.203488] [<000003ff80243e5c>] vfio_ccw_sch_quiesce+0xbc/0x120 [vfio_ccw] [ 285.203496] CPU: 7 PID: 14193 Comm: bash Tainted: G W .... [ 285.203504] Call Trace: [ 285.203510] ([<0000000000113772>] show_stack+0x82/0xd0) [ 285.203514] [<0000000000b7a102>] dump_stack+0x92/0xd0 [ 285.203518] [<000000000017b8be>] __schedule_bug+0xde/0xf8 [ 285.203524] [<0000000000b95b5a>] __schedule+0x7a/0xc38 [ 285.203528] [<0000000000b9678a>] schedule+0x72/0xb0 [ 285.203533] [<0000000000b9bfbc>] schedule_timeout+0x34/0x528 [ 285.203538] [<0000000000b97608>] wait_for_common+0x118/0x1b0 [ 285.203544] [<0000000000166d6a>] flush_workqueue+0x182/0x548 [ 285.203550] [<000003ff80243e6e>] vfio_ccw_sch_quiesce+0xce/0x120 [vfio_ccw] [ 285.203556] [<000003ff80245278>] vfio_ccw_mdev_reset+0x38/0x70 [vfio_ccw] [ 285.203562] [<000003ff802458b0>] vfio_ccw_mdev_remove+0x40/0x78 [vfio_ccw] [ 285.203567] [<000003ff801a499c>] mdev_device_remove_ops+0x3c/0x80 [mdev] [ 285.203573] [<000003ff801a4d5c>] mdev_device_remove+0xc4/0x130 [mdev] [ 285.203578] [<000003ff801a5074>] remove_store+0x6c/0xa8 [mdev] [ 285.203582] [<000000000046f494>] kernfs_fop_write+0x14c/0x1f8 [ 285.203588] [<00000000003c1530>] __vfs_write+0x38/0x1a8 [ 285.203593] [<00000000003c187c>] vfs_write+0xb4/0x198 [ 285.203597] [<00000000003c1af2>] ksys_write+0x5a/0xb0 [ 285.203601] [<0000000000b9e270>] system_call+0xdc/0x2d8
Message-Id: <626bab8bb2958ae132452e1ddaf1b20882ad5a9d.1554756534.git.alifm@linux.ibm.com>
--- drivers/s390/cio/vfio_ccw_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/cio/vfio_ccw_drv.c +1 -1
@@ -54,9 +54,9 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch)wait_for_completion_timeout (&completion,3 *HZ ); -spin_lock_irq (sch->lock); private->completion =NULL ;flush_workqueue (vfio_ccw_work_q); +spin_lock_irq (sch->lock); ret =cio_cancel_halt_clear (sch, &iretry); };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 83/276 iwlwifi: pcie: dont crash on invalid RX interrupt
In reply to Greg Kroah-Hartman[ Upstream commit 30f24eabab8cd801064c5c37589d803cb4341929 ]
If for some reason the device gives us an RX interrupt before we're ready for it, perhaps during device power-on with misconfigured IRQ causes mapping or so, we can crash trying to access the queues.
Prevent that by checking that we actually have RXQs and that they were properly allocated.
--- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/rx.c +6 -1
@@ -1388,10 +1388,15 @@ static struct iwl_rx_mem_buffer *iwl_pcie_get_rxb(struct iwl_trans *trans,static void iwl_pcie_rx_handle (struct iwl_trans *trans,int queue) {struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans); -struct iwl_rxq *rxq = &trans_pcie->rxq[queue]; +struct iwl_rxq *rxq;u32 r, i, count =0 ;bool emergency = false; +if (WARN_ON_ONCE (!trans_pcie->rxq || !trans_pcie->rxq[queue].bd)) +return ; + + rxq = &trans_pcie->rxq[queue]; + restart:spin_lock (&rxq->lock);/* uCode's read index (stored in shared DRAM) indicates the last Rx
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 84/276 rtc: 88pm860x: prevent use-after-free on device remove
In reply to Greg Kroah-Hartman[ Upstream commit f22b1ba15ee5785aa028384ebf77dd39e8e47b70 ]
The device's remove() attempts to shut down the delayed_work scheduled on the kernel-global workqueue by calling flush_scheduled_work().
Unfortunately, flush_scheduled_work() does not prevent the delayed_work from re-scheduling itself. The delayed_work might run after the device has been removed, and touch the already de-allocated info structure. This is a potential use-after-free.
Fix by calling cancel_delayed_work_sync() during remove(): this ensures that the delayed work is properly cancelled, is no longer running, and is not able to re-schedule itself.
This issue was detected with the help of Coccinelle.
--- drivers/rtc/rtc-88pm860x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-88pm860x.c +1 -1
@@ -414,7 +414,7 @@ static int pm860x_rtc_remove(struct platform_device *pdev)struct pm860x_rtc_info *info =platform_get_drvdata (pdev);#ifdef VRTC_CALIBRATION -flush_scheduled_work (); +cancel_delayed_work_sync (&info->calib_work);/* disable measurement */ pm860x_set_bits (info->i2c,PM8607_MEAS_EN2 ,MEAS2_VRTC ,0 );#endif /* VRTC_CALIBRATION */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 126/276 media: stm32-dcmi: fix crash when subdev do not expose any formats
In reply to Greg Kroah-Hartman[ Upstream commit 33dfeb62e23c31619d2197850f7e8b50e8cc5466 ]
Do not access sd_formats[] if num_of_sd_formats is zero, ie subdev sensor didn't expose any formats.
--- drivers/media/platform/stm32/stm32-dcmi.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/platform/stm32/stm32-dcmi.c +6 -0
@@ -808,6 +808,9 @@ static int dcmi_try_fmt(struct stm32_dcmi *dcmi, struct v4l2_format *f, sd_fmt =find_format_by_fourcc (dcmi, pix->pixelformat);if (!sd_fmt) { +if (!dcmi->num_of_sd_formats) +return -ENODATA ; + sd_fmt = dcmi->sd_formats[dcmi->num_of_sd_formats -1 ]; pix->pixelformat = sd_fmt->fourcc; }
@@ -986,6 +989,9 @@ static int dcmi_set_sensor_format(struct stm32_dcmi *dcmi, sd_fmt =find_format_by_fourcc (dcmi, pix->pixelformat);if (!sd_fmt) { +if (!dcmi->num_of_sd_formats) +return -ENODATA ; + sd_fmt = dcmi->sd_formats[dcmi->num_of_sd_formats -1 ]; pix->pixelformat = sd_fmt->fourcc; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 77/276 scsi: qla2xxx: Avoid that lockdep complains about unsafe locking in tcm_qla2xxx_close_session()
In reply to Greg Kroah-Hartman[ Upstream commit d4023db71108375e4194e92730ba0d32d7f07813 ]
This patch avoids that lockdep reports the following warning:
=====================================================
WARNING: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected
5.1.0-rc1-dbg+ #11 Tainted: G W
-----------------------------------------------------
rmdir/1478 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:00000000e7ac4607 (&(&k->k_lock)->rlock){+.+.}, at: klist_next+0x43/0x1d0
and this task is already holding:00000000cf0baf5e (&(&ha->tgt.sess_lock)->rlock){-...}, at: tcm_qla2xxx_close_session+0x57/0xb0 [tcm_qla2xxx] which would create a new lock dependency:
(&(&ha->tgt.sess_lock)->rlock){-...} -> (&(&k->k_lock)->rlock){+.+.}
but this new dependency connects a HARDIRQ-irq-safe lock:
(&(&ha->tgt.sess_lock)->rlock){-...}
... which became HARDIRQ-irq-safe at:
lock_acquire+0xe3/0x200 _raw_spin_lock_irqsave+0x3d/0x60 qla2x00_fcport_event_handler+0x1f3d/0x22b0 [qla2xxx] qla2x00_async_login_sp_done+0x1dc/0x1f0 [qla2xxx] qla24xx_process_response_queue+0xa37/0x10e0 [qla2xxx] qla24xx_msix_rsp_q+0x79/0xf0 [qla2xxx] __handle_irq_event_percpu+0x79/0x3c0 handle_irq_event_percpu+0x70/0xf0 handle_irq_event+0x5a/0x8b handle_edge_irq+0x12c/0x310 handle_irq+0x192/0x20a do_IRQ+0x73/0x160 ret_from_intr+0x0/0x1d default_idle+0x23/0x1f0 arch_cpu_idle+0x15/0x20 default_idle_call+0x35/0x40 do_idle+0x2bb/0x2e0 cpu_startup_entry+0x1d/0x20 start_secondary+0x24d/0x2d0 secondary_startup_64+0xa4/0xb0
to a HARDIRQ-irq-unsafe lock:
(&(&k->k_lock)->rlock){+.+.}
... which became HARDIRQ-irq-unsafe at:
...
lock_acquire+0xe3/0x200 _raw_spin_lock+0x32/0x50 klist_add_tail+0x33/0xb0 device_add+0x7f4/0xb60 device_create_groups_vargs+0x11c/0x150 device_create_with_groups+0x89/0xb0 vtconsole_class_init+0xb2/0x124 do_one_initcall+0xc5/0x3ce kernel_init_freeable+0x295/0x32e kernel_init+0x11/0x11b ret_from_fork+0x3a/0x50
other info that might help us debug this:
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&(&k->k_lock)->rlock);
local_irq_disable();
lock(&(&ha->tgt.sess_lock)->rlock);
lock(&(&k->k_lock)->rlock);
<Interrupt>
lock(&(&ha->tgt.sess_lock)->rlock);*** DEADLOCK ***
4 locks held by rmdir/1478:
#0: 000000002c7f1ba4 (sb_writers#10){.+.+}, at: mnt_want_write+0x32/0x70
#1: 00000000c85eb147 (&default_group_class[depth - 1]#2/1){+.+.}, at: do_rmdir+0x217/0x2d0
#2: 000000002b164d6f (&sb->s_type->i_mutex_key#13){++++}, at: vfs_rmdir+0x7e/0x1d0
#3: 00000000cf0baf5e (&(&ha->tgt.sess_lock)->rlock){-...}, at: tcm_qla2xxx_close_session+0x57/0xb0 [tcm_qla2xxx]
the dependencies between HARDIRQ-irq-safe lock and the holding lock:
-> (&(&ha->tgt.sess_lock)->rlock){-...} ops: 127 {
IN-HARDIRQ-W at:
lock_acquire+0xe3/0x200
_raw_spin_lock_irqsave+0x3d/0x60
qla2x00_fcport_event_handler+0x1f3d/0x22b0 [qla2xxx]
qla2x00_async_login_sp_done+0x1dc/0x1f0 [qla2xxx]
qla24xx_process_response_queue+0xa37/0x10e0 [qla2xxx]
qla24xx_msix_rsp_q+0x79/0xf0 [qla2xxx]
__handle_irq_event_percpu+0x79/0x3c0
handle_irq_event_percpu+0x70/0xf0
handle_irq_event+0x5a/0x8b
handle_edge_irq+0x12c/0x310
handle_irq+0x192/0x20a
do_IRQ+0x73/0x160
ret_from_intr+0x0/0x1d
default_idle+0x23/0x1f0
arch_cpu_idle+0x15/0x20
default_idle_call+0x35/0x40
do_idle+0x2bb/0x2e0
cpu_startup_entry+0x1d/0x20
start_secondary+0x24d/0x2d0
secondary_startup_64+0xa4/0xb0
INITIAL USE at:
lock_acquire+0xe3/0x200
_raw_spin_lock_irqsave+0x3d/0x60
qla2x00_loop_resync+0xb3d/0x2690 [qla2xxx]
qla2x00_do_dpc+0xcee/0xf30 [qla2xxx]
kthread+0x1d2/0x1f0
ret_from_fork+0x3a/0x50
}
... key at: [<ffffffffa125f700>] __key.62804+0x0/0xfffffffffff7e900 [qla2xxx]
... acquired at:
__lock_acquire+0x11ed/0x1b60
lock_acquire+0xe3/0x200
_raw_spin_lock_irqsave+0x3d/0x60
klist_next+0x43/0x1d0
device_for_each_child+0x96/0x110
scsi_target_block+0x3c/0x40 [scsi_mod]
fc_remote_port_delete+0xe7/0x1c0 [scsi_transport_fc]
qla2x00_mark_device_lost+0x4d3/0x500 [qla2xxx]
qlt_unreg_sess+0x104/0x2c0 [qla2xxx]
tcm_qla2xxx_close_session+0xa2/0xb0 [tcm_qla2xxx]
target_shutdown_sessions+0x17b/0x190 [target_core_mod]
core_tpg_del_initiator_node_acl+0xf3/0x1f0 [target_core_mod]
target_fabric_nacl_base_release+0x25/0x30 [target_core_mod]
config_item_release+0x9f/0x120 [configfs]
config_item_put+0x29/0x2b [configfs]
configfs_rmdir+0x3d2/0x520 [configfs]
vfs_rmdir+0xb3/0x1d0
do_rmdir+0x25c/0x2d0
__x64_sys_rmdir+0x24/0x30
do_syscall_64+0x77/0x220
entry_SYSCALL_64_after_hwframe+0x49/0xbethe dependencies between the lock to be acquired
and HARDIRQ-irq-unsafe lock:
-> (&(&k->k_lock)->rlock){+.+.} ops: 14568 {
HARDIRQ-ON-W at:
lock_acquire+0xe3/0x200
_raw_spin_lock+0x32/0x50
klist_add_tail+0x33/0xb0
device_add+0x7f4/0xb60
device_create_groups_vargs+0x11c/0x150
device_create_with_groups+0x89/0xb0
vtconsole_class_init+0xb2/0x124
do_one_initcall+0xc5/0x3ce
kernel_init_freeable+0x295/0x32e
kernel_init+0x11/0x11b
ret_from_fork+0x3a/0x50
SOFTIRQ-ON-W at:
lock_acquire+0xe3/0x200
_raw_spin_lock+0x32/0x50
klist_add_tail+0x33/0xb0
device_add+0x7f4/0xb60
device_create_groups_vargs+0x11c/0x150
device_create_with_groups+0x89/0xb0
vtconsole_class_init+0xb2/0x124
do_one_initcall+0xc5/0x3ce
kernel_init_freeable+0x295/0x32e
kernel_init+0x11/0x11b
ret_from_fork+0x3a/0x50
INITIAL USE at:
lock_acquire+0xe3/0x200
_raw_spin_lock+0x32/0x50
klist_add_tail+0x33/0xb0
device_add+0x7f4/0xb60
device_create_groups_vargs+0x11c/0x150
device_create_with_groups+0x89/0xb0
vtconsole_class_init+0xb2/0x124
do_one_initcall+0xc5/0x3ce
kernel_init_freeable+0x295/0x32e
kernel_init+0x11/0x11b
ret_from_fork+0x3a/0x50
}
... key at: [<ffffffff83f3d900>] __key.15805+0x0/0x40
... acquired at:
__lock_acquire+0x11ed/0x1b60
lock_acquire+0xe3/0x200
_raw_spin_lock_irqsave+0x3d/0x60
klist_next+0x43/0x1d0
device_for_each_child+0x96/0x110
scsi_target_block+0x3c/0x40 [scsi_mod]
fc_remote_port_delete+0xe7/0x1c0 [scsi_transport_fc]
qla2x00_mark_device_lost+0x4d3/0x500 [qla2xxx]
qlt_unreg_sess+0x104/0x2c0 [qla2xxx]
tcm_qla2xxx_close_session+0xa2/0xb0 [tcm_qla2xxx]
target_shutdown_sessions+0x17b/0x190 [target_core_mod]
core_tpg_del_initiator_node_acl+0xf3/0x1f0 [target_core_mod]
target_fabric_nacl_base_release+0x25/0x30 [target_core_mod]
config_item_release+0x9f/0x120 [configfs]
config_item_put+0x29/0x2b [configfs]
configfs_rmdir+0x3d2/0x520 [configfs]
vfs_rmdir+0xb3/0x1d0
do_rmdir+0x25c/0x2d0
__x64_sys_rmdir+0x24/0x30
do_syscall_64+0x77/0x220
entry_SYSCALL_64_after_hwframe+0x49/0xbe
stack backtrace:
CPU: 7 PID: 1478 Comm: rmdir Tainted: G W 5.1.0-rc1-dbg+ #11
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
Call Trace:
dump_stack+0x86/0xca
check_usage.cold.59+0x473/0x563
check_prev_add.constprop.43+0x1f1/0x1170
__lock_acquire+0x11ed/0x1b60
lock_acquire+0xe3/0x200
_raw_spin_lock_irqsave+0x3d/0x60
klist_next+0x43/0x1d0
device_for_each_child+0x96/0x110
scsi_target_block+0x3c/0x40 [scsi_mod]
fc_remote_port_delete+0xe7/0x1c0 [scsi_transport_fc]
qla2x00_mark_device_lost+0x4d3/0x500 [qla2xxx]
qlt_unreg_sess+0x104/0x2c0 [qla2xxx]
tcm_qla2xxx_close_session+0xa2/0xb0 [tcm_qla2xxx]
target_shutdown_sessions+0x17b/0x190 [target_core_mod]
core_tpg_del_initiator_node_acl+0xf3/0x1f0 [target_core_mod]
target_fabric_nacl_base_release+0x25/0x30 [target_core_mod]
config_item_release+0x9f/0x120 [configfs]
config_item_put+0x29/0x2b [configfs]
configfs_rmdir+0x3d2/0x520 [configfs]
vfs_rmdir+0xb3/0x1d0
do_rmdir+0x25c/0x2d0
__x64_sys_rmdir+0x24/0x30
do_syscall_64+0x77/0x220
entry_SYSCALL_64_after_hwframe+0x49/0xbe--- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/tcm_qla2xxx.c +2 -1
@@ -365,8 +365,9 @@ static void tcm_qla2xxx_close_session(struct se_session *se_sess)spin_lock_irqsave (&vha->hw->tgt.sess_lock, flags);target_sess_cmd_list_set_waiting (se_sess); -tcm_qla2xxx_put_sess (sess);spin_unlock_irqrestore (&vha->hw->tgt.sess_lock, flags); + +tcm_qla2xxx_put_sess (sess); }static u32 tcm_qla2xxx_sess_get_index (struct se_session *se_sess)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 136/276 sched/core: Check quota and period overflow at usec to nsec conversion
In reply to Greg Kroah-Hartman[ Upstream commit 1a8b4540db732ca16c9e43ac7c08b1b8f0b252d8 ]
Large values could overflow u64 and pass following sanity checks.
# echo 18446744073750000 > cpu.cfs_period_us # cat cpu.cfs_period_us 40448
# echo 18446744073750000 > cpu.cfs_quota_us # cat cpu.cfs_quota_us 40448
After this patch they will fail with -EINVAL.
--- kernel/sched/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/sched/core.c +6 -1
@@ -6593,8 +6593,10 @@ int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us) period =ktime_to_ns (tg->cfs_bandwidth.period);if (cfs_quota_us <0 ) quota =RUNTIME_INF ; -else +else if ((u64 )cfs_quota_us <=U64_MAX /NSEC_PER_USEC ) quota = (u64 )cfs_quota_us *NSEC_PER_USEC ; +else +return -EINVAL ;return tg_set_cfs_bandwidth (tg, period, quota); }
@@ -6616,6 +6618,9 @@ int tg_set_cfs_period(struct task_group *tg, long cfs_period_us) {u64 quota, period; +if ((u64 )cfs_period_us >U64_MAX /NSEC_PER_USEC ) +return -EINVAL ; + period = (u64 )cfs_period_us *NSEC_PER_USEC ; quota = tg->cfs_bandwidth.quota;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 153/276 RDMA/cxgb4: Fix null pointer dereference on alloc_skb failure
In reply to Greg Kroah-Hartman[ Upstream commit a6d2a5a92e67d151c98886babdc86d530d27111c ]
Currently if alloc_skb fails to allocate the skb a null skb is passed to t4_set_arp_err_handler and this ends up dereferencing the null skb. Avoid the NULL pointer dereference by checking for a NULL skb and returning early.
Addresses-Coverity: ("Dereference null return")
--- drivers/infiniband/hw/cxgb4/cm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/cxgb4/cm.c +2 -0
@@ -458,6 +458,8 @@ static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp)skb_reset_transport_header (skb); }else { skb =alloc_skb (len, gfp); +if (!skb) +return NULL ; }t4_set_arp_err_handler (skb,NULL ,NULL );return skb;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 128/276 media: pvrusb2: Prevent a buffer overflow
In reply to Greg Kroah-Hartman[ Upstream commit c1ced46c7b49ad7bc064e68d966e0ad303f917fb ]
The ctrl_check_input() function is called from pvr2_ctrl_range_check(). It's supposed to validate user supplied input and return true or false depending on whether the input is valid or not. The problem is that negative shifts or shifts greater than 31 are undefined in C. In practice with GCC they result in shift wrapping so this function returns true for some inputs which are not valid and this could result in a buffer overflow:
drivers/media/usb/pvrusb2/pvrusb2-ctrl.c:205 pvr2_ctrl_get_valname()
warn: uncapped user index 'names[val]'
The cptr->hdw->input_allowed_mask mask is configured in pvr2_hdw_create() and the highest valid bit is BIT(4).
--- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 2 ++ drivers/media/usb/pvrusb2/pvrusb2-hdw.h | 1 + 2 files changed, 3 insertions(+)
drivers/media/usb/pvrusb2/pvrusb2-hdw.c +2 -0
@@ -666,6 +666,8 @@ static int ctrl_get_input(struct pvr2_ctrl *cptr,int *vp)static int ctrl_check_input (struct pvr2_ctrl *cptr,int v) { +if (v <0 || v >PVR2_CVAL_INPUT_MAX ) +return 0 ;return ((1 << v) & cptr->hdw->input_allowed_mask) !=0 ; }
drivers/media/usb/pvrusb2/pvrusb2-hdw.h +1 -0
@@ -50,6 +50,7 @@#define PVR2_CVAL_INPUT_COMPOSITE 2#define PVR2_CVAL_INPUT_SVIDEO 3#define PVR2_CVAL_INPUT_RADIO 4 +#define PVR2_CVAL_INPUT_MAX PVR2_CVAL_INPUT_RADIOenum pvr2_config { pvr2_config_empty,/* No configuration */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 157/276 hwmon: (vt1211) Use request_muxed_region for Super-IO accesses
In reply to Greg Kroah-Hartman[ Upstream commit 14b97ba5c20056102b3dd22696bf17b057e60976 ]
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/vt1211.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/hwmon/vt1211.c +12 -3
@@ -226,15 +226,21 @@ static inline void superio_select(int sio_cip, int ldn)outb (ldn, sio_cip +1 ); } -static inline void superio_enter (int sio_cip) +static inline int superio_enter (int sio_cip) { +if (!request_muxed_region (sio_cip,2 ,DRVNAME )) +return -EBUSY ; +outb (0x87 , sio_cip);outb (0x87 , sio_cip); + +return 0 ; }static inline void superio_exit (int sio_cip) {outb (0xaa , sio_cip); +release_region (sio_cip,2 ); }/* ---------------------------------------------------------------------
@@ -1282,11 +1288,14 @@ static int __init vt1211_device_add(unsigned short address)static int __init vt1211_find (int sio_cip,unsigned short *address) { -int err = -ENODEV ; +int err;int devid; -superio_enter (sio_cip); + err =superio_enter (sio_cip); +if (err) +return err; + err = -ENODEV ; devid = force_id ? force_id :superio_inb (sio_cip,SIO_VT1211_DEVID );if (devid !=SIO_VT1211_ID ) goto EXIT;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 171/276 extcon: arizona: Disable mic detect if running when driver is removed
In reply to Greg Kroah-Hartman[ Upstream commit 00053de52231117ddc154042549f2256183ffb86 ]
Microphone detection provides the button detection features on the Arizona CODECs as such it will be running if the jack is currently inserted. If the driver is unbound whilst the jack is still inserted this will cause warnings from the regulator framework as the MICVDD regulator is put but was never disabled.
Correct this by disabling microphone detection on driver removal and if the microphone detection was running disable the regulator and put the runtime reference that was currently held.
--- drivers/extcon/extcon-arizona.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/extcon/extcon-arizona.c +10 -0
@@ -1726,6 +1726,16 @@ static int arizona_extcon_remove(struct platform_device *pdev)struct arizona_extcon_info *info =platform_get_drvdata (pdev);struct arizona *arizona = info->arizona;int jack_irq_rise, jack_irq_fall; +bool change; + +regmap_update_bits_check (arizona->regmap,ARIZONA_MIC_DETECT_1 , +ARIZONA_MICD_ENA ,0 , + &change); + +if (change) { +regulator_disable (info->micvdd); +pm_runtime_put (info->dev); + }gpiod_put (info->micd_pol_gpio);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 134/276 random: add a spinlock_t to struct batched_entropy
In reply to Greg Kroah-Hartman[ Upstream commit b7d5dc21072cda7124d13eae2aefb7343ef94197 ]
The per-CPU variable batched_entropy_uXX is protected by get_cpu_var(). This is just a preempt_disable() which ensures that the variable is only from the local CPU. It does not protect against users on the same CPU from another context. It is possible that a preemptible context reads slot 0 and then an interrupt occurs and the same value is read again.
The above scenario is confirmed by lockdep if we add a spinlock:
| ================================
| WARNING: inconsistent lock state
| 5.1.0-rc3+ #42 Not tainted
| --------------------------------
| inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
| ksoftirqd/9/56 [HC0[0]:SC1[1]:HE0:SE0] takes:
| (____ptrval____) (batched_entropy_u32.lock){+.?.}, at: get_random_u32+0x3e/0xe0
| {SOFTIRQ-ON-W} state was registered at:
| _raw_spin_lock+0x2a/0x40
| get_random_u32+0x3e/0xe0
| new_slab+0x15c/0x7b0
| ___slab_alloc+0x492/0x620
| __slab_alloc.isra.73+0x53/0xa0
| kmem_cache_alloc_node+0xaf/0x2a0
| copy_process.part.41+0x1e1/0x2370
| _do_fork+0xdb/0x6d0
| kernel_thread+0x20/0x30
| kthreadd+0x1ba/0x220
| ret_from_fork+0x3a/0x50
…
| other info that might help us debug this:
| Possible unsafe locking scenario:
|
| CPU0
| ----
| lock(batched_entropy_u32.lock);
| <Interrupt>
| lock(batched_entropy_u32.lock);
|
| *** DEADLOCK ***
|
| stack backtrace:
| Call Trace:
…
| kmem_cache_alloc_trace+0x20e/0x270
| ipmi_alloc_recv_msg+0x16/0x40
…
| __do_softirq+0xec/0x48d
| run_ksoftirqd+0x37/0x60
| smpboot_thread_fn+0x191/0x290
| kthread+0xfe/0x130
| ret_from_fork+0x3a/0x50Add a spinlock_t to the batched_entropy data structure and acquire the lock while accessing it. Acquire the lock with disabled interrupts because this function may be used from interrupt context.
Remove the batched_entropy_reset_lock lock. Now that we have a lock for the data scructure, we can access it from a remote CPU.
--- drivers/char/random.c | 52 ++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 25 deletions(-)
drivers/char/random.c +27 -25
@@ -2215,8 +2215,8 @@ struct batched_entropy {u32 entropy_u32[CHACHA20_BLOCK_SIZE /sizeof (u32)]; };unsigned int position; +spinlock_t batch_lock; }; -static rwlock_t batched_entropy_reset_lock =__RW_LOCK_UNLOCKED (batched_entropy_reset_lock);/* * Get a random word for internal kernel use only. The quality of the random
@@ -2226,12 +2226,14 @@ static rwlock_t batched_entropy_reset_lock = __RW_LOCK_UNLOCKED(batched_entropy_* wait_for_random_bytes() should be called and return 0 at least once * at any point prior. */ -static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u64); +static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u64) = { + .batch_lock =__SPIN_LOCK_UNLOCKED (batched_entropy_u64.lock), +}; +u64 get_random_u64 (void ) {u64 ret; -bool use_lock; -unsigned long flags =0 ; +unsigned long flags;struct batched_entropy *batch;static void *previous;
@@ -2246,28 +2248,25 @@ u64 get_random_u64(void)warn_unseeded_randomness (&previous); - use_lock =READ_ONCE (crng_init) <2 ; - batch = &get_cpu_var (batched_entropy_u64); -if (use_lock) -read_lock_irqsave (&batched_entropy_reset_lock, flags); + batch =raw_cpu_ptr (&batched_entropy_u64); +spin_lock_irqsave (&batch->batch_lock, flags);if (batch->position %ARRAY_SIZE (batch->entropy_u64) ==0 ) {extract_crng ((__u32 *)batch->entropy_u64); batch->position =0 ; } ret = batch->entropy_u64[batch->position++]; -if (use_lock) -read_unlock_irqrestore (&batched_entropy_reset_lock, flags); -put_cpu_var (batched_entropy_u64); +spin_unlock_irqrestore (&batch->batch_lock, flags);return ret; }EXPORT_SYMBOL (get_random_u64); -static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u32); +static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u32) = { + .batch_lock =__SPIN_LOCK_UNLOCKED (batched_entropy_u32.lock), +};u32 get_random_u32 (void ) {u32 ret; -bool use_lock; -unsigned long flags =0 ; +unsigned long flags;struct batched_entropy *batch;static void *previous;
@@ -2276,18 +2275,14 @@ u32 get_random_u32(void)warn_unseeded_randomness (&previous); - use_lock =READ_ONCE (crng_init) <2 ; - batch = &get_cpu_var (batched_entropy_u32); -if (use_lock) -read_lock_irqsave (&batched_entropy_reset_lock, flags); + batch =raw_cpu_ptr (&batched_entropy_u32); +spin_lock_irqsave (&batch->batch_lock, flags);if (batch->position %ARRAY_SIZE (batch->entropy_u32) ==0 ) {extract_crng (batch->entropy_u32); batch->position =0 ; } ret = batch->entropy_u32[batch->position++]; -if (use_lock) -read_unlock_irqrestore (&batched_entropy_reset_lock, flags); -put_cpu_var (batched_entropy_u32); +spin_unlock_irqrestore (&batch->batch_lock, flags);return ret; }EXPORT_SYMBOL (get_random_u32);
@@ -2301,12 +2296,19 @@ static void invalidate_batched_entropy(void)int cpu;unsigned long flags; -write_lock_irqsave (&batched_entropy_reset_lock, flags);for_each_possible_cpu (cpu) { -per_cpu_ptr (&batched_entropy_u32, cpu)->position =0 ; -per_cpu_ptr (&batched_entropy_u64, cpu)->position =0 ; +struct batched_entropy *batched_entropy; + + batched_entropy =per_cpu_ptr (&batched_entropy_u32, cpu); +spin_lock_irqsave (&batched_entropy->batch_lock, flags); + batched_entropy->position =0 ; +spin_unlock (&batched_entropy->batch_lock); + + batched_entropy =per_cpu_ptr (&batched_entropy_u64, cpu); +spin_lock (&batched_entropy->batch_lock); + batched_entropy->position =0 ; +spin_unlock_irqrestore (&batched_entropy->batch_lock, flags); } -write_unlock_irqrestore (&batched_entropy_reset_lock, flags); }/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 175/276 s390/mm: silence compiler warning when compiling without CONFIG_PGSTE
In reply to Greg Kroah-Hartman[ Upstream commit 81a8f2beb32a5951ecf04385301f50879abc092b ]
If CONFIG_PGSTE is not set (e.g. when compiling without KVM), GCC complains:
CC arch/s390/mm/pgtable.oarch/s390/mm/pgtable.c:413:15: warning: ‘pmd_alloc_map’ defined but not
used [-Wunused-function]
static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)
^~~~~~~~~~~~~
Wrap the function with "#ifdef CONFIG_PGSTE" to silence the warning.
--- arch/s390/mm/pgtable.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/mm/pgtable.c +2 -0
@@ -410,6 +410,7 @@ static inline pmd_t pmdp_flush_lazy(struct mm_struct *mm,return old; } +#ifdef CONFIG_PGSTE static pmd_t *pmd_alloc_map (struct mm_struct *mm,unsigned long addr) {pgd_t *pgd;
@@ -427,6 +428,7 @@ static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr) pmd =pmd_alloc (mm, pud, addr); return pmd; } +#endif pmd_t pmdp_xchg_direct (struct mm_struct *mm,unsigned long addr,pmd_t *pmdp,pmd_t new)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 194/276 b43: shut up clang -Wuninitialized variable warning
In reply to Greg Kroah-Hartman[ Upstream commit d825db346270dbceef83b7b750dbc29f1d7dcc0e ]
Clang warns about what is clearly a case of passing an uninitalized variable into a static function:
drivers/net/wireless/broadcom/b43/phy_lp.c:1852:23: error: variable 'gains' is uninitialized when used here
[-Werror,-Wuninitialized]
lpphy_papd_cal(dev, gains, 0, 1, 30);
^~~~~
drivers/net/wireless/broadcom/b43/phy_lp.c:1838:2: note: variable 'gains' is declared here
struct lpphy_tx_gains gains, oldgains;
^1 error generated.
However, this function is empty, and its arguments are never evaluated, so gcc in contrast does not warn here. Both compilers behave in a reasonable way as far as I can tell, so we should change the code to avoid the warning everywhere.
We could just eliminate the lpphy_papd_cal() function entirely, given that it has had the TODO comment in it for 10 years now and is rather unlikely to ever get done. I'm doing a simpler change here, and just pass the 'oldgains' variable in that has been initialized, based on the guess that this is what was originally meant.
--- drivers/net/wireless/broadcom/b43/phy_lp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/broadcom/b43/phy_lp.c +3 -3
@@ -1834,7 +1834,7 @@ static void lpphy_papd_cal(struct b43_wldev *dev, struct lpphy_tx_gains gains,static void lpphy_papd_cal_txpwr (struct b43_wldev *dev) {struct b43_phy_lp *lpphy = dev->phy.lp; -struct lpphy_tx_gains gains, oldgains; +struct lpphy_tx_gains oldgains;int old_txpctl, old_afe_ovr, old_rf, old_bbmult;lpphy_read_tx_pctl_mode_from_hardware (dev);
@@ -1848,9 +1848,9 @@ static void lpphy_papd_cal_txpwr(struct b43_wldev *dev)lpphy_set_tx_power_control (dev,B43_LPPHY_TXPCTL_OFF );if (dev->dev->chip_id ==0x4325 && dev->dev->chip_rev ==0 ) -lpphy_papd_cal (dev, gains,0 ,1 ,30 ); +lpphy_papd_cal (dev, oldgains,0 ,1 ,30 );else -lpphy_papd_cal (dev, gains,0 ,1 ,65 ); +lpphy_papd_cal (dev, oldgains,0 ,1 ,65 );if (old_afe_ovr)lpphy_set_tx_gains (dev, oldgains);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 200/276 rtlwifi: fix potential NULL pointer dereference
In reply to Greg Kroah-Hartman[ Upstream commit 60209d482b97743915883d293c8b85226d230c19 ]
In case dev_alloc_skb fails, the fix safely returns to avoid potential NULL pointer dereference.
--- drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c | 2 ++ drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c | 2 ++ drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c | 2 ++ drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c | 2 ++ drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c | 2 ++ drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c | 4 ++++ 6 files changed, 14 insertions(+)
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c +2 -0
@@ -622,6 +622,8 @@ void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) u1rsvdpageloc, 3); skb =dev_alloc_skb (totalpacketlen); +if (!skb) +return ;skb_put_data (skb, &reserved_page_packet, totalpacketlen); rtstatus =rtl_cmd_send_packet (hw, skb);
drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c +2 -0
@@ -646,6 +646,8 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, skb =dev_alloc_skb (totalpacketlen); +if (!skb) +return ;skb_put_data (skb, &reserved_page_packet, totalpacketlen);if (cmd_send_packet)
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c +2 -0
@@ -766,6 +766,8 @@ void rtl92ee_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) u1rsvdpageloc, 3); skb =dev_alloc_skb (totalpacketlen); +if (!skb) +return ;skb_put_data (skb, &reserved_page_packet, totalpacketlen); rtstatus =rtl_cmd_send_packet (hw, skb);
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c +2 -0
@@ -470,6 +470,8 @@ void rtl8723e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) u1rsvdpageloc, 3); skb =dev_alloc_skb (totalpacketlen); +if (!skb) +return ;skb_put_data (skb, &reserved_page_packet, totalpacketlen); rtstatus =rtl_cmd_send_packet (hw, skb);
drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c +2 -0
@@ -584,6 +584,8 @@ void rtl8723be_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, u1rsvdpageloc, sizeof(u1rsvdpageloc)); skb =dev_alloc_skb (totalpacketlen); +if (!skb) +return ;skb_put_data (skb, &reserved_page_packet, totalpacketlen); rtstatus =rtl_cmd_send_packet (hw, skb);
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c +4 -0
@@ -1645,6 +1645,8 @@ void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, &reserved_page_packet_8812[0], totalpacketlen); skb =dev_alloc_skb (totalpacketlen); +if (!skb) +return ;skb_put_data (skb, &reserved_page_packet_8812, totalpacketlen); rtstatus =rtl_cmd_send_packet (hw, skb);
@@ -1781,6 +1783,8 @@ void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, &reserved_page_packet_8821[0], totalpacketlen); skb =dev_alloc_skb (totalpacketlen); +if (!skb) +return ;skb_put_data (skb, &reserved_page_packet_8821, totalpacketlen); rtstatus =rtl_cmd_send_packet (hw, skb);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 176/276 s390: cio: fix cio_irb declaration
In reply to Greg Kroah-Hartman[ Upstream commit e91012ee855ad9f5ef2ab106a3de51db93fe4d0c ]
clang points out that the declaration of cio_irb does not match the definition exactly, it is missing the alignment attribute:
../drivers/s390/cio/cio.c:50:1: warning: section does not match previous declaration [-Wsection] DEFINE_PER_CPU_ALIGNED(struct irb, cio_irb);
^../include/linux/percpu-defs.h:150:2: note: expanded from macro 'DEFINE_PER_CPU_ALIGNED'
DEFINE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION) \
^
../include/linux/percpu-defs.h:93:9: note: expanded from macro 'DEFINE_PER_CPU_SECTION'
extern __PCPU_ATTRS(sec) __typeof__(type) name; \
^
../include/linux/percpu-defs.h:49:26: note: expanded from macro '__PCPU_ATTRS'
__percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \
^../drivers/s390/cio/cio.h:118:1: note: previous attribute is here DECLARE_PER_CPU(struct irb, cio_irb);
^../include/linux/percpu-defs.h:111:2: note: expanded from macro 'DECLARE_PER_CPU'
DECLARE_PER_CPU_SECTION(type, name, "")
^../include/linux/percpu-defs.h:87:9: note: expanded from macro 'DECLARE_PER_CPU_SECTION'
extern __PCPU_ATTRS(sec) __typeof__(type) name
^../include/linux/percpu-defs.h:49:26: note: expanded from macro '__PCPU_ATTRS'
__percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \
^Use DECLARE_PER_CPU_ALIGNED() here, to make the two match.
--- drivers/s390/cio/cio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/cio/cio.h +1 -1
@@ -115,7 +115,7 @@ struct subchannel {struct schib_config config; } __attribute__ ((aligned(8))); -DECLARE_PER_CPU(struct irb, cio_irb); +DECLARE_PER_CPU_ALIGNED(struct irb, cio_irb);#define to_subchannel (n) container_of(n, struct subchannel, dev)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 203/276 drm/panel: otm8009a: Add delay at the end of initialization
In reply to Greg Kroah-Hartman[ Upstream commit 0084c3c71126fc878c6dab8a6ab8ecc484c2be02 ]
At the end of initialization, a delay is required by the panel. Without this delay, the panel could received a frame early & generate a crash of panel (black screen).
--- drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +3 -0
@@ -248,6 +248,9 @@ static int otm8009a_init_sequence(struct otm8009a *ctx)/* Send Command GRAM memory write (no parameters) */ dcs_write_seq (ctx,MIPI_DCS_WRITE_MEMORY_START ); +/* Wait a short while to let the panel be ready before the 1st frame */ +mdelay (10 ); +return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 212/276 sh: sh7786: Add explicit I/O cast to sh7786_mm_sel()
In reply to Greg Kroah-Hartman[ Upstream commit 8440bb9b944c02222c7a840d406141ed42e945cd ]
When compile-testing on arm:
arch/sh/include/cpu-sh4/cpu/sh7786.h: In function ‘sh7786_mm_sel’:
arch/sh/include/cpu-sh4/cpu/sh7786.h:135:21: warning: passing argument 1 of ‘__raw_readl’ makes pointer from integer without a cast [-Wint-conversion]
return __raw_readl(0xFC400020) & 0x7;
^~~~~~~~~~
In file included from include/linux/io.h:25:0,
from arch/sh/include/cpu-sh4/cpu/sh7786.h:14,
from drivers/pinctrl/sh-pfc/pfc-sh7786.c:15:
arch/arm/include/asm/io.h:113:21: note: expected ‘const volatile void *’ but argument is of type ‘unsigned int’
#define __raw_readl __raw_readl
^
arch/arm/include/asm/io.h:114:19: note: in expansion of macro ‘__raw_readl’
static inline u32 __raw_readl(const volatile void __iomem *addr)
^~~~~~~~~~~__raw_readl() on SuperH is a macro that casts the passed I/O address to the correct type, while the implementations on most other architectures expect to be passed the correct pointer type.
Add an explicit cast to fix this.
Note that this also gets rid of a sparse warning on SuperH:
arch/sh/include/cpu-sh4/cpu/sh7786.h:135:16: warning: incorrect type in argument 1 (different base types)
arch/sh/include/cpu-sh4/cpu/sh7786.h:135:16: expected void const volatile [noderef] <asn:2>*<noident>
arch/sh/include/cpu-sh4/cpu/sh7786.h:135:16: got unsigned int--- arch/sh/include/cpu-sh4/cpu/sh7786.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/include/cpu-sh4/cpu/sh7786.h +1 -1
@@ -135,7 +135,7 @@ enum {static inline u32 sh7786_mm_sel (void ) { -return __raw_readl (0xFC400020 ) &0x7 ; +return __raw_readl ((const volatile void __iomem *)0xFC400020 ) &0x7 ; }#endif /* __CPU_SH7786_H__ */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 177/276 selftests: cgroup: fix cleanup path in test_memcg_subtree_control()
In reply to Greg Kroah-Hartman[ Upstream commit e14d314c7a489f060d6d691866fef5f131281718 ]
Dan reported, that cleanup path in test_memcg_subtree_control() triggers a static checker warning:
./tools/testing/selftests/cgroup/test_memcontrol.c:76 \
test_memcg_subtree_control()
error: uninitialized symbol 'child2'.
Fix this by initializing child2 and parent2 variables and split the cleanup path into few stages.
--- .../selftests/cgroup/test_memcontrol.c | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-)
tools/testing/selftests/cgroup/test_memcontrol.c +21 -17
@@ -26,7 +26,7 @@*/ static int test_memcg_subtree_control (const char *root) { -char *parent, *child, *parent2, *child2; +char *parent, *child, *parent2 =NULL , *child2 =NULL ;int ret =KSFT_FAIL ;char buf[PAGE_SIZE ];
@@ -34,50 +34,54 @@ static int test_memcg_subtree_control(const char *root) parent =cg_name (root,"memcg_test_0" ); child =cg_name (root,"memcg_test_0/memcg_test_1" );if (!parent || !child) - goto cleanup; + goto cleanup_free;if (cg_create (parent)) - goto cleanup; + goto cleanup_free;if (cg_write (parent,"cgroup.subtree_control" ,"+memory" )) - goto cleanup; + goto cleanup_parent;if (cg_create (child)) - goto cleanup; + goto cleanup_parent;if (cg_read_strstr (child,"cgroup.controllers" ,"memory" )) - goto cleanup; + goto cleanup_child;/* Create two nested cgroups without enabling memory controller */ parent2 =cg_name (root,"memcg_test_1" ); child2 =cg_name (root,"memcg_test_1/memcg_test_1" );if (!parent2 || !child2) - goto cleanup; + goto cleanup_free2;if (cg_create (parent2)) - goto cleanup; + goto cleanup_free2;if (cg_create (child2)) - goto cleanup; + goto cleanup_parent2;if (cg_read (child2,"cgroup.controllers" , buf,sizeof (buf))) - goto cleanup; + goto cleanup_all;if (!cg_read_strstr (child2,"cgroup.controllers" ,"memory" )) - goto cleanup; + goto cleanup_all; ret =KSFT_PASS ; -cleanup: -cg_destroy (child); -cg_destroy (parent); -free (parent); -free (child); - +cleanup_all:cg_destroy (child2); +cleanup_parent2:cg_destroy (parent2); +cleanup_free2:free (parent2);free (child2); +cleanup_child: +cg_destroy (child); +cleanup_parent: +cg_destroy (parent); +cleanup_free: +free (parent); +free (child);return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 181/276 cpufreq: pmac32: fix possible object reference leak
In reply to Greg Kroah-Hartman[ Upstream commit 8d10dc28a9ea6e8c02e825dab28699f3c72b02d9 ]
The call to of_find_node_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/cpufreq/pmac32-cpufreq.c:557:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function. ./drivers/cpufreq/pmac32-cpufreq.c:569:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function. ./drivers/cpufreq/pmac32-cpufreq.c:598:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 587, but without a corresponding object release within this function.
--- drivers/cpufreq/pmac32-cpufreq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/cpufreq/pmac32-cpufreq.c +2 -0
@@ -552,6 +552,7 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode) volt_gpio_np =of_find_node_by_name (NULL ,"cpu-vcore-select" );if (volt_gpio_np) voltage_gpio =read_gpio (volt_gpio_np); +of_node_put (volt_gpio_np);if (!voltage_gpio){pr_err ("missing cpu-vcore-select gpio\n" );return 1 ;
@@ -588,6 +589,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode)if (volt_gpio_np) voltage_gpio =read_gpio (volt_gpio_np); +of_node_put (volt_gpio_np); pvr =mfspr (SPRN_PVR ); has_cpu_l2lve = !((pvr &0xf00 ) ==0x100 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 222/276 media: gspca: Kill URBs on USB device disconnect
In reply to Greg Kroah-Hartman[ Upstream commit 9b9ea7c2b57a0c9c3341fc6db039d1f7971a432e ]
In order to prevent ISOC URBs from being infinitely resubmitted, the driver's USB disconnect handler must kill all the in-flight URBs.
While here, change the URB packet status message to a debug level, to avoid spamming the console too much.
This commit fixes a lockup caused by an interrupt storm coming from the URB completion handler.
--- drivers/media/usb/gspca/gspca.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/usb/gspca/gspca.c +3 -1
@@ -294,7 +294,7 @@ static void fill_frame(struct gspca_dev *gspca_dev,/* check the packet status and length */ st = urb->iso_frame_desc[i].status;if (st) { -pr_err ("ISOC data error: [%d] len=%d, status=%d\n" , +gspca_dbg (gspca_dev,D_PACK ,"ISOC data error: [%d] len=%d, status=%d\n" , i, len, st); gspca_dev->last_packet_type =DISCARD_PACKET ;continue ;
@@ -1630,6 +1630,8 @@ void gspca_disconnect(struct usb_interface *intf)mutex_lock (&gspca_dev->usb_lock); gspca_dev->present = false; +destroy_urbs (gspca_dev); +gspca_input_destroy_urb (gspca_dev);vb2_queue_error (&gspca_dev->queue);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 238/276 selinux: avoid uninitialized variable warning
In reply to Greg Kroah-Hartman[ Upstream commit 98bbbb76f2edcfb8fb2b8f4b3ccc7b6e99d64bd8 ]
clang correctly points out a code path that would lead to an uninitialized variable use:
security/selinux/netlabel.c:310:6: error: variable 'addr' is used uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
if (ip_hdr(skb)->version == 4) {
^~~~~~~~~~~~~~~~~~~~~~~~~
security/selinux/netlabel.c:322:40: note: uninitialized use occurs here
rc = netlbl_conn_setattr(ep->base.sk, addr, &secattr);
^~~~
security/selinux/netlabel.c:310:2: note: remove the 'if' if its condition is always true
if (ip_hdr(skb)->version == 4) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
security/selinux/netlabel.c:291:23: note: initialize the variable 'addr' to silence this warning
struct sockaddr *addr;
^
= NULLThis is probably harmless since we should not see ipv6 packets of CONFIG_IPV6 is disabled, but it's better to rearrange the code so this cannot happen.
--- security/selinux/netlabel.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
security/selinux/netlabel.c +5 -9
@@ -288,11 +288,8 @@ int selinux_netlbl_sctp_assoc_request(struct sctp_endpoint *ep,int rc;struct netlbl_lsm_secattr secattr;struct sk_security_struct *sksec = ep->base.sk->sk_security; -struct sockaddr *addr;struct sockaddr_in addr4; -#if IS_ENABLED (CONFIG_IPV6 )struct sockaddr_in6 addr6; -#endif if (ep->base.sk->sk_family !=PF_INET && ep->base.sk->sk_family !=PF_INET6 )
@@ -310,16 +307,15 @@ int selinux_netlbl_sctp_assoc_request(struct sctp_endpoint *ep,if (ip_hdr (skb)->version ==4 ) { addr4.sin_family =AF_INET ; addr4.sin_addr.s_addr =ip_hdr (skb)->saddr; - addr = (struct sockaddr *)&addr4; -#if IS_ENABLED (CONFIG_IPV6 ) - } else { + rc =netlbl_conn_setattr (ep->base.sk, (void *)&addr4, &secattr); + }else if (IS_ENABLED (CONFIG_IPV6 ) &&ip_hdr (skb)->version ==6 ) { addr6.sin6_family =AF_INET6 ; addr6.sin6_addr =ipv6_hdr (skb)->saddr; - addr = (struct sockaddr *)&addr6; -#endif + rc =netlbl_conn_setattr (ep->base.sk, (void *)&addr6, &secattr); + }else { + rc = -EAFNOSUPPORT ; } - rc =netlbl_conn_setattr (ep->base.sk, addr, &secattr);if (rc ==0 ) sksec->nlbl_state =NLBL_LABELED ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 250/276 media: dvbsky: Avoid leaking dvb frontend
In reply to Greg Kroah-Hartman[ Upstream commit fdfa59cd63b184e1e96d51ff170fcac739bc6f6f ]
Commit 14f4eaeddabc ("media: dvbsky: fix driver unregister logic") fixed a use-after-free by removing the reference to the frontend after deleting the backing i2c device.
This has the unfortunate side effect the frontend device is never freed in the dvb core leaving a dangling device, leading to errors when the dvb core tries to register the frontend after e.g. a replug as reported
here: https://www.spinics.net/lists/linux-media/msg138181.html
media: dvbsky: issues with DVBSky T680CI
===
[ 561.119145] sp2 8-0040: CIMaX SP2 successfully attached [ 561.119161] usb 2-3: DVB: registering adapter 0 frontend 0 (Silicon Labs Si2168)... [ 561.119174] sysfs: cannot create duplicate filename '/class/dvb/
dvb0.frontend0'
===
The use after free happened as dvb_usbv2_disconnect calls in this order:
- dvb_usb_device::props->exit(...)
- dvb_usbv2_adapter_frontend_exit(...)
+ if (fe) dvb_unregister_frontend(fe)
+ dvb_usb_device::props->frontend_detach(...)
Moving the release of the i2c device from exit() to frontend_detach() avoids the dangling pointer access and allows the core to unregister the frontend.
This was originally reported for a DVBSky T680CI, but it also affects the MyGica T230C. As all supported devices structure the registration/ unregistration identically, apply the change for all device types.
--- drivers/media/usb/dvb-usb-v2/dvbsky.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/media/usb/dvb-usb-v2/dvbsky.c +10 -8
@@ -615,16 +615,18 @@ static int dvbsky_init(struct dvb_usb_device *d)return 0 ; } -static void dvbsky_exit (struct dvb_usb_device *d) +static int dvbsky_frontend_detach (struct dvb_usb_adapter *adap) { +struct dvb_usb_device *d =adap_to_d (adap);struct dvbsky_state *state =d_to_priv (d); -struct dvb_usb_adapter *adap = &d->adapter[0 ]; + +dev_dbg (&d->udev->dev,"%s: adap=%d\n" , __func__, adap->id);dvb_module_release (state->i2c_client_tuner);dvb_module_release (state->i2c_client_demod);dvb_module_release (state->i2c_client_ci); - adap->fe[0 ] =NULL ; +return 0 ; }/* DVB USB Driver stuff */
@@ -640,11 +642,11 @@ static struct dvb_usb_device_properties dvbsky_s960_props = { .i2c_algo = &dvbsky_i2c_algo, .frontend_attach = dvbsky_s960_attach, + .frontend_detach = dvbsky_frontend_detach, .init = dvbsky_init, .get_rc_config = dvbsky_get_rc_config, .streaming_ctrl = dvbsky_streaming_ctrl, .identify_state = dvbsky_identify_state, - .exit = dvbsky_exit, .read_mac_address = dvbsky_read_mac_addr, .num_adapters = 1,
@@ -667,11 +669,11 @@ static struct dvb_usb_device_properties dvbsky_s960c_props = { .i2c_algo = &dvbsky_i2c_algo, .frontend_attach = dvbsky_s960c_attach, + .frontend_detach = dvbsky_frontend_detach, .init = dvbsky_init, .get_rc_config = dvbsky_get_rc_config, .streaming_ctrl = dvbsky_streaming_ctrl, .identify_state = dvbsky_identify_state, - .exit = dvbsky_exit, .read_mac_address = dvbsky_read_mac_addr, .num_adapters = 1,
@@ -694,11 +696,11 @@ static struct dvb_usb_device_properties dvbsky_t680c_props = { .i2c_algo = &dvbsky_i2c_algo, .frontend_attach = dvbsky_t680c_attach, + .frontend_detach = dvbsky_frontend_detach, .init = dvbsky_init, .get_rc_config = dvbsky_get_rc_config, .streaming_ctrl = dvbsky_streaming_ctrl, .identify_state = dvbsky_identify_state, - .exit = dvbsky_exit, .read_mac_address = dvbsky_read_mac_addr, .num_adapters = 1,
@@ -721,11 +723,11 @@ static struct dvb_usb_device_properties dvbsky_t330_props = { .i2c_algo = &dvbsky_i2c_algo, .frontend_attach = dvbsky_t330_attach, + .frontend_detach = dvbsky_frontend_detach, .init = dvbsky_init, .get_rc_config = dvbsky_get_rc_config, .streaming_ctrl = dvbsky_streaming_ctrl, .identify_state = dvbsky_identify_state, - .exit = dvbsky_exit, .read_mac_address = dvbsky_read_mac_addr, .num_adapters = 1,
@@ -748,11 +750,11 @@ static struct dvb_usb_device_properties mygica_t230c_props = { .i2c_algo = &dvbsky_i2c_algo, .frontend_attach = dvbsky_mygica_t230c_attach, + .frontend_detach = dvbsky_frontend_detach, .init = dvbsky_init, .get_rc_config = dvbsky_get_rc_config, .streaming_ctrl = dvbsky_streaming_ctrl, .identify_state = dvbsky_identify_state, - .exit = dvbsky_exit, .num_adapters = 1, .adapter = {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 254/276 drm/amd/display: Set stream->mode_changed when connectors change
In reply to Greg Kroah-Hartman[ Upstream commit b9952f93cd2cf5fca82b06a8179c0f5f7b769e83 ]
[Why]
The kms_plane@plane-position-covered-pipe-*-planes subtests can produce a sequence of atomic commits such that neither active_changed nor mode_changed but connectors_changed.
When this happens we remove the old stream from the context and add a new stream but the new stream doesn't have mode_changed=true set.
This incorrect programming sequence causes CRC mismatches to occur in the test.
The stream->mode_changed value should be set whenever a new stream is created.
[How]
A new stream is created whenever drm_atomic_crtc_needs_modeset is true. We previously covered the active_changed and mode_changed conditions for the CRTC but connectors_changed is also checked within drm_atomic_crtc_needs_modeset.
So just use drm_atomic_crtc_needs_modeset directly to determine the mode_changed flag.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -2
@@ -4369,8 +4369,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,static void amdgpu_dm_crtc_copy_transient_flags (struct drm_crtc_state *crtc_state,struct dc_stream_state *stream_state) { - stream_state->mode_changed = - crtc_state->mode_changed || crtc_state->active_changed; + stream_state->mode_changed =drm_atomic_crtc_needs_modeset (crtc_state); } static int amdgpu_dm_atomic_commit(struct drm_device *dev,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 255/276 scsi: ufs: fix a missing check of devm_reset_control_get
In reply to Greg Kroah-Hartman[ Upstream commit 63a06181d7ce169d09843645c50fea1901bc9f0a ]
devm_reset_control_get could fail, so the fix checks its return value and passes the error code upstream in case it fails.
--- drivers/scsi/ufs/ufs-hisi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/ufs/ufs-hisi.c +4 -0
@@ -544,6 +544,10 @@ static int ufs_hisi_init_common(struct ufs_hba *hba)ufshcd_set_variant (hba, host); host->rst =devm_reset_control_get (dev,"rst" ); +if (IS_ERR (host->rst)) { +dev_err (dev,"%s: failed to get reset control\n" , __func__); +return PTR_ERR (host->rst); + }ufs_hisi_set_pm_lvl (hba);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 256/276 media: vimc: stream: fix thread state before sleep
In reply to Greg Kroah-Hartman[ Upstream commit 2978a505aaa981b279ef359f74ba93d25098e0a0 ]
The state TASK_UNINTERRUPTIBLE should be set just before schedule_timeout() call, so it knows the sleep mode it should enter. There is no point in setting TASK_UNINTERRUPTIBLE at the initialization of the thread as schedule_timeout() will set the state back to TASK_RUNNING.
This fixes a warning in __might_sleep() call, as it's expecting the task to be in TASK_RUNNING state just before changing the state to a sleeping state.
--- drivers/media/platform/vimc/vimc-streamer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/vimc/vimc-streamer.c +1 -1
@@ -120,7 +120,6 @@ static int vimc_streamer_thread(void *data)int i;set_freezable (); -set_current_state (TASK_UNINTERRUPTIBLE );for (;;) {try_to_freeze ();
@@ -137,6 +136,7 @@ static int vimc_streamer_thread(void *data)break ; }//wait for 60hz +set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (HZ /60 ); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 258/276 media: go7007: avoid clang frame overflow warning with KASAN
In reply to Greg Kroah-Hartman[ Upstream commit ed713a4a1367aca5c0f2f329579465db00c17995 ]
clang-8 warns about one function here when KASAN is enabled, even without the 'asan-stack' option:
drivers/media/usb/go7007/go7007-fw.c:1551:5: warning: stack frame size of 2656 bytes in function
I have reported this issue in the llvm bugzilla, but to make it work with the clang-8 release, a small annotation is still needed.
--- drivers/media/usb/go7007/go7007-fw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/go7007/go7007-fw.c +2 -2
@@ -1499,8 +1499,8 @@ static int modet_to_package(struct go7007 *go, __le16 *code, int space)return cnt; } -static int do_special (struct go7007 *go,u16 type,__le16 *code,int space, -int *framelen) +static noinline_for_stack int do_special(struct go7007 *go, u16 type, +__le16 *code,int space,int *framelen) {switch (type) {case SPECIAL_FRM_HEAD :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 260/276 scsi: lpfc: Fix FDMI manufacturer attribute value
In reply to Greg Kroah-Hartman[ Upstream commit d67f935b79a76ac9d86dde1a27bdd413feb5d987 ]
The FDMI manufacturer value being reported on Linux is inconsistent with other OS's.
Set the value to "Emulex Corporation" for consistency.
--- drivers/scsi/lpfc/lpfc_ct.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/lpfc/lpfc_ct.c +3 -0
@@ -1762,6 +1762,9 @@ lpfc_fdmi_hba_attr_manufacturer(struct lpfc_vport *vport, ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue;memset (ae,0 ,256 ); +/* This string MUST be consistent with other FC platforms +* supported by Broadcom. +*/ strncpy (ae->un.AttrString,"Emulex Corporation" ,sizeof (ae->un.AttrString));
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 263/276 scsi: lpfc: Fix SLI3 commands being issued on SLI4 devices
In reply to Greg Kroah-Hartman[ Upstream commit c95a3b4b0fb8d351e2329a96f87c4fc96a149505 ]
During debug, it was seen that the driver is issuing commands specific to SLI3 on SLI4 devices. Although the adapter correctly rejected the command, this should not be done.
Revise the code to stop sending these commands on a SLI4 adapter.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +10 -1
@@ -921,7 +921,11 @@ lpfc_linkdown(struct lpfc_hba *phba) } }lpfc_destroy_vport_work_array (phba, vports); -/* Clean up any firmware default rpi's */ + +/* Clean up any SLI3 firmware default rpi's */ +if (phba->sli_rev >LPFC_SLI_REV3 ) + goto skip_unreg_did; + mb =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (mb) {lpfc_unreg_did (phba,0xffff ,LPFC_UNREG_ALL_DFLT_RPIS , mb);
@@ -933,6 +937,7 @@ lpfc_linkdown(struct lpfc_hba *phba) } } + skip_unreg_did:/* Setup myDID for link up if we are in pt2pt mode */ if (phba->pport->fc_flag &FC_PT2PT ) { mb =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );
@@ -4855,6 +4860,10 @@ lpfc_unreg_default_rpis(struct lpfc_vport *vport)LPFC_MBOXQ_t *mbox;int rc; +/* Unreg DID is an SLI3 operation. */ +if (phba->sli_rev >LPFC_SLI_REV3 ) +return ; + mbox =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (mbox) { lpfc_unreg_did(phba, vport->vpi, LPFC_UNREG_ALL_DFLT_RPIS,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 264/276 spi : spi-topcliff-pch: Fix to handle empty DMA buffers
In reply to Greg Kroah-Hartman[ Upstream commit f37d8e67f39e6d3eaf4cc5471e8a3d21209843c6 ]
pch_alloc_dma_buf allocated tx, rx DMA buffers which can fail. Further, these buffers are used without a check. The patch checks for these failures and sends the error upstream.
--- drivers/spi/spi-topcliff-pch.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/spi/spi-topcliff-pch.c +13 -2
@@ -1294,18 +1294,27 @@ static void pch_free_dma_buf(struct pch_spi_board_data *board_dat, dma->rx_buf_virt, dma->rx_buf_dma); } -static void pch_alloc_dma_buf (struct pch_spi_board_data *board_dat, +static int pch_alloc_dma_buf (struct pch_spi_board_data *board_dat,struct pch_spi_data *data) {struct pch_spi_dma_ctrl *dma; +int ret; dma = &data->dma; + ret =0 ;/* Get Consistent memory for Tx DMA */ dma->tx_buf_virt =dma_alloc_coherent (&board_dat->pdev->dev,PCH_BUF_SIZE , &dma->tx_buf_dma,GFP_KERNEL ); +if (!dma->tx_buf_virt) + ret = -ENOMEM ; +/* Get Consistent memory for Rx DMA */ dma->rx_buf_virt =dma_alloc_coherent (&board_dat->pdev->dev,PCH_BUF_SIZE , &dma->rx_buf_dma,GFP_KERNEL ); +if (!dma->rx_buf_virt) + ret = -ENOMEM ; + +return ret; }static int pch_spi_pd_probe (struct platform_device *plat_dev)
@@ -1382,7 +1391,9 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev)if (use_dma) {dev_info (&plat_dev->dev,"Use DMA for data transfers\n" ); -pch_alloc_dma_buf (board_dat, data); + ret =pch_alloc_dma_buf (board_dat, data); +if (ret) + goto err_spi_register_master; } ret =spi_register_master (master);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 268/276 spi: Fix zero length xfer bug
In reply to Greg Kroah-Hartman[ Upstream commit 5442dcaa0d90fc376bdfc179a018931a8f43dea4 ]
This fixes a bug for messages containing both zero length and unidirectional xfers.
The function spi_map_msg will allocate dummy tx and/or rx buffers for use with unidirectional transfers when the hardware can only do a bidirectional transfer. That dummy buffer will be used in place of a NULL buffer even when the xfer length is 0.
Then in the function __spi_map_msg, if he hardware can dma, the zero length xfer will have spi_map_buf called on the dummy buffer.
Eventually, __sg_alloc_table is called and returns -EINVAL because nents == 0.
This fix prevents the error by not using the dummy buffer when the xfer length is zero.
--- drivers/spi/spi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi.c +2 -0
@@ -982,6 +982,8 @@ static int spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)if (max_tx || max_rx) {list_for_each_entry (xfer, &msg->transfers, transfer_list) { +if (!xfer->len) +continue ;if (!xfer->tx_buf) xfer->tx_buf = ctlr->dummy_tx;if (!xfer->rx_buf)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 228/276 virtio_console: initialize vtermno value for ports
In reply to Greg Kroah-Hartman[ Upstream commit 4b0a2c5ff7215206ea6135a405f17c5f6fca7d00 ]
For regular serial ports we do not initialize value of vtermno variable. A garbage value is assigned for non console ports. The value can be observed as a random integer with [1].
[1] vim /sys/kernel/debug/virtio-ports/vport*p*
This patch initialize the value of vtermno for console serial ports to '1' and regular serial ports are initiaized to '0'.
--- drivers/char/virtio_console.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/virtio_console.c +2 -1
@@ -75,7 +75,7 @@ struct ports_driver_data {/* All the console devices handled by this driver */ struct list_head consoles; }; -static struct ports_driver_data pdrvdata; +static struct ports_driver_data pdrvdata = { .next_vtermno =1 };static DEFINE_SPINLOCK (pdrvdata_lock);static DECLARE_COMPLETION (early_console_added);
@@ -1405,6 +1405,7 @@ static int add_port(struct ports_device *portdev, u32 id) port->async_queue =NULL ; port->cons.ws.ws_row = port->cons.ws.ws_col =0 ; + port->cons.vtermno =0 ; port->host_connected = port->guest_connected = false; port->stats = (struct port_stats ) {0 };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 230/276 overflow: Fix -Wtype-limits compilation warnings
In reply to Greg Kroah-Hartman[ Upstream commit dc7fe518b0493faa0af0568d6d8c2a33c00f58d0 ]
Attempt to use check_shl_overflow() with inputs of unsigned type produces the following compilation warnings.
drivers/infiniband/hw/mlx5/qp.c: In function _set_user_rq_size_:./include/linux/overflow.h:230:6: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
_s >= 0 && _s < 8 * sizeof(*d) ? _s : 0; \
^~
drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro _check_shl_overflow_
if (check_shl_overflow(rwq->wqe_count, rwq->wqe_shift,
&rwq->buf_size))
^~~~~~~~~~~~~~~~~~
./include/linux/overflow.h:232:26: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
(_to_shift != _s || *_d < 0 || _a < 0 || \
^
drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro _check_shl_overflow_
if (check_shl_overflow(rwq->wqe_count, rwq->wqe_shift, &rwq->buf_size))
^~~~~~~~~~~~~~~~~~
./include/linux/overflow.h:232:36: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
(_to_shift != _s || *_d < 0 || _a < 0 || \
^
drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro _check_shl_overflow_
if (check_shl_overflow(rwq->wqe_count, rwq->wqe_shift,&rwq->buf_size))
^~~~~~~~~~~~~~~~~~--- include/linux/overflow.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
include/linux/overflow.h +9 -3
@@ -36,6 +36,12 @@#define type_max (T ) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))#define type_min (T ) ((T)((T)-type_max(T)-(T)1)) +/* +* Avoids triggering -Wtype-limits compilation warning, +* while using unsigned data types to check a < 0. +*/ +#define is_non_negative (a) ((a) > 0 || (a) == 0) +#define is_negative (a) (!(is_non_negative(a)))#ifdef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW /*
@@ -227,10 +233,10 @@typeof (d) _d = d; \u64 _a_full = _a; \unsigned int _to_shift = \ - _s >=0 && _s <8 *sizeof (*d) ? _s :0 ; \ +is_non_negative (_s) && _s <8 *sizeof (*d) ? _s :0 ; \ *_d = (_a_full << _to_shift); \ - (_to_shift != _s || *_d <0 || _a <0 || \ - (*_d >> _to_shift) != _a); \ + (_to_shift != _s ||is_negative (*_d) ||is_negative (_a) || \ + (*_d >> _to_shift) != _a); \ })/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 119/276 perf/arm-cci: Remove broken race mitigation
In reply to Greg Kroah-Hartman[ Upstream commit 0d2e2a82d4de298d006bf8eddc86829e3c7da820 ]
Uncore PMU drivers face an awkward cyclic dependency wherein:
- They have to pick a valid online CPU to associate with before registering the PMU device, since it will get exposed to userspace immediately.
- The PMU registration has to be be at least partly complete before hotplug events can be handled, since trying to migrate an uninitialised context would be bad.
- The hotplug handler has to be ready as soon as a CPU is chosen, lest it go offline without the user-visible cpumask value getting updated.
The arm-cci driver has tried to solve this by using get_cpu() to pick the current CPU and prevent it from disappearing while both registrations are performed, but that results in taking mutexes with preemption disabled, which makes certain configurations very unhappy:
[ 1.983337] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:2004 [ 1.983340] in_atomic(): 1, irqs_disabled(): 0, pid: 1, name: swapper/0 [ 1.983342] Preemption disabled at: [ 1.983353] [<ffffff80089801f4>] cci_pmu_probe+0x1dc/0x488 [ 1.983360] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.18.20-rt8-yocto-preempt-rt #1 [ 1.983362] Hardware name: ZynqMP ZCU102 Rev1.0 (DT) [ 1.983364] Call trace: [ 1.983369] dump_backtrace+0x0/0x158 [ 1.983372] show_stack+0x24/0x30 [ 1.983378] dump_stack+0x80/0xa4 [ 1.983383] ___might_sleep+0x138/0x160 [ 1.983386] __might_sleep+0x58/0x90 [ 1.983391] __rt_mutex_lock_state+0x30/0xc0 [ 1.983395] _mutex_lock+0x24/0x30 [ 1.983400] perf_pmu_register+0x2c/0x388 [ 1.983404] cci_pmu_probe+0x2bc/0x488 [ 1.983409] platform_drv_probe+0x58/0xa8
It is not feasible to resolve all the possible races outside of the perf core itself, so address the immediate bug by following the example of nearly every other PMU driver and not even trying to do so. Registering the hotplug notifier first should minimise the window in which things can go wrong, so that's about as much as we can reasonably do here. This also revealed an additional race in assigning the global pointer too late relative to the hotplug notifier, which gets fixed in the process.
--- drivers/perf/arm-cci.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/perf/arm-cci.c +12 -9
@@ -1692,21 +1692,24 @@ static int cci_pmu_probe(struct platform_device *pdev)raw_spin_lock_init (&cci_pmu->hw_events.pmu_lock);mutex_init (&cci_pmu->reserve_mutex);atomic_set (&cci_pmu->active_events,0 ); - cci_pmu->cpu =get_cpu (); - - ret =cci_pmu_init (cci_pmu, pdev); -if (ret) { -put_cpu (); -return ret; - } + cci_pmu->cpu =raw_smp_processor_id (); + g_cci_pmu = cci_pmu;cpuhp_setup_state_nocalls (CPUHP_AP_PERF_ARM_CCI_ONLINE ,"perf/arm/cci:online" ,NULL , cci_pmu_offline_cpu); -put_cpu (); - g_cci_pmu = cci_pmu; + + ret =cci_pmu_init (cci_pmu, pdev); +if (ret) + goto error_pmu_init; +pr_info ("ARM %s PMU driver probed" , cci_pmu->model->name);return 0 ; + +error_pmu_init: +cpuhp_remove_state (CPUHP_AP_PERF_ARM_CCI_ONLINE ); + g_cci_pmu =NULL ; +return ret; }static int cci_pmu_remove (struct platform_device *pdev)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 124/276 media: ov2659: make S_FMT succeed even if requested format doesnt match
In reply to Greg Kroah-Hartman[ Upstream commit bccb89cf9cd07a0690d519696a00c00a973b3fe4 ]
This driver returns an error if unsupported media bus pixel code is requested by VIDIOC_SUBDEV_S_FMT.
But according to Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst,
Drivers must not return an error solely because the requested format doesn't match the device capabilities. They must instead modify the format to match what the hardware can provide.
So select default format code and return success in that case.
This is detected by v4l2-compliance.
--- drivers/media/i2c/ov2659.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/i2c/ov2659.c +4 -2
@@ -1117,8 +1117,10 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd,if (ov2659_formats[index].code == mf->code)break ; -if (index <0 ) -return -EINVAL ; +if (index <0 ) { + index =0 ; + mf->code = ov2659_formats[index].code; + } mf->colorspace =V4L2_COLORSPACE_SRGB ; mf->field =V4L2_FIELD_NONE ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 180/276 cpufreq/pasemi: fix possible object reference leak
In reply to Greg Kroah-Hartman[ Upstream commit a9acc26b75f652f697e02a9febe2ab0da648a571 ]
The call to of_get_cpu_node returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/cpufreq/pasemi-cpufreq.c:212:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 147, but without a corresponding object release within this function. ./drivers/cpufreq/pasemi-cpufreq.c:220:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 147, but without a corresponding object release within this function.
--- drivers/cpufreq/pasemi-cpufreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/pasemi-cpufreq.c +1 -0
@@ -146,6 +146,7 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) cpu =of_get_cpu_node (policy->cpu,NULL ); +of_node_put (cpu);if (!cpu) goto out;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 275/276 drm/sun4i: dsi: Enforce boundaries on the start delay
In reply to Greg Kroah-Hartman[ Upstream commit efa31801203ac2f5c6a82a28cb991c7163ee0f1d ]
The Allwinner BSP makes sure that we don't end up with a null start delay or with a delay larger than vtotal.
The former condition is likely to happen now with the reworked start delay, so make sure we enforce the same boundaries.
--- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +5 -1
@@ -358,8 +358,12 @@ static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, struct drm_display_mode *mode) {u16 start =clamp (mode->vtotal - mode->vdisplay -10 ,8 ,100 ); +u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; -return mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; +if (delay > mode->vtotal) + delay = delay % mode->vtotal; + +return max_t (u16, delay,1 ); } static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 271/276 drm/drv: Hold ref on parent device during drm_device lifetime
In reply to Greg Kroah-Hartman[ Upstream commit 56be6503aab2bc3a30beae408071b9be5e1bae51 ]
This makes it safe to access drm_device->dev after the parent device has been removed/unplugged.
--- drivers/gpu/drm/drm_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_drv.c +4 -1
@@ -499,7 +499,7 @@ int drm_dev_init(struct drm_device *dev, }kref_init (&dev->ref); - dev->dev = parent; + dev->dev =get_device (parent); dev->driver = driver;INIT_LIST_HEAD (&dev->filelist);
@@ -568,6 +568,7 @@ int drm_dev_init(struct drm_device *dev,drm_minor_free (dev,DRM_MINOR_RENDER );drm_fs_inode_free (dev->anon_inode); err_free: +put_device (dev->dev);mutex_destroy (&dev->master_mutex);mutex_destroy (&dev->ctxlist_mutex);mutex_destroy (&dev->clientlist_mutex);
@@ -603,6 +604,8 @@ void drm_dev_fini(struct drm_device *dev)drm_minor_free (dev,DRM_MINOR_PRIMARY );drm_minor_free (dev,DRM_MINOR_RENDER ); +put_device (dev->dev); +mutex_destroy (&dev->master_mutex);mutex_destroy (&dev->ctxlist_mutex);mutex_destroy (&dev->clientlist_mutex);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 241/276 hwrng: omap - Set default quality
In reply to Greg Kroah-Hartman[ Upstream commit 62f95ae805fa9e1e84d47d3219adddd97b2654b7 ]
Newer combinations of the glibc, kernel and openssh can result in long initial startup times on OMAP devices:
[ 6.671425] systemd-rc-once[102]: Creating ED25519 key; this may take some time ... [ 142.652491] systemd-rc-once[102]: Creating ED25519 key; done.
due to the blocking getrandom(2) system call:
[ 142.610335] random: crng init done
Set the quality level for the omap hwrng driver allowing the kernel to use the hwrng as an entropy source at boot.
--- drivers/char/hw_random/omap-rng.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/hw_random/omap-rng.c +1 -0
@@ -443,6 +443,7 @@ static int omap_rng_probe(struct platform_device *pdev) priv->rng.read = omap_rng_do_read; priv->rng.init = omap_rng_init; priv->rng.cleanup = omap_rng_cleanup; + priv->rng.quality =900 ; priv->rng.priv = (unsigned long )priv;platform_set_drvdata (pdev, priv);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 237/276 scsi: lpfc: avoid uninitialized variable warning
In reply to Greg Kroah-Hartman[ Upstream commit faf5a744f4f8d76e7c03912b5cd381ac8045f6ec ]
clang -Wuninitialized incorrectly sees a variable being used without initialization:
drivers/scsi/lpfc/lpfc_nvme.c:2102:37: error: variable 'localport' is uninitialized when used here
[-Werror,-Wuninitialized]
lport = (struct lpfc_nvme_lport *)localport->private;
^~~~~~~~~
drivers/scsi/lpfc/lpfc_nvme.c:2059:38: note: initialize the variable 'localport' to silence this warning
struct nvme_fc_local_port *localport;
^
= NULL1 error generated.
This is clearly in dead code, as the condition leading up to it is always false when CONFIG_NVME_FC is disabled, and the variable is always initialized when nvme_fc_register_localport() got called successfully.
Change the preprocessor conditional to the equivalent C construct, which makes the code more readable and gets rid of the warning.
--- drivers/scsi/lpfc/lpfc_nvme.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_nvme.c +4 -4
@@ -2482,15 +2482,15 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport)if (!cstat)return -ENOMEM ; +if (!IS_ENABLED (CONFIG_NVME_FC )) +return ret; +/* localport is allocated from the stack, but the registration * call allocates heap memory as well as the private area. */ -#if (IS_ENABLED (CONFIG_NVME_FC )) + ret =nvme_fc_register_localport (&nfcp_info, &lpfc_nvme_template, &vport->phba->pcidev->dev, &localport); -#else - ret = -ENOMEM ; -#endif if (!ret) {lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME |LOG_NVME_DISC , "6005 Successfully registered local "
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 207/276 x86/uaccess, signal: Fix AC=1 bloat
In reply to Greg Kroah-Hartman[ Upstream commit 88e4718275c1bddca6f61f300688b4553dc8584b ]
Occasionally GCC is less agressive with inlining and the following is observed:
arch/x86/kernel/signal.o: warning: objtool: restore_sigcontext()+0x3cc: call to force_valid_ss.isra.5() with UACCESS enabled arch/x86/kernel/signal.o: warning: objtool: do_signal()+0x384: call to frame_uc_flags.isra.0() with UACCESS enabled
Cure this by moving this code out of the AC=1 region, since it really isn't needed for the user access.
--- arch/x86/kernel/signal.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-)
arch/x86/kernel/signal.c +17 -12
@@ -132,16 +132,6 @@ static int restore_sigcontext(struct pt_regs *regs,COPY_SEG_CPL3 (cs);COPY_SEG_CPL3 (ss); -#ifdef CONFIG_X86_64 -/* -* Fix up SS if needed for the benefit of old DOSEMU and -* CRIU. -*/ -if (unlikely (!(uc_flags &UC_STRICT_RESTORE_SS ) && -user_64bit_mode (regs))) -force_valid_ss (regs); -#endif -get_user_ex (tmpflags, &sc->flags); regs->flags = (regs->flags & ~FIX_EFLAGS ) | (tmpflags &FIX_EFLAGS ); regs->orig_ax =-1 ;/* disable syscall checks */
@@ -150,6 +140,15 @@ static int restore_sigcontext(struct pt_regs *regs, buf = (void __user *)buf_val; }get_user_catch (err); +#ifdef CONFIG_X86_64 +/* +* Fix up SS if needed for the benefit of old DOSEMU and +* CRIU. +*/ +if (unlikely (!(uc_flags &UC_STRICT_RESTORE_SS ) &&user_64bit_mode (regs))) +force_valid_ss (regs); +#endif + err |=fpu__restore_sig (buf,IS_ENABLED (CONFIG_X86_32 ));force_iret ();
@@ -461,6 +460,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, {struct rt_sigframe __user *frame;void __user *fp =NULL ; +unsigned long uc_flags;int err =0 ; frame =get_sigframe (&ksig->ka, regs,sizeof (struct rt_sigframe ), &fp);
@@ -473,9 +473,11 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,return -EFAULT ; } + uc_flags =frame_uc_flags (regs); + put_user_try {/* Create the ucontext. */ -put_user_ex (frame_uc_flags (regs), &frame->uc.uc_flags); +put_user_ex (uc_flags, &frame->uc.uc_flags);put_user_ex (0 , &frame->uc.uc_link);save_altstack_ex (&frame->uc.uc_stack, regs->sp);
@@ -541,6 +543,7 @@ static int x32_setup_rt_frame(struct ksignal *ksig, {#ifdef CONFIG_X86_X32_ABI struct rt_sigframe_x32 __user *frame; +unsigned long uc_flags;void __user *restorer;int err =0 ;void __user *fpstate =NULL ;
@@ -555,9 +558,11 @@ static int x32_setup_rt_frame(struct ksignal *ksig,return -EFAULT ; } + uc_flags =frame_uc_flags (regs); + put_user_try {/* Create the ucontext. */ -put_user_ex (frame_uc_flags (regs), &frame->uc.uc_flags); +put_user_ex (uc_flags, &frame->uc.uc_flags);put_user_ex (0 , &frame->uc.uc_link);compat_save_altstack_ex (&frame->uc.uc_stack, regs->sp);put_user_ex (0 , &frame->uc.uc__pad0);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 193/276 brcmfmac: fix missing checks for kmemdup
In reply to Greg Kroah-Hartman[ Upstream commit 46953f97224d56a12ccbe9c6acaa84ca0dab2780 ]
In case kmemdup fails, the fix sets conn_info->req_ie_len and conn_info->resp_ie_len to zero to avoid buffer overflows.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +4 -0
@@ -5368,6 +5368,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, conn_info->req_ie =kmemdup (cfg->extra_buf, conn_info->req_ie_len,GFP_KERNEL ); +if (!conn_info->req_ie) + conn_info->req_ie_len =0 ; }else { conn_info->req_ie_len =0 ; conn_info->req_ie =NULL ;
@@ -5384,6 +5386,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, conn_info->resp_ie =kmemdup (cfg->extra_buf, conn_info->resp_ie_len,GFP_KERNEL ); +if (!conn_info->resp_ie) + conn_info->resp_ie_len =0 ; }else { conn_info->resp_ie_len =0 ; conn_info->resp_ie =NULL ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 191/276 rtlwifi: fix a potential NULL pointer dereference
In reply to Greg Kroah-Hartman[ Upstream commit 765976285a8c8db3f0eb7f033829a899d0c2786e ]
In case alloc_workqueue fails, the fix reports the error and returns to avoid NULL pointer dereference.
--- drivers/net/wireless/realtek/rtlwifi/base.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/realtek/rtlwifi/base.c +5 -0
@@ -469,6 +469,11 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)/* <2> work queue */ rtlpriv->works.hw = hw; rtlpriv->works.rtl_wq =alloc_workqueue ("%s" ,0 ,0 , rtlpriv->cfg->name); +if (unlikely (!rtlpriv->works.rtl_wq)) { +pr_err ("Failed to allocate work queue\n" ); +return ; + } +INIT_DELAYED_WORK (&rtlpriv->works.watchdog_wq, (void *)rtl_watchdog_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 188/276 iio: common: ssp_sensors: Initialize calculated_time in ssp_common_process_data
In reply to Greg Kroah-Hartman[ Upstream commit 6f9ca1d3eb74b81f811a87002de2d51640d135b1 ]
When building with -Wsometimes-uninitialized, Clang warns:
drivers/iio/common/ssp_sensors/ssp_iio.c:95:6: warning: variable 'calculated_time' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
While it isn't wrong, this will never be a problem because iio_push_to_buffers_with_timestamp only uses calculated_time on the same condition that it is assigned (when scan_timestamp is not zero). While iio_push_to_buffers_with_timestamp is marked as inline, Clang does inlining in the optimization stage, which happens after the semantic analysis phase (plus inline is merely a hint to the compiler).
Fix this by just zero initializing calculated_time.
--- drivers/iio/common/ssp_sensors/ssp_iio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/common/ssp_sensors/ssp_iio.c +1 -1
@@ -81,7 +81,7 @@ int ssp_common_process_data(struct iio_dev *indio_dev, void *buf, unsigned int len, int64_t timestamp) {__le32 time; -int64_t calculated_time; +int64_t calculated_time =0 ;struct ssp_sensor_data *spd =iio_priv (indio_dev);if (indio_dev->scan_bytes ==0 )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 183/276 block: sed-opal: fix IOC_OPAL_ENABLE_DISABLE_MBR
In reply to Greg Kroah-Hartman[ Upstream commit 78bf47353b0041865564deeed257a54f047c2fdc ]
The implementation of IOC_OPAL_ENABLE_DISABLE_MBR handled the value opal_mbr_data.enable_disable incorrectly: enable_disable is expected to be one of OPAL_MBR_ENABLE(0) or OPAL_MBR_DISABLE(1). enable_disable was passed directly to set_mbr_done and set_mbr_enable_disable where is was interpreted as either OPAL_TRUE(1) or OPAL_FALSE(0). The end result was that calling IOC_OPAL_ENABLE_DISABLE_MBR with OPAL_MBR_ENABLE actually disabled the shadow MBR and vice versa.
This patch adds correct conversion from OPAL_MBR_DISABLE/ENABLE to OPAL_FALSE/TRUE. The change affects existing programs using IOC_OPAL_ENABLE_DISABLE_MBR but this is typically used only once when setting up an Opal drive.
--- block/sed-opal.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
block/sed-opal.c +6 -3
@@ -2095,13 +2095,16 @@ static int opal_erase_locking_range(struct opal_dev *dev,static int opal_enable_disable_shadow_mbr (struct opal_dev *dev,struct opal_mbr_data *opal_mbr) { +u8 enable_disable = opal_mbr->enable_disable ==OPAL_MBR_ENABLE ? +OPAL_TRUE :OPAL_FALSE ; +const struct opal_step mbr_steps[] = { { opal_discovery0, }, { start_admin1LSP_opal_session, &opal_mbr->key }, - { set_mbr_done, &opal_mbr->enable_disable }, + { set_mbr_done, &enable_disable }, { end_opal_session, }, { start_admin1LSP_opal_session, &opal_mbr->key }, - { set_mbr_enable_disable, &opal_mbr->enable_disable }, + { set_mbr_enable_disable, &enable_disable }, { end_opal_session, }, {NULL , } };
@@ -2221,7 +2224,7 @@ static int __opal_lock_unlock(struct opal_dev *dev,static int __opal_set_mbr_done (struct opal_dev *dev,struct opal_key *key) { -u8 mbr_done_tf =1 ; +u8 mbr_done_tf =OPAL_TRUE ;const struct opal_step mbrdone_step [] = { { opal_discovery0, }, { start_admin1LSP_opal_session, key },
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 132/276 powerpc/64: Fix booting large kernels with STRICT_KERNEL_RWX
In reply to Greg Kroah-Hartman[ Upstream commit 56c46bba9bbfe229b4472a5be313c44c5b714a39 ]
With STRICT_KERNEL_RWX enabled anything marked __init is placed at a 16M boundary. This is necessary so that it can be repurposed later with different permissions. However, in kernels with text larger than 16M, this pushes early_setup past 32M, incapable of being reached by the branch instruction.
Fix this by setting the CTR and branching there instead.
--- arch/powerpc/kernel/head_64.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/kernel/head_64.S +3 -1
@@ -970,7 +970,9 @@ start_here_multiplatform: /* Restore parameters passed from prom_init/kexec */ mr r3,r31 - bl early_setup /* also sets r13 and SPRG_PACA */ + LOAD_REG_ADDR(r12, DOTSYM(early_setup)) + mtctr r12 + bctrl /* also sets r13 and SPRG_PACA */ LOAD_REG_ADDR(r3, start_here_common) ld r4,PACAKMSR(r13)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 166/276 mmc: sdhci-of-esdhc: add erratum A-009204 support
In reply to Greg Kroah-Hartman[ Upstream commit 5dd195522562542bc6ebe6e7bd47890d8b7ca93c ]
In the event of that any data error (like, IRQSTAT[DCE]) occurs during an eSDHC data transaction where DMA is used for data transfer to/from the system memory, setting the SYSCTL[RSTD] register may cause a system hang. If software sets the register SYSCTL[RSTD] to 1 for error recovery while DMA transferring is not complete, eSDHC may hang the system bus. This happens because the software register SYSCTL[RSTD] resets the DMA engine without waiting for the completion of pending system transactions. This erratum is to fix this issue.
--- drivers/mmc/host/sdhci-of-esdhc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/host/sdhci-of-esdhc.c +3 -0
@@ -643,6 +643,9 @@ static void esdhc_reset(struct sdhci_host *host, u8 mask)sdhci_writel (host, host->ier,SDHCI_INT_ENABLE );sdhci_writel (host, host->ier,SDHCI_SIGNAL_ENABLE ); +if (of_find_compatible_node (NULL ,NULL ,"fsl,p2020-esdhc" )) +mdelay (5 ); +if (mask &SDHCI_RESET_ALL ) { val =sdhci_readl (host,ESDHC_TBCTL ); val &= ~ESDHC_TB_EN ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 161/276 hwmon: (f71805f) Use request_muxed_region for Super-IO accesses
In reply to Greg Kroah-Hartman[ Upstream commit 73e6ff71a7ea924fb7121d576a2d41e3be3fc6b5 ]
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Unable to handle kernel paging request at virtual address ffffffbffee0002e pgd = ffffffc1d68d4000 [ffffffbffee0002e] *pgd=0000000000000000, *pud=0000000000000000 Internal error: Oops: 94000046 [#1] PREEMPT SMP Modules linked in: f71805f(+) hwmon CPU: 3 PID: 1659 Comm: insmod Not tainted 4.5.0+ #88 Hardware name: linux,dummy-virt (DT) task: ffffffc1f6665400 ti: ffffffc1d6418000 task.ti: ffffffc1d6418000 PC is at f71805f_find+0x6c/0x358 [f71805f]
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/f71805f.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/hwmon/f71805f.c +12 -3
@@ -96,17 +96,23 @@ superio_select(int base, int ld)outb (ld, base +1 ); } -static inline void +static inline int superio_enter (int base) { +if (!request_muxed_region (base,2 ,DRVNAME )) +return -EBUSY ; +outb (0x87 , base);outb (0x87 , base); + +return 0 ; }static inline void superio_exit (int base) {outb (0xaa , base); +release_region (base,2 ); }/*
@@ -1561,7 +1567,7 @@ static int __init f71805f_device_add(unsigned short address,static int __init f71805f_find (int sioaddr,unsigned short *address,struct f71805f_sio_data *sio_data) { -int err = -ENODEV ; +int err;u16 devid;static const char *const names[] = {
@@ -1569,8 +1575,11 @@ static int __init f71805f_find(int sioaddr, unsigned short *address, "F71872F/FG or F71806F/FG", }; -superio_enter (sioaddr); + err =superio_enter (sioaddr); +if (err) +return err; + err = -ENODEV ; devid =superio_inw (sioaddr,SIO_REG_MANID );if (devid !=SIO_FINTEK_ID ) goto exit;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 162/276 scsi: libsas: Do discovery on empty PHY to update PHY info
In reply to Greg Kroah-Hartman[ Upstream commit d8649fc1c5e40e691d589ed825998c36a947491c ]
When we discover the PHY is empty in sas_rediscover_dev(), the PHY information (like negotiated linkrate) is not updated.
As such, for a user examining sysfs for that PHY, they would see incorrect values:
root@(none)$ cd /sys/class/sas_phy/phy-0:0:20 root@(none)$ more negotiated_linkrate 3.0 Gbit root@(none)$ echo 0 > enable root@(none)$ more negotiated_linkrate 3.0 Gbit
So fix this, simply discover the PHY again, even though we know it's empty; in the above example, this gives us:
root@(none)$ more negotiated_linkrate Phy disabled
We must do this after unregistering the device associated with the PHY (in sas_unregister_devs_sas_addr()).
--- drivers/scsi/libsas/sas_expander.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/scsi/libsas/sas_expander.c +5 -0
@@ -2040,6 +2040,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)if ((SAS_ADDR (sas_addr) ==0 ) || (res == -ECOMM )) { phy->phy_state =PHY_EMPTY ;sas_unregister_devs_sas_addr (dev, phy_id, last); +/* +* Even though the PHY is empty, for convenience we discover +* the PHY to update the PHY info, like negotiated linkrate. +*/ +sas_ex_phy_discover (dev, phy_id);return res; }else if (SAS_ADDR (sas_addr) ==SAS_ADDR (phy->attached_sas_addr) &&dev_type_flutter (type, phy->attached_dev_type)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 141/276 irq_work: Do not raise an IPI when queueing work on the local CPU
In reply to Greg Kroah-Hartman[ Upstream commit 471ba0e686cb13752bc1ff3216c54b69a2d250ea ]
The QEMU PowerPC/PSeries machine model was not expecting a self-IPI, and it may be a bit surprising thing to do, so have irq_work_queue_on do local queueing when target is the current CPU.
[ Simplified the preprocessor comments.
Fixed unbalanced curly brackets pointed out by Thomas. ]
--- kernel/irq_work.c | 75 ++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 33 deletions(-)
kernel/irq_work.c +42 -33
@@ -56,61 +56,70 @@ void __weak arch_irq_work_raise(void)*/ } -/* -* Enqueue the irq_work @work on @cpu unless it's already pending -* somewhere. -* -* Can be re-enqueued while the callback is still in progress. -*/ -bool irq_work_queue_on (struct irq_work *work,int cpu) +/* Enqueue on current CPU, work must already be claimed and preempt disabled */ +static void __irq_work_queue_local (struct irq_work *work) { -/* All work should have been flushed before going offline */ -WARN_ON_ONCE (cpu_is_offline (cpu)); - -#ifdef CONFIG_SMP - -/* Arch remote IPI send/receive backend aren't NMI safe */ -WARN_ON_ONCE (in_nmi ()); +/* If the work is "lazy", handle it from next tick if any */ +if (work->flags &IRQ_WORK_LAZY ) { +if (llist_add (&work->llnode,this_cpu_ptr (&lazy_list)) && +tick_nohz_tick_stopped ()) +arch_irq_work_raise (); + }else { +if (llist_add (&work->llnode,this_cpu_ptr (&raised_list))) +arch_irq_work_raise (); + } +} +/* Enqueue the irq work @work on the current CPU */ +bool irq_work_queue (struct irq_work *work) +{/* Only queue if not already pending */ if (!irq_work_claim (work))return false; -if (llist_add (&work->llnode, &per_cpu (raised_list, cpu))) -arch_send_call_function_single_ipi (cpu); - -#else /* #ifdef CONFIG_SMP */ -irq_work_queue (work); -#endif /* #else #ifdef CONFIG_SMP */ +/* Queue the entry and raise the IPI if needed. */ +preempt_disable (); +__irq_work_queue_local (work); +preempt_enable ();return true; } +EXPORT_SYMBOL_GPL (irq_work_queue); -/* Enqueue the irq work @work on the current CPU */ -bool irq_work_queue (struct irq_work *work) +/* +* Enqueue the irq_work @work on @cpu unless it's already pending +* somewhere. +* +* Can be re-enqueued while the callback is still in progress. +*/ +bool irq_work_queue_on (struct irq_work *work,int cpu) { +#ifndef CONFIG_SMP +return irq_work_queue (work); + +#else /* CONFIG_SMP: */ +/* All work should have been flushed before going offline */ +WARN_ON_ONCE (cpu_is_offline (cpu)); +/* Only queue if not already pending */ if (!irq_work_claim (work))return false; -/* Queue the entry and raise the IPI if needed. */ preempt_disable (); - -/* If the work is "lazy", handle it from next tick if any */ -if (work->flags &IRQ_WORK_LAZY ) { -if (llist_add (&work->llnode,this_cpu_ptr (&lazy_list)) && -tick_nohz_tick_stopped ()) -arch_irq_work_raise (); +if (cpu !=smp_processor_id ()) { +/* Arch remote IPI send/receive backend aren't NMI safe */ +WARN_ON_ONCE (in_nmi ()); +if (llist_add (&work->llnode, &per_cpu (raised_list, cpu))) +arch_send_call_function_single_ipi (cpu); }else { -if (llist_add (&work->llnode,this_cpu_ptr (&raised_list))) -arch_irq_work_raise (); +__irq_work_queue_local (work); } -preempt_enable ();return true; +#endif /* CONFIG_SMP */ } -EXPORT_SYMBOL_GPL (irq_work_queue); +bool irq_work_needs_cpu (void ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 82/276 btrfs: Dont panic when we cant find a root key
In reply to Greg Kroah-Hartman[ Upstream commit 7ac1e464c4d473b517bb784f30d40da1f842482e ]
When we failed to find a root key in btrfs_update_root(), we just panic.
That's definitely not cool, fix it by outputting an unique error message, aborting current transaction and return -EUCLEAN. This should not normally happen as the root has been used by the callers in some way.
--- fs/btrfs/root-tree.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
fs/btrfs/root-tree.c +8 -5
@@ -135,11 +135,14 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_rootif (ret <0 ) goto out; -if (ret !=0 ) { -btrfs_print_leaf (path->nodes[0 ]); -btrfs_crit (fs_info,"unable to update root key %llu %u %llu" , - key->objectid, key->type, key->offset); -BUG_ON (1 ); +if (ret >0 ) { +btrfs_crit (fs_info, +"unable to find root key (%llu %u %llu) in tree %llu" , + key->objectid, key->type, key->offset, + root->root_key.objectid); + ret = -EUCLEAN ; +btrfs_abort_transaction (trans, ret); + goto out; } l = path->nodes[0 ];
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 123/276 media: au0828: stop video streaming only when last user stops
In reply to Greg Kroah-Hartman[ Upstream commit f604f0f5afb88045944567f604409951b5eb6af8 ]
If the application was streaming from both videoX and vbiX, and streaming from videoX was stopped, then the vbi streaming also stopped.
The cause being that stop_streaming for video stopped the subdevs as well, instead of only doing that if dev->streaming_users reached 0.
au0828_stop_vbi_streaming was also wrong since it didn't stop the subdevs at all when dev->streaming_users reached 0.
--- drivers/media/usb/au0828/au0828-video.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/media/usb/au0828/au0828-video.c +8 -5
@@ -839,9 +839,9 @@ int au0828_start_analog_streaming(struct vb2_queue *vq, unsigned int count)return rc; } +v4l2_device_call_all (&dev->v4l2_dev,0 , video, s_stream,1 ); +if (vq->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE ) { -v4l2_device_call_all (&dev->v4l2_dev,0 , video, - s_stream,1 ); dev->vid_timeout_running =1 ;mod_timer (&dev->vid_timeout, jiffies + (HZ /10 )); }else if (vq->type ==V4L2_BUF_TYPE_VBI_CAPTURE ) {
@@ -861,10 +861,11 @@ static void au0828_stop_streaming(struct vb2_queue *vq)dprintk (1 ,"au0828_stop_streaming called %d\n" , dev->streaming_users); -if (dev->streaming_users-- ==1 ) +if (dev->streaming_users-- ==1 ) {au0828_uninit_isoc (dev); +v4l2_device_call_all (&dev->v4l2_dev,0 , video, s_stream,0 ); + } -v4l2_device_call_all (&dev->v4l2_dev,0 , video, s_stream,0 ); dev->vid_timeout_running =0 ;del_timer_sync (&dev->vid_timeout);
@@ -893,8 +894,10 @@ void au0828_stop_vbi_streaming(struct vb2_queue *vq)dprintk (1 ,"au0828_stop_vbi_streaming called %d\n" , dev->streaming_users); -if (dev->streaming_users-- ==1 ) +if (dev->streaming_users-- ==1 ) {au0828_uninit_isoc (dev); +v4l2_device_call_all (&dev->v4l2_dev,0 , video, s_stream,0 ); + }spin_lock_irqsave (&dev->slock, flags);if (dev->isoc_ctl.vbi_buf !=NULL ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 113/276 mm/uaccess: Use unsigned long to placate UBSAN warnings on older GCC versions
In reply to Greg Kroah-Hartman[ Upstream commit 29da93fea3ea39ab9b12270cc6be1b70ef201c9e ]
Randy reported objtool triggered on his (GCC-7.4) build:
lib/strncpy_from_user.o: warning: objtool: strncpy_from_user()+0x315: call to __ubsan_handle_add_overflow() with UACCESS enabled lib/strnlen_user.o: warning: objtool: strnlen_user()+0x337: call to __ubsan_handle_sub_overflow() with UACCESS enabled
This is due to UBSAN generating signed-overflow-UB warnings where it should not. Prior to GCC-8 UBSAN ignored -fwrapv (which the kernel uses through -fno-strict-overflow).
Make the functions use 'unsigned long' throughout.
--- lib/strncpy_from_user.c | 5 +++-- lib/strnlen_user.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
lib/strncpy_from_user.c +3 -2
@@ -23,10 +23,11 @@* hit it), 'max' is the address space maximum (and we return * -EFAULT if we hit it). */ -static inline long do_strncpy_from_user (char *dst,const char __user *src,long count,unsigned long max) +static inline long do_strncpy_from_user (char *dst,const char __user *src, +unsigned long count,unsigned long max) {const struct word_at_a_time constants =WORD_AT_A_TIME_CONSTANTS ; -long res =0 ; +unsigned long res =0 ;/* * Truncate 'max' to the user-specified limit, so that
lib/strnlen_user.c +2 -2
@@ -28,7 +28,7 @@static inline long do_strnlen_user (const char __user *src,unsigned long count,unsigned long max) {const struct word_at_a_time constants =WORD_AT_A_TIME_CONSTANTS ; -long align, res =0 ; +unsigned long align, res =0 ;unsigned long c;/*
@@ -42,7 +42,7 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count,* Do everything aligned. But that means that we * need to also expand the maximum.. */ - align = (sizeof (long ) -1 ) & (unsigned long )src; + align = (sizeof (unsigned long ) -1 ) & (unsigned long )src; src -= align; max += align;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 93/276 libbpf: fix samples/bpf build failure due to undefined UINT32_MAX
In reply to Greg Kroah-Hartman[ Upstream commit 32e621e55496a0009f44fe4914cd4a23cade4984 ]
Currently, building bpf samples will cause the following error.
./tools/lib/bpf/bpf.h:132:27: error: 'UINT32_MAX' undeclared here (not in a function) ..
#define BPF_LOG_BUF_SIZE (UINT32_MAX >> 8) /* verifier maximum in kernels <= 5.1 */
^
./samples/bpf/bpf_load.h:31:25: note: in expansion of macro 'BPF_LOG_BUF_SIZE'
extern char bpf_log_buf[BPF_LOG_BUF_SIZE];
^~~~~~~~~~~~~~~~Due to commit 4519efa6f8ea ("libbpf: fix BPF_LOG_BUF_SIZE off-by-one error") hard-coded size of BPF_LOG_BUF_SIZE has been replaced with UINT32_MAX which is defined in <stdint.h> header.
Even with this change, bpf selftests are running fine since these are built with clang and it includes header(-idirafter) from clang/6.0.0/include. (it has <stdint.h>)
clang -I. -I./include/uapi -I../../../include/uapi -idirafter /usr/local/include -idirafter /usr/include \
-idirafter /usr/lib/llvm-6.0/lib/clang/6.0.0/include -idirafter /usr/include/x86_64-linux-gnu \
-Wno-compare-distinct-pointer-types -O2 -target bpf -emit-llvm -c progs/test_sysctl_prog.c -o - | \
llc -march=bpf -mcpu=generic -filetype=obj -o /linux/tools/testing/selftests/bpf/test_sysctl_prog.oBut bpf samples are compiled with GCC, and it only searches and includes headers declared at the target file. As '#include <stdint.h>' hasn't been declared in tools/lib/bpf/bpf.h, it causes build failure of bpf samples.
gcc -Wp,-MD,./samples/bpf/.sockex3_user.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes \
-O2 -fomit-frame-pointer -std=gnu89 -I./usr/include -I./tools/lib/ -I./tools/testing/selftests/bpf/ \
-I./tools/ lib/ -I./tools/include -I./tools/perf -c -o ./samples/bpf/sockex3_user.o ./samples/bpf/sockex3_user.c;This commit add declaration of '#include <stdint.h>' to tools/lib/bpf/bpf.h to fix this problem.
--- tools/lib/bpf/bpf.h | 1 + 1 file changed, 1 insertion(+)
tools/lib/bpf/bpf.h +1 -0
@@ -26,6 +26,7 @@#include <linux/bpf.h> #include <stdbool.h> #include <stddef.h> +#include <stdint.h> struct bpf_create_map_attr {const char *name;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 37/276 media: vivid: use vfree() instead of kfree() for dev->bitmap_cap
In reply to Greg Kroah-HartmanFrom: Alexander Potapenko <[email protected]>
commit dad7e270ba712ba1c99cd2d91018af6044447a06 upstream.
syzkaller reported crashes on kfree() called from vivid_vid_cap_s_selection(). This looks like a simple typo, as dev->bitmap_cap is allocated with vzalloc() throughout the file.
parts")
--- drivers/media/platform/vivid/vivid-vid-cap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/vivid/vivid-vid-cap.c +1 -1
@@ -992,7 +992,7 @@ int vivid_vid_cap_s_selection(struct filv4l2_rect_map_inside (&s->r, &dev->fmt_cap_rect);if (dev->bitmap_cap && (compose->width != s->r.width || compose->height != s->r.height)) { -kfree (dev->bitmap_cap); +vfree (dev->bitmap_cap); dev->bitmap_cap =NULL ; } *compose = s->r;
Greg Kroah-Hartman
maintainerPATCH 76/276 scsi: qla2xxx: Fix abort handling in tcm_qla2xxx_write_pending()
In reply to Greg Kroah-Hartman[ Upstream commit e209783d66bca04b5fce4429e59338517ffc1a0b ]
Implementations of the .write_pending() callback functions must guarantee that an appropriate LIO core callback function will be called immediately or at a later time. Make sure that this guarantee is met for aborted SCSI commands.
[mkp: typo]
--- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/qla2xxx/tcm_qla2xxx.c +2 -0
@@ -390,6 +390,8 @@ static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd) cmd->se_cmd.transport_state, cmd->se_cmd.t_state, cmd->se_cmd.se_cmd_flags); +transport_generic_request_failure (&cmd->se_cmd, +TCM_CHECK_CONDITION_ABORT_CMD );return 0 ; } cmd->trc_flags |=TRC_XFR_RDY ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 33/276 fbdev: fix WARNING in __alloc_pages_nodemask bug
In reply to Greg Kroah-HartmanFrom: Jiufei Xue <[email protected]>
commit 8c40292be9169a9cbe19aadd1a6fc60cbd1af82f upstream.
Syzkaller hit 'WARNING in __alloc_pages_nodemask' bug.
WARNING: CPU: 1 PID: 1473 at mm/page_alloc.c:4377 __alloc_pages_nodemask+0x4da/0x2130 Kernel panic - not syncing: panic_on_warn set ... Call Trace: alloc_pages_current+0xb1/0x1e0 kmalloc_order+0x1f/0x60 kmalloc_order_trace+0x1d/0x120 fb_alloc_cmap_gfp+0x85/0x2b0 fb_set_user_cmap+0xff/0x370 do_fb_ioctl+0x949/0xa20 fb_ioctl+0xdd/0x120 do_vfs_ioctl+0x186/0x1070 ksys_ioctl+0x89/0xa0 __x64_sys_ioctl+0x74/0xb0 do_syscall_64+0xc8/0x550 entry_SYSCALL_64_after_hwframe+0x49/0xbe
This is a warning about order >= MAX_ORDER and the order is from userspace ioctl. Add flag __NOWARN to silence this warning.
--- drivers/video/fbdev/core/fbcmap.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/video/fbdev/core/fbcmap.c +2 -0
@@ -94,6 +94,8 @@ int fb_alloc_cmap_gfp(struct fb_cmap *cmint size = len *sizeof (u16);int ret = -ENOMEM ; + flags |= __GFP_NOWARN; +if (cmap->len != len) {fb_dealloc_cmap (cmap);if (!len)
Greg Kroah-Hartman
maintainerPATCH 75/276 scsi: qla2xxx: Fix a qla24xx_enable_msix() error path
In reply to Greg Kroah-Hartman[ Upstream commit 24afabdbd0b3553963a2bbf465895492b14d1107 ]
Make sure that the allocated interrupts are freed if allocating memory for the msix_entries array fails.
--- drivers/scsi/qla2xxx/qla_isr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_isr.c +5 -1
@@ -3449,7 +3449,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)ql_log (ql_log_fatal, vha,0x00c8 ,"Failed to allocate memory for ha->msix_entries.\n" ); ret = -ENOMEM ; - goto msix_out; + goto free_irqs; } ha->flags.msix_enabled =1 ;
@@ -3532,6 +3532,10 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) msix_out:return ret; + +free_irqs: +pci_free_irq_vectors (ha->pdev); + goto msix_out; }int
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 73/276 powerpc/watchdog: Use hrtimers for per-CPU heartbeat
In reply to Greg Kroah-Hartman[ Upstream commit 7ae3f6e130e8dc6188b59e3b4ebc2f16e9c8d053 ]
Using a jiffies timer creates a dependency on the tick_do_timer_cpu incrementing jiffies. If that CPU has locked up and jiffies is not incrementing, the watchdog heartbeat timer for all CPUs stops and creates false positives and confusing warnings on local CPUs, and also causes the SMP detector to stop, so the root cause is never detected.
Fix this by using hrtimer based timers for the watchdog heartbeat, like the generic kernel hardlockup detector.
--- arch/powerpc/kernel/watchdog.c | 81 +++++++++++++++++----------------- 1 file changed, 40 insertions(+), 41 deletions(-)
arch/powerpc/kernel/watchdog.c +40 -41
@@ -77,7 +77,7 @@ static u64 wd_smp_panic_timeout_tb __read_mostly; /* panic other CPUs */static u64 wd_timer_period_ms__read_mostly ;/* interval between heartbeat */ -static DEFINE_PER_CPU(struct timer_list, wd_timer); +static DEFINE_PER_CPU(struct hrtimer, wd_hrtimer); static DEFINE_PER_CPU(u64, wd_timer_tb);/* SMP checker bits */
@@ -293,21 +293,21 @@ void soft_nmi_interrupt(struct pt_regs *regs)nmi_exit (); } -static void wd_timer_reset (unsigned int cpu,struct timer_list *t) -{ - t->expires = jiffies +msecs_to_jiffies (wd_timer_period_ms); -if (wd_timer_period_ms >1000 ) - t->expires =__round_jiffies_up (t->expires, cpu); -add_timer_on (t, cpu); -} - -static void wd_timer_fn (struct timer_list *t) +static enum hrtimer_restart watchdog_timer_fn (struct hrtimer *hrtimer) {int cpu =smp_processor_id (); +if (!(watchdog_enabled &NMI_WATCHDOG_ENABLED )) +return HRTIMER_NORESTART ; + +if (!cpumask_test_cpu (cpu, &watchdog_cpumask)) +return HRTIMER_NORESTART ; +watchdog_timer_interrupt (cpu); -wd_timer_reset (cpu, t); +hrtimer_forward_now (hrtimer,ms_to_ktime (wd_timer_period_ms)); + +return HRTIMER_RESTART ; }void arch_touch_nmi_watchdog (void )
@@ -323,37 +323,22 @@ void arch_touch_nmi_watchdog(void) }EXPORT_SYMBOL (arch_touch_nmi_watchdog); -static void start_watchdog_timer_on (unsigned int cpu) -{ -struct timer_list *t =per_cpu_ptr (&wd_timer, cpu); - -per_cpu (wd_timer_tb, cpu) =get_tb (); - -timer_setup (t, wd_timer_fn,TIMER_PINNED ); -wd_timer_reset (cpu, t); -} - -static void stop_watchdog_timer_on (unsigned int cpu) -{ -struct timer_list *t =per_cpu_ptr (&wd_timer, cpu); - -del_timer_sync (t); -} - -static int start_wd_on_cpu (unsigned int cpu) +static void start_watchdog (void *arg) { +struct hrtimer *hrtimer =this_cpu_ptr (&wd_hrtimer); +int cpu =smp_processor_id ();unsigned long flags;if (cpumask_test_cpu (cpu, &wd_cpus_enabled)) {WARN_ON (1 ); -return 0 ; +return ; }if (!(watchdog_enabled &NMI_WATCHDOG_ENABLED )) -return 0 ; +return ;if (!cpumask_test_cpu (cpu, &watchdog_cpumask)) -return 0 ; +return ;wd_smp_lock (&flags);cpumask_set_cpu (cpu, &wd_cpus_enabled);
@@ -363,27 +348,40 @@ static int start_wd_on_cpu(unsigned int cpu) }wd_smp_unlock (&flags); -start_watchdog_timer_on (cpu); + *this_cpu_ptr (&wd_timer_tb) =get_tb (); -return 0 ; +hrtimer_init (hrtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); + hrtimer->function = watchdog_timer_fn; +hrtimer_start (hrtimer,ms_to_ktime (wd_timer_period_ms), +HRTIMER_MODE_REL_PINNED ); } -static int stop_wd_on_cpu (unsigned int cpu) +static int start_watchdog_on_cpu (unsigned int cpu) { +return smp_call_function_single (cpu, start_watchdog,NULL , true); +} + +static void stop_watchdog (void *arg) +{ +struct hrtimer *hrtimer =this_cpu_ptr (&wd_hrtimer); +int cpu =smp_processor_id ();unsigned long flags;if (!cpumask_test_cpu (cpu, &wd_cpus_enabled)) -return 0 ;/* Can happen in CPU unplug case */ +return ;/* Can happen in CPU unplug case */ -stop_watchdog_timer_on (cpu); +hrtimer_cancel (hrtimer);wd_smp_lock (&flags);cpumask_clear_cpu (cpu, &wd_cpus_enabled);wd_smp_unlock (&flags);wd_smp_clear_cpu_pending (cpu,get_tb ()); +} -return 0 ; +static int stop_watchdog_on_cpu (unsigned int cpu) +{ +return smp_call_function_single (cpu, stop_watchdog,NULL , true); }static void watchdog_calc_timeouts (void )
@@ -402,7 +400,7 @@ void watchdog_nmi_stop(void)int cpu;for_each_cpu (cpu, &wd_cpus_enabled) -stop_wd_on_cpu (cpu); +stop_watchdog_on_cpu (cpu); }void watchdog_nmi_start (void )
@@ -411,7 +409,7 @@ void watchdog_nmi_start(void)watchdog_calc_timeouts ();for_each_cpu_and (cpu, cpu_online_mask, &watchdog_cpumask) -start_wd_on_cpu (cpu); +start_watchdog_on_cpu (cpu); }/*
@@ -423,7 +421,8 @@ int __init watchdog_nmi_probe(void) err =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN ,"powerpc/watchdog:online" , - start_wd_on_cpu, stop_wd_on_cpu); + start_watchdog_on_cpu, + stop_watchdog_on_cpu);if (err <0 ) {pr_warn ("could not be initialized" );return err;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 66/276 spi: pxa2xx: fix SCR (divisor) calculation
In reply to Greg Kroah-Hartman[ Upstream commit 29f2133717c527f492933b0622a4aafe0b3cbe9e ]
Calculate the divisor for the SCR (Serial Clock Rate), avoiding that the SSP transmission rate can be greater than the device rate.
When the division between the SSP clock and the device rate generates a reminder, we have to increment by one the divisor.
In this way the resulting SSP clock will never be greater than the device SPI max frequency.
For example, with:
- ssp_clk = 50 MHz
- dev freq = 15 MHz
without this patch the SSP clock will be greater than 15 MHz:
- 25 MHz for PXA25x_SSP and CE4100_SSP
- 16,56 MHz for the others
Instead, with this patch, we have in both case an SSP clock of 12.5MHz, so the max rate of the SPI device clock is respected.
--- drivers/spi/spi-pxa2xx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/spi/spi-pxa2xx.c +6 -2
@@ -876,10 +876,14 @@ static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate) rate =min_t (int, ssp_clk, rate); +/* +* Calculate the divisor for the SCR (Serial Clock Rate), avoiding +* that the SSP transmission rate can be greater than the device rate +*/ if (ssp->type == PXA25x_SSP || ssp->type ==CE4100_SSP ) -return (ssp_clk / (2 * rate) -1 ) &0xff ; +return (DIV_ROUND_UP (ssp_clk,2 * rate) -1 ) &0xff ;else -return (ssp_clk / rate -1 ) &0xfff ; +return (DIV_ROUND_UP (ssp_clk, rate) -1 ) &0xfff ; } static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 67/276 brcm80211: potential NULL dereference in brcmf_cfg80211_vndr_cmds_dcmd_handler()
In reply to Greg Kroah-Hartman[ Upstream commit e025da3d7aa4770bb1d1b3b0aa7cc4da1744852d ]
If "ret_len" is negative then it could lead to a NULL dereference.
The "ret_len" value comes from nl80211_vendor_cmd(), if it's negative then we don't allocate the "dcmd_buf" buffer. Then we pass "ret_len" to brcmf_fil_cmd_data_set() where it is cast to a very high u32 value. Most of the functions in that call tree check whether the buffer we pass is NULL but there are at least a couple places which don't such as brcmf_dbg_hex_dump() and brcmf_msgbuf_query_dcmd(). We memcpy() to and from the buffer so it would result in a NULL dereference.
The fix is to change the types so that "ret_len" can't be negative. (If we memcpy() zero bytes to NULL, that's a no-op and doesn't cause an issue).
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c +3 -2
@@ -35,9 +35,10 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy,struct brcmf_if *ifp;const struct brcmf_vndr_dcmd_hdr *cmdhdr = data;struct sk_buff *reply; -int ret, payload, ret_len; +unsigned int payload, ret_len;void *dcmd_buf =NULL , *wr_pointer;u16 msglen, maxmsglen =PAGE_SIZE -0x100 ; +int ret;if (len <sizeof (*cmdhdr)) {brcmf_err ("vendor command too short: %d\n" , len);
@@ -65,7 +66,7 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy,brcmf_err ("oversize return buffer %d\n" , ret_len); ret_len =BRCMF_DCMD_MAXLEN ; } - payload =max (ret_len, len) +1 ; + payload = max_t(unsigned int, ret_len, len) + 1; dcmd_buf =vzalloc (payload);if (NULL == dcmd_buf)return -ENOMEM ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 62/276 powerpc/perf: Return accordingly on invalid chip-id in
In reply to Greg Kroah-Hartman[ Upstream commit a913e5e8b43be1d3897a141ce61c1ec071cad89c ]
Nest hardware counter memory resides in a per-chip reserve-memory. During nest_imc_event_init(), chip-id of the event-cpu is considered to calculate the base memory addresss for that cpu. Return, proper error condition if the chip_id calculated is invalid.
--- arch/powerpc/perf/imc-pmu.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/powerpc/perf/imc-pmu.c +5 -0
@@ -496,6 +496,11 @@ static int nest_imc_event_init(struct perf_event *event)* Get the base memory addresss for this cpu. */ chip_id =cpu_to_chip_id (event->cpu); + +/* Return, if chip_id is not valid */ +if (chip_id <0 ) +return -ENODEV ; + pcni = pmu->mem_info; do { if (pcni->id == chip_id) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 60/276 usb: dwc3: move synchronize_irq() out of the spinlock protected block
In reply to Greg Kroah-Hartman[ Upstream commit 41a91c606e7d2b74358a944525267cc451c271e8 ]
dwc3_gadget_suspend() is called under dwc->lock spinlock. In such context calling synchronize_irq() is not allowed. Move the problematic call out of the protected block to fix the following kernel BUG during system suspend:
BUG: sleeping function called from invalid context at kernel/irq/manage.c:112
in_atomic(): 1, irqs_disabled(): 128, pid: 1601, name: rtcwake
6 locks held by rtcwake/1601:
#0: f70ac2a2 (sb_writers#7){.+.+}, at: vfs_write+0x130/0x16c
#1: b5fe1270 (&of->mutex){+.+.}, at: kernfs_fop_write+0xc0/0x1e4 #2: 7e597705 (kn->count#60){.+.+}, at: kernfs_fop_write+0xc8/0x1e4 #3: 8b3527d0 (system_transition_mutex){+.+.}, at: pm_suspend+0xc4/0xc04 #4: fc7f1c42 (&dev->mutex){....}, at: __device_suspend+0xd8/0x74c #5: 4b36507e (&(&dwc->lock)->rlock){....}, at: dwc3_gadget_suspend+0x24/0x3c
irq event stamp: 11252 hardirqs last enabled at (11251): [<c09c54a4>] _raw_spin_unlock_irqrestore+0x6c/0x74 hardirqs last disabled at (11252): [<c09c4d44>] _raw_spin_lock_irqsave+0x1c/0x5c softirqs last enabled at (9744): [<c0102564>] __do_softirq+0x3a4/0x66c softirqs last disabled at (9737): [<c0128528>] irq_exit+0x140/0x168 Preemption disabled at: [<00000000>] (null) CPU: 7 PID: 1601 Comm: rtcwake Not tainted 5.0.0-rc3-next-20190122-00039-ga3f4ee4f8a52 #5252 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [<c01110f0>] (unwind_backtrace) from [<c010d120>] (show_stack+0x10/0x14) [<c010d120>] (show_stack) from [<c09a4d04>] (dump_stack+0x90/0xc8) [<c09a4d04>] (dump_stack) from [<c014c700>] (___might_sleep+0x22c/0x2c8) [<c014c700>] (___might_sleep) from [<c0189d68>] (synchronize_irq+0x28/0x84) [<c0189d68>] (synchronize_irq) from [<c05cbbf8>] (dwc3_gadget_suspend+0x34/0x3c) [<c05cbbf8>] (dwc3_gadget_suspend) from [<c05bd020>] (dwc3_suspend_common+0x154/0x410) [<c05bd020>] (dwc3_suspend_common) from [<c05bd34c>] (dwc3_suspend+0x14/0x2c) [<c05bd34c>] (dwc3_suspend) from [<c051c730>] (platform_pm_suspend+0x2c/0x54) [<c051c730>] (platform_pm_suspend) from [<c05285d4>] (dpm_run_callback+0xa4/0x3dc) [<c05285d4>] (dpm_run_callback) from [<c0528a40>] (__device_suspend+0x134/0x74c) [<c0528a40>] (__device_suspend) from [<c052c508>] (dpm_suspend+0x174/0x588) [<c052c508>] (dpm_suspend) from [<c0182134>] (suspend_devices_and_enter+0xc0/0xe74) [<c0182134>] (suspend_devices_and_enter) from [<c0183658>] (pm_suspend+0x770/0xc04) [<c0183658>] (pm_suspend) from [<c0180ddc>] (state_store+0x6c/0xcc) [<c0180ddc>] (state_store) from [<c09a9a70>] (kobj_attr_store+0x14/0x20) [<c09a9a70>] (kobj_attr_store) from [<c02d6800>] (sysfs_kf_write+0x4c/0x50) [<c02d6800>] (sysfs_kf_write) from [<c02d594c>] (kernfs_fop_write+0xfc/0x1e4) [<c02d594c>] (kernfs_fop_write) from [<c02593d8>] (__vfs_write+0x2c/0x160) [<c02593d8>] (__vfs_write) from [<c0259694>] (vfs_write+0xa4/0x16c) [<c0259694>] (vfs_write) from [<c0259870>] (ksys_write+0x40/0x8c) [<c0259870>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28) Exception stack(0xed55ffa8 to 0xed55fff0)
...
--- drivers/usb/dwc3/core.c | 2 ++ drivers/usb/dwc3/gadget.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/dwc3/core.c +2 -0
@@ -1591,6 +1591,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)spin_lock_irqsave (&dwc->lock, flags);dwc3_gadget_suspend (dwc);spin_unlock_irqrestore (&dwc->lock, flags); +synchronize_irq (dwc->irq_gadget);dwc3_core_exit (dwc);break ;case DWC3_GCTL_PRTCAP_HOST :
@@ -1623,6 +1624,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)spin_lock_irqsave (&dwc->lock, flags);dwc3_gadget_suspend (dwc);spin_unlock_irqrestore (&dwc->lock, flags); +synchronize_irq (dwc->irq_gadget); }dwc3_otg_exit (dwc);
drivers/usb/dwc3/gadget.c +0 -2
@@ -3277,8 +3277,6 @@ int dwc3_gadget_suspend(struct dwc3 *dwc)dwc3_disconnect_gadget (dwc);__dwc3_gadget_stop (dwc); -synchronize_irq (dwc->irq_gadget); -return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 31/276 btrfs: honor path->skip_locking in backref code
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 38e3eebff643db725633657d1d87a3be019d1018 upstream.
Qgroups will do the old roots lookup at delayed ref time, which could be while walking down the extent root while running a delayed ref. This should be fine, except we specifically lock eb's in the backref walking code irrespective of path->skip_locking, which deadlocks the system. Fix up the backref code to honor path->skip_locking, nobody will be modifying the commit_root when we're searching so it's completely safe to do.
This happens since fb235dc06fac ("btrfs: qgroup: Move half of the qgroup accounting time out of commit trans"), kernel may lockup with quota enabled.
There is one backref trace triggered by snapshot dropping along with write operation in the source subvolume. The example can be reliably reproduced:
btrfs-cleaner D 0 4062 2 0x80000000
Call Trace: schedule+0x32/0x90 btrfs_tree_read_lock+0x93/0x130 [btrfs] find_parent_nodes+0x29b/0x1170 [btrfs] btrfs_find_all_roots_safe+0xa8/0x120 [btrfs] btrfs_find_all_roots+0x57/0x70 [btrfs] btrfs_qgroup_trace_extent_post+0x37/0x70 [btrfs] btrfs_qgroup_trace_leaf_items+0x10b/0x140 [btrfs] btrfs_qgroup_trace_subtree+0xc8/0xe0 [btrfs] do_walk_down+0x541/0x5e3 [btrfs] walk_down_tree+0xab/0xe7 [btrfs] btrfs_drop_snapshot+0x356/0x71a [btrfs] btrfs_clean_one_deleted_snapshot+0xb8/0xf0 [btrfs] cleaner_kthread+0x12b/0x160 [btrfs] kthread+0x112/0x130 ret_from_fork+0x27/0x50
When dropping snapshots with qgroup enabled, we will trigger backref walk.
However such backref walk at that timing is pretty dangerous, as if one of the parent nodes get WRITE locked by other thread, we could cause a dead lock.
For example:
FS 260 FS 261 (Dropped)
node A node B
/ \ / \
node C node D node E
/ \ / \ / \leaf F|leaf G|leaf H|leaf I|leaf J|leaf K
The lock sequence would be:
Thread A (cleaner) | Thread B (other writer)
-----------------------------------------------------------------------
write_lock(B) |
write_lock(D) |
^^^ called by walk_down_tree() |
| write_lock(A)
| write_lock(D) << Stall
read_lock(H) << for backref walk |
read_lock(D) << lock owner is |
the same thread A |
so read lock is OK |
read_lock(A) << Stall |So thread A hold write lock D, and needs read lock A to unlock. While thread B holds write lock A, while needs lock D to unlock.
This will cause a deadlock.
This is not only limited to snapshot dropping case. As the backref walk, even only happens on commit trees, is breaking the normal top-down locking order, makes it deadlock prone.
--- fs/btrfs/backref.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
fs/btrfs/backref.c +12 -7
@@ -710,7 +710,7 @@ out:* read tree blocks and add keys where required. */ static int add_missing_keys (struct btrfs_fs_info *fs_info, -struct preftrees *preftrees) +struct preftrees *preftrees,bool lock) {struct prelim_ref *ref;struct extent_buffer *eb;
@@ -735,12 +735,14 @@ static int add_missing_keys(struct btrfsfree_extent_buffer (eb);return -EIO ; } -btrfs_tree_read_lock (eb); +if (lock) +btrfs_tree_read_lock (eb);if (btrfs_header_level (eb) ==0 )btrfs_item_key_to_cpu (eb, &ref->key_for_search,0 );else btrfs_node_key_to_cpu (eb, &ref->key_for_search,0 ); -btrfs_tree_read_unlock (eb); +if (lock) +btrfs_tree_read_unlock (eb);free_extent_buffer (eb);prelim_ref_insert (fs_info, &preftrees->indirect, ref,NULL );cond_resched ();
@@ -1225,7 +1227,7 @@ again:btrfs_release_path (path); - ret =add_missing_keys (fs_info, &preftrees); + ret =add_missing_keys (fs_info, &preftrees, path->skip_locking ==0 );if (ret) goto out;
@@ -1286,11 +1288,14 @@ again: ret = -EIO ; goto out; } -btrfs_tree_read_lock (eb); -btrfs_set_lock_blocking_rw (eb,BTRFS_READ_LOCK ); +if (!path->skip_locking) { +btrfs_tree_read_lock (eb); +btrfs_set_lock_blocking_rw (eb,BTRFS_READ_LOCK ); + } ret =find_extent_in_eb (eb, bytenr, *extent_item_pos, &eie, ignore_offset); -btrfs_tree_read_unlock_blocking (eb); +if (!path->skip_locking) +btrfs_tree_read_unlock_blocking (eb);free_extent_buffer (eb);if (ret <0 ) goto out;
Greg Kroah-Hartman
maintainerPATCH 4/276 f2fs: Fix use of number of devices
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit 0916878da355650d7e77104a7ac0fa1784eca852 upstream.
For a single device mount using a zoned block device, the zone information for the device is stored in the sbi->devs single entry array and sbi->s_ndevs is set to 1. This differs from a single device mount using a regular block device which does not allocate sbi->devs and sets sbi->s_ndevs to 0.
However, sbi->s_devs == 0 condition is used throughout the code to differentiate a single device mount from a multi-device mount where sbi->s_ndevs is always larger than 1. This results in problems with single zoned block device volumes as these are treated as multi-device mounts but do not have the start_blk and end_blk information set. One of the problem observed is skipping of zone discard issuing resulting in write commands being issued to full zones or unaligned to a zone write pointer.
Fix this problem by simply treating the cases sbi->s_ndevs == 0 (single regular block device mount) and sbi->s_ndevs == 1 (single zoned block device mount) in the same manner. This is done by introducing the helper function f2fs_is_multi_device() and using this helper in place of direct tests of sbi->s_ndevs value, improving code readability.
fs/f2fs/data.c +11 -6
@@ -197,12 +197,14 @@ struct block_device *f2fs_target_device(struct f2fs_sb_info *sbi,struct block_device *bdev = sbi->sb->s_bdev;int i; -for (i =0 ; i < sbi->s_ndevs; i++) { -if (FDEV (i).start_blk <= blk_addr && -FDEV (i).end_blk >= blk_addr) { - blk_addr -=FDEV (i).start_blk; - bdev =FDEV (i).bdev; -break ; +if (f2fs_is_multi_device (sbi)) { +for (i =0 ; i < sbi->s_ndevs; i++) { +if (FDEV (i).start_blk <= blk_addr && +FDEV (i).end_blk >= blk_addr) { + blk_addr -=FDEV (i).start_blk; + bdev =FDEV (i).bdev; +break ; + } } }if (bio) {
@@ -216,6 +218,9 @@ int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr) {int i; +if (!f2fs_is_multi_device (sbi)) +return 0 ; +for (i =0 ; i < sbi->s_ndevs; i++)if (FDEV (i).start_blk <= blkaddr &&FDEV (i).end_blk >= blkaddr)return i;
fs/f2fs/f2fs.h +12 -1
@@ -1336,6 +1336,17 @@ static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type) }#endif +/* +* Test if the mounted volume is a multi-device volume. +* - For a single regular disk volume, sbi->s_ndevs is 0. +* - For a single zoned disk volume, sbi->s_ndevs is 1. +* - For a multi-device volume, sbi->s_ndevs is always 2 or more. +*/ +static inline bool f2fs_is_multi_device (struct f2fs_sb_info *sbi) +{ +return sbi->s_ndevs >1 ; +} +/* For write statistics. Suppose sector size is 512 bytes, * and the return value is in kbytes. s is of struct f2fs_sb_info. */
@@ -3455,7 +3466,7 @@ static inline bool f2fs_force_buffered_io(struct inode *inode, int rw) {return (f2fs_post_read_required (inode) || (rw ==WRITE &&test_opt (F2FS_I_SB (inode),LFS )) || -F2FS_I_SB (inode)->s_ndevs); +f2fs_is_multi_device (F2FS_I_SB (inode))); }#ifdef CONFIG_F2FS_FAULT_INJECTION
fs/f2fs/file.c +1 -1
@@ -2539,7 +2539,7 @@ static int f2fs_ioc_flush_device(struct file *filp, unsigned long arg) sizeof(range)))return -EFAULT ; -if (sbi->s_ndevs <=1 || sbi->s_ndevs -1 <= range.dev_num || +if (!f2fs_is_multi_device (sbi) || sbi->s_ndevs -1 <= range.dev_num || sbi->segs_per_sec !=1 ) { f2fs_msg(sbi->sb, KERN_WARNING, "Can't flush %u in %d for segs_per_sec %u != 1\n",
fs/f2fs/gc.c +1 -1
@@ -1256,7 +1256,7 @@ void f2fs_build_gc_manager(struct f2fs_sb_info *sbi) sbi->gc_pin_file_threshold =DEF_GC_FAILED_PINNED_FILES ;/* give warm/cold data area from slower device */ -if (sbi->s_ndevs && sbi->segs_per_sec ==1 ) +if (f2fs_is_multi_device (sbi) && sbi->segs_per_sec ==1 )SIT_I (sbi)->last_victim[ALLOC_NEXT ] =GET_SEGNO (sbi,FDEV (0 ).end_blk) +1 ; }
fs/f2fs/segment.c +7 -6
@@ -574,7 +574,7 @@ static int submit_flush_wait(struct f2fs_sb_info *sbi, nid_t ino)int ret =0 ;int i; -if (!sbi->s_ndevs) +if (!f2fs_is_multi_device (sbi))return __submit_flush_wait (sbi, sbi->sb->s_bdev);for (i =0 ; i < sbi->s_ndevs; i++) {
@@ -640,7 +640,8 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi, nid_t ino)return ret; } -if (atomic_inc_return (&fcc->issing_flush) ==1 || sbi->s_ndevs >1 ) { +if (atomic_inc_return (&fcc->issing_flush) ==1 || +f2fs_is_multi_device (sbi)) { ret =submit_flush_wait (sbi, ino);atomic_dec (&fcc->issing_flush);
@@ -746,7 +747,7 @@ int f2fs_flush_device_cache(struct f2fs_sb_info *sbi) {int ret =0 , i; -if (!sbi->s_ndevs) +if (!f2fs_is_multi_device (sbi))return 0 ;for (i =1 ; i < sbi->s_ndevs; i++) {
@@ -1289,7 +1290,7 @@ static int __queue_discard_cmd(struct f2fs_sb_info *sbi,trace_f2fs_queue_discard (bdev, blkstart, blklen); -if (sbi->s_ndevs) { +if (f2fs_is_multi_device (sbi)) {int devi =f2fs_target_device_index (sbi, blkstart); blkstart -=FDEV (devi).start_blk;
@@ -1638,7 +1639,7 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi,block_t lblkstart = blkstart;int devi =0 ; -if (sbi->s_ndevs) { +if (f2fs_is_multi_device (sbi)) { devi =f2fs_target_device_index (sbi, blkstart); blkstart -=FDEV (devi).start_blk; }
@@ -2971,7 +2972,7 @@ static void update_device_state(struct f2fs_io_info *fio)struct f2fs_sb_info *sbi = fio->sbi;unsigned int devidx; -if (!sbi->s_ndevs) +if (!f2fs_is_multi_device (sbi))return ; devidx =f2fs_target_device_index (sbi, fio->new_blkaddr);
Signature · 1 line
2.21.0
Greg Kroah-Hartman
maintainerPATCH 20/276 Btrfs: fix race between ranged fsync and writeback of adjacent ranges
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 0c713cbab6200b0ab6473b50435e450a6e1de85d upstream.
When we do a full fsync (the bit BTRFS_INODE_NEEDS_FULL_SYNC is set in the inode) that happens to be ranged, which happens during a msync() or writes for files opened with O_SYNC for example, we can end up with a corrupt log, due to different file extent items representing ranges that overlap with each other, or hit some assertion failures.
When doing a ranged fsync we only flush delalloc and wait for ordered exents within that range. If while we are logging items from our inode ordered extents for adjacent ranges complete, we end up in a race that can make us insert the file extent items that overlap with others we logged previously and the assertion failures.
For example, if tree-log.c:copy_items() receives a leaf that has the following file extents items, all with a length of 4K and therefore there is an implicit hole in the range 68K to 72K - 1:
(257 EXTENT_ITEM 64K), (257 EXTENT_ITEM 72K), (257 EXTENT_ITEM 76K), ...
It copies them to the log tree. However due to the need to detect implicit holes, it may release the path, in order to look at the previous leaf to detect an implicit hole, and then later it will search again in the tree for the first file extent item key, with the goal of locking again the leaf (which might have changed due to concurrent changes to other inodes).
However when it locks again the leaf containing the first key, the key corresponding to the extent at offset 72K may not be there anymore since there is an ordered extent for that range that is finishing (that is, somewhere in the middle of btrfs_finish_ordered_io()), and it just removed the file extent item but has not yet replaced it with a new file extent item, so the part of copy_items() that does hole detection will decide that there is a hole in the range starting from 68K to 76K - 1, and therefore insert a file extent item to represent that hole, having a key offset of 68K. After that we now have a log tree with 2 different extent items that have overlapping ranges:
1) The file extent item copied before copy_items() released the path, which has a key offset of 72K and a length of 4K, representing the file range 72K to 76K - 1.
2) And a file extent item representing a hole that has a key offset of 68K and a length of 8K, representing the range 68K to 76K - 1. This item was inserted after releasing the path, and overlaps with the extent item inserted before.
The overlapping extent items can cause all sorts of unpredictable and incorrect behaviour, either when replayed or if a fast (non full) fsync happens later, which can trigger a BUG_ON() when calling btrfs_set_item_key_safe() through __btrfs_drop_extents(), producing a trace like the following:
[61666.783269] ------------[ cut here ]------------ [61666.783943] kernel BUG at fs/btrfs/ctree.c:3182! [61666.784644] invalid opcode: 0000 [#1] PREEMPT SMP (...) [61666.786253] task: ffff880117b88c40 task.stack: ffffc90008168000 [61666.786253] RIP: 0010:btrfs_set_item_key_safe+0x7c/0xd2 [btrfs] [61666.786253] RSP: 0018:ffffc9000816b958 EFLAGS: 00010246 [61666.786253] RAX: 0000000000000000 RBX: 000000000000000f RCX: 0000000000030000 [61666.786253] RDX: 0000000000000000 RSI: ffffc9000816ba4f RDI: ffffc9000816b937 [61666.786253] RBP: ffffc9000816b998 R08: ffff88011dae2428 R09: 0000000000001000 [61666.786253] R10: 0000160000000000 R11: 6db6db6db6db6db7 R12: ffff88011dae2418 [61666.786253] R13: ffffc9000816ba4f R14: ffff8801e10c4118 R15: ffff8801e715c000 [61666.786253] FS: 00007f6060a18700(0000) GS:ffff88023f5c0000(0000) knlGS:0000000000000000 [61666.786253] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [61666.786253] CR2: 00007f6060a28000 CR3: 0000000213e69000 CR4: 00000000000006e0 [61666.786253] Call Trace: [61666.786253] __btrfs_drop_extents+0x5e3/0xaad [btrfs] [61666.786253] ? time_hardirqs_on+0x9/0x14 [61666.786253] btrfs_log_changed_extents+0x294/0x4e0 [btrfs] [61666.786253] ? release_extent_buffer+0x38/0xb4 [btrfs] [61666.786253] btrfs_log_inode+0xb6e/0xcdc [btrfs] [61666.786253] ? lock_acquire+0x131/0x1c5 [61666.786253] ? btrfs_log_inode_parent+0xee/0x659 [btrfs] [61666.786253] ? arch_local_irq_save+0x9/0xc [61666.786253] ? btrfs_log_inode_parent+0x1f5/0x659 [btrfs] [61666.786253] btrfs_log_inode_parent+0x223/0x659 [btrfs] [61666.786253] ? arch_local_irq_save+0x9/0xc [61666.786253] ? lockref_get_not_zero+0x2c/0x34 [61666.786253] ? rcu_read_unlock+0x3e/0x5d [61666.786253] btrfs_log_dentry_safe+0x60/0x7b [btrfs] [61666.786253] btrfs_sync_file+0x317/0x42c [btrfs] [61666.786253] vfs_fsync_range+0x8c/0x9e [61666.786253] SyS_msync+0x13c/0x1c9 [61666.786253] entry_SYSCALL_64_fastpath+0x18/0xad
A sample of a corrupt log tree leaf with overlapping extents I got from running btrfs/072:
item 14 key (295 108 200704) itemoff 2599 itemsize 53
extent data disk bytenr 0 nr 0
extent data offset 0 nr 458752 ram 458752
item 15 key (295 108 659456) itemoff 2546 itemsize 53
extent data disk bytenr 4343541760 nr 770048
extent data offset 606208 nr 163840 ram 770048
item 16 key (295 108 663552) itemoff 2493 itemsize 53
extent data disk bytenr 4343541760 nr 770048
extent data offset 610304 nr 155648 ram 770048
item 17 key (295 108 819200) itemoff 2440 itemsize 53
extent data disk bytenr 4334788608 nr 4096
extent data offset 0 nr 4096 ram 4096The file extent item at offset 659456 (item 15) ends at offset 823296 (659456 + 163840) while the next file extent item (item 16) starts at offset 663552.
Another different problem that the race can trigger is a failure in the assertions at tree-log.c:copy_items(), which expect that the first file extent item key we found before releasing the path exists after we have released path and that the last key we found before releasing the path also exists after releasing the path:
$ cat -n fs/btrfs/tree-log.c
4080 if (need_find_last_extent) {
4081 /* btrfs_prev_leaf could return 1 without releasing the path */
4082 btrfs_release_path(src_path);
4083 ret = btrfs_search_slot(NULL, inode->root, &first_key,
4084 src_path, 0, 0);
4085 if (ret < 0)
4086 return ret;
4087 ASSERT(ret == 0);
(...)
4103 if (i >= btrfs_header_nritems(src_path->nodes[0])) {
4104 ret = btrfs_next_leaf(inode->root, src_path);
4105 if (ret < 0)
4106 return ret;
4107 ASSERT(ret == 0);
4108 src = src_path->nodes[0];
4109 i = 0;
4110 need_find_last_extent = true;
4111 }
(...)The second assertion implicitly expects that the last key before the path release still exists, because the surrounding while loop only stops after we have found that key. When this assertion fails it produces a stack like this:
[139590.037075] assertion failed: ret == 0, file: fs/btrfs/tree-log.c, line: 4107 [139590.037406] ------------[ cut here ]------------ [139590.037707] kernel BUG at fs/btrfs/ctree.h:3546! [139590.038034] invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC PTI [139590.038340] CPU: 1 PID: 31841 Comm: fsstress Tainted: G W 5.0.0-btrfs-next-46 #1 (...) [139590.039354] RIP: 0010:assfail.constprop.24+0x18/0x1a [btrfs] (...) [139590.040397] RSP: 0018:ffffa27f48f2b9b0 EFLAGS: 00010282 [139590.040730] RAX: 0000000000000041 RBX: ffff897c635d92c8 RCX: 0000000000000000 [139590.041105] RDX: 0000000000000000 RSI: ffff897d36a96868 RDI: ffff897d36a96868 [139590.041470] RBP: ffff897d1b9a0708 R08: 0000000000000000 R09: 0000000000000000 [139590.041815] R10: 0000000000000008 R11: 0000000000000000 R12: 0000000000000013 [139590.042159] R13: 0000000000000227 R14: ffff897cffcbba88 R15: 0000000000000001 [139590.042501] FS: 00007f2efc8dee80(0000) GS:ffff897d36a80000(0000) knlGS:0000000000000000 [139590.042847] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [139590.043199] CR2: 00007f8c064935e0 CR3: 0000000232252002 CR4: 00000000003606e0 [139590.043547] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [139590.043899] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [139590.044250] Call Trace: [139590.044631] copy_items+0xa3f/0x1000 [btrfs] [139590.045009] ? generic_bin_search.constprop.32+0x61/0x200 [btrfs] [139590.045396] btrfs_log_inode+0x7b3/0xd70 [btrfs] [139590.045773] btrfs_log_inode_parent+0x2b3/0xce0 [btrfs] [139590.046143] ? do_raw_spin_unlock+0x49/0xc0 [139590.046510] btrfs_log_dentry_safe+0x4a/0x70 [btrfs] [139590.046872] btrfs_sync_file+0x3b6/0x440 [btrfs] [139590.047243] btrfs_file_write_iter+0x45b/0x5c0 [btrfs] [139590.047592] __vfs_write+0x129/0x1c0 [139590.047932] vfs_write+0xc2/0x1b0 [139590.048270] ksys_write+0x55/0xc0 [139590.048608] do_syscall_64+0x60/0x1b0 [139590.048946] entry_SYSCALL_64_after_hwframe+0x49/0xbe [139590.049287] RIP: 0033:0x7f2efc4be190 (...) [139590.050342] RSP: 002b:00007ffe743243a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [139590.050701] RAX: ffffffffffffffda RBX: 0000000000008d58 RCX: 00007f2efc4be190 [139590.051067] RDX: 0000000000008d58 RSI: 00005567eca0f370 RDI: 0000000000000003 [139590.051459] RBP: 0000000000000024 R08: 0000000000000003 R09: 0000000000008d60 [139590.051863] R10: 0000000000000078 R11: 0000000000000246 R12: 0000000000000003 [139590.052252] R13: 00000000003d3507 R14: 00005567eca0f370 R15: 0000000000000000 (...) [139590.055128] ---[ end trace 193f35d0215cdeeb ]---
So fix this race between a full ranged fsync and writeback of adjacent ranges by flushing all delalloc and waiting for all ordered extents to complete before logging the inode. This is the simplest way to solve the problem because currently the full fsync path does not deal with ranges at all (it assumes a full range from 0 to LLONG_MAX) and it always needs to look at adjacent ranges for hole detection. For use cases of ranged fsyncs this can make a few fsyncs slower but on the other hand it can make some following fsyncs to other ranges do less work or no need to do anything at all. A full fsync is rare anyway and happens only once after loading/creating an inode and once after less common operations such as a shrinking truncate.
This is an issue that exists for a long time, and was often triggered by generic/127, because it does mmap'ed writes and msync (which triggers a ranged fsync). Adding support for the tree checker to detect overlapping extents (next patch in the series) and trigger a WARN() when such cases are found, and then calling btrfs_check_leaf_full() at the end of btrfs_insert_file_extent() made the issue much easier to detect. Running btrfs/072 with that change to the tree checker and making fsstress open files always with O_SYNC made it much easier to trigger the issue (as triggering it with generic/127 is very rare).
--- fs/btrfs/file.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/btrfs/file.c +12 -0
@@ -2059,6 +2059,18 @@ int btrfs_sync_file(struct file *file, lu64 len;/* +* If the inode needs a full sync, make sure we use a full range to +* avoid log tree corruption, due to hole detection racing with ordered +* extent completion for adjacent ranges, and assertion failures during +* hole detection. +*/ +if (test_bit (BTRFS_INODE_NEEDS_FULL_SYNC , + &BTRFS_I (inode)->runtime_flags)) { + start =0 ; + end =LLONG_MAX ; + } + +/* * The range length can be represented by u64, we have to do the typecasts * to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync() */
Greg Kroah-Hartman
maintainerPATCH 2/276 ext4: do not delete unlinked inode from orphan list on failed truncate
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit ee0ed02ca93ef1ecf8963ad96638795d55af2c14 upstream.
It is possible that unlinked inode enters ext4_setattr() (e.g. if somebody calls ftruncate(2) on unlinked but still open file). In such case we should not delete the inode from the orphan list if truncate fails. Note that this is mostly a theoretical concern as filesystem is corrupted if we reach this path anyway but let's be consistent in our orphan handling.
--- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inode.c +1 -1
@@ -5596,7 +5596,7 @@ int ext4_setattr(struct dentry *dentry,up_write (&EXT4_I (inode)->i_data_sem);ext4_journal_stop (handle);if (error) { -if (orphan) +if (orphan && inode->i_nlink)ext4_orphan_del (NULL , inode); goto err_out; }
Greg Kroah-Hartman
maintainerPATCH 11/276 mmc: sdhci-iproc: Set NO_HISPD bit to fix HS50 data hold time problem
In reply to Greg Kroah-HartmanFrom: Trac Hoang <[email protected]>
commit ec0970e0a1b2c807c908d459641a9f9a1be3e130 upstream.
The iproc host eMMC/SD controller hold time does not meet the specification in the HS50 mode. This problem can be mitigated by disabling the HISPD bit; thus forcing the controller output data to be driven on the falling clock edges rather than the rising clock edges.
Stable tag (v4.12+) chosen to assist stable kernel maintainers so that the change does not produce merge conflicts backporting to older kernel versions. In reality, the timing bug existed since the driver was first introduced but there is no need for this driver to be supported in kernel versions that old.
--- drivers/mmc/host/sdhci-iproc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-iproc.c +2 -1
@@ -209,7 +209,8 @@ static const struct sdhci_iproc_data iprstatic const struct sdhci_pltfm_data sdhci_iproc_pltfm_data = { .quirks =SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | -SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 , +SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 | +SDHCI_QUIRK_NO_HISPD_BIT , .quirks2 =SDHCI_QUIRK2_ACMD23_BROKEN , .ops = &sdhci_iproc_ops, };
Greg Kroah-Hartman
maintainerPATCH 276/276 NFS: Fix a double unlock from nfs_match,get_client
In reply to Greg Kroah-Hartman[ Upstream commit c260121a97a3e4df6536edbc2f26e166eff370ce ]
Now that nfs_match_client drops the nfs_client_lock, we should be careful
to always return it in the same condition: locked.
--- fs/nfs/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/client.c +1 -1
@@ -305,9 +305,9 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *datspin_unlock (&nn->nfs_client_lock); error =nfs_wait_client_init_complete (clp);nfs_put_client (clp); +spin_lock (&nn->nfs_client_lock);if (error <0 )return ERR_PTR (error); -spin_lock (&nn->nfs_client_lock); goto again; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 273/276 drm/sun4i: dsi: Change the start delay calculation
In reply to Greg Kroah-Hartman[ Upstream commit da676c6aa6413d59ab0a80c97bbc273025e640b2 ]
The current calculation for the video start delay in the current DSI driver is that it is the total vertical size, minus the front porch and sync length, plus 1. This equals to the active vertical size plus the back porch plus 1.
That 1 is coming in the Allwinner BSP from an variable that is set to 1. However, if we look at the Allwinner BSP more closely, and especially in the "legacy" code for the display (in drivers/video/sunxi/legacy/), we can see that this variable is actually computed from the porches and the sync minus 10, clamped between 8 and 100.
This fixes the start delay symptom we've seen on some panels (vblank timeouts with vertical white stripes at the bottom of the panel).
--- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +3 -1
@@ -357,7 +357,9 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,static u16 sun6i_dsi_get_video_start_delay (struct sun6i_dsi *dsi,struct drm_display_mode *mode) { -return mode->vtotal - (mode->vsync_end - mode->vdisplay) +1 ; +u16 start =clamp (mode->vtotal - mode->vdisplay -10 ,8 ,100 ); + +return mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; } static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 221/276 media: wl128x: prevent two potential buffer overflows
In reply to Greg Kroah-Hartman[ Upstream commit 9c2ccc324b3a6cbc865ab8b3e1a09e93d3c8ade9 ]
Smatch marks skb->data as untrusted so it warns that "evt_hdr->dlen" can copy up to 255 bytes and we only have room for two bytes. Even if this comes from the firmware and we trust it, the new policy generally is just to fix it as kernel hardenning.
I can't test this code so I tried to be very conservative. I considered not allowing "evt_hdr->dlen == 1" because it doesn't initialize the whole variable but in the end I decided to allow it and manually initialized "asic_id" and "asic_ver" to zero.
--- drivers/media/radio/wl128x/fmdrv_common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/radio/wl128x/fmdrv_common.c +5 -2
@@ -489,7 +489,8 @@ int fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload,return -EIO ; }/* Send response data to caller */ -if (response !=NULL && response_len !=NULL && evt_hdr->dlen) { +if (response !=NULL && response_len !=NULL && evt_hdr->dlen && + evt_hdr->dlen <= payload_len) {/* Skip header info and copy only response data */ skb_pull (skb,sizeof (struct fm_event_msg_hdr ));memcpy (response, skb->data, evt_hdr->dlen);
@@ -583,6 +584,8 @@ static void fm_irq_handle_flag_getcmd_resp(struct fmdev *fmdev)return ; fm_evt_hdr = (void *)skb->data; +if (fm_evt_hdr->dlen >sizeof (fmdev->irq_info.flag)) +return ;/* Skip header info and copy only response data */ skb_pull (skb,sizeof (struct fm_event_msg_hdr ));
@@ -1308,7 +1311,7 @@ static int load_default_rx_configuration(struct fmdev *fmdev)static int fm_power_up (struct fmdev *fmdev,u8 mode) {u16 payload; -__be16 asic_id, asic_ver; +__be16 asic_id =0 , asic_ver =0 ;int resp_len, ret;u8 fw_name[50 ];
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 229/276 tty: ipwireless: fix missing checks for ioremap
In reply to Greg Kroah-Hartman[ Upstream commit 1bbb1c318cd8a3a39e8c3e2e83d5e90542d6c3e3 ]
ipw->attr_memory and ipw->common_memory are assigned with the return value of ioremap. ioremap may fail, but no checks are enforced. The fix inserts the checks to avoid potential NULL pointer dereferences.
--- drivers/tty/ipwireless/main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/tty/ipwireless/main.c +8 -0
@@ -114,6 +114,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) ipw->common_memory =ioremap (p_dev->resource[2 ]->start,resource_size (p_dev->resource[2 ])); +if (!ipw->common_memory) { + ret = -ENOMEM ; + goto exit1; + }if (!request_mem_region (p_dev->resource[2 ]->start,resource_size (p_dev->resource[2 ]),IPWIRELESS_PCCARD_NAME )) {
@@ -134,6 +138,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) ipw->attr_memory =ioremap (p_dev->resource[3 ]->start,resource_size (p_dev->resource[3 ])); +if (!ipw->attr_memory) { + ret = -ENOMEM ; + goto exit3; + }if (!request_mem_region (p_dev->resource[3 ]->start,resource_size (p_dev->resource[3 ]),IPWIRELESS_PCCARD_NAME )) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 227/276 scsi: qedf: Add missing return in qedf_post_io_req() in the fcport offload check
In reply to Greg Kroah-Hartman[ Upstream commit c5e06ba2f76809ad1492fdad312e81335df46bc5 ]
Fixes the following crash as the return was missing from the check if an fcport is offloaded. If we hit this code we continue to try to post an invalid task which can lead to the crash:
[30259.616411] [0000:61:00.3]:[qedf_post_io_req:989]:3: Session not offloaded yet. [30259.616413] [0000:61:00.3]:[qedf_upload_connection:1340]:3: Uploading connection port_id=490020. [30259.623769] BUG: unable to handle kernel NULL pointer dereference at 0000000000000198 [30259.631645] IP: [<ffffffffc035b1ed>] qedf_init_task.isra.16+0x3d/0x450 [qedf] [30259.638816] PGD 0 [30259.640841] Oops: 0000 [#1] SMP [30259.644098] Modules linked in: fuse xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 tun bridge stp llc ebtable_filter ebtables devlink ip6table_filter ip6_tables iptable_filter vfat fat ib_isert iscsi_target_mod ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib ib_ucm ib_umad dm_service_time skx_edac intel_powerclamp coretemp intel_rapl iosf_mbi kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel rpcrdma sunrpc rdma_ucm ib_uverbs lrw gf128mul ib_iser rdma_cm iw_cm ib_cm libiscsi scsi_transport_iscsi qedr(OE) glue_helper ablk_helper cryptd ib_core dm_round_robin joydev pcspkr ipmi_ssif ses enclosure ipmi_si ipmi_devintf ipmi_msghandler mei_me [30259.715529] mei sg hpilo hpwdt shpchp wmi lpc_ich acpi_power_meter dm_multipath ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic uas usb_storage mgag200 qedf(OE) i2c_algo_bit libfcoe drm_kms_helper libfc syscopyarea sysfillrect scsi_transport_fc qede(OE) sysimgblt fb_sys_fops ptp ttm pps_core drm qed(OE) smartpqi crct10dif_pclmul crct10dif_common crc32c_intel i2c_core scsi_transport_sas scsi_tgt dm_mirror dm_region_hash dm_log dm_mod [30259.754237] CPU: 9 PID: 977 Comm: kdmwork-253:7 Kdump: loaded Tainted: G W OE ------------ 3.10.0-862.el7.x86_64 #1 [30259.765664] Hardware name: HPE Synergy 480 Gen10/Synergy 480 Gen10 Compute Module, BIOS I42 04/04/2018 [30259.775000] task: ffff8c801efd0000 ti: ffff8c801efd8000 task.ti: ffff8c801efd8000 [30259.782505] RIP: 0010:[<ffffffffc035b1ed>] [<ffffffffc035b1ed>] qedf_init_task.isra.16+0x3d/0x450 [qedf] [30259.792116] RSP: 0018:ffff8c801efdbbb0 EFLAGS: 00010046 [30259.797444] RAX: 0000000000000000 RBX: ffffa7f1450948d8 RCX: ffff8c7fe5bc40c8 [30259.804600] RDX: ffff8c800715b300 RSI: ffffa7f1450948d8 RDI: ffff8c80169c2480 [30259.811755] RBP: ffff8c801efdbc30 R08: 00000000000000ae R09: ffff8c800a314540 [30259.818911] R10: ffff8c7fe5bc40c8 R11: ffff8c801efdb8ae R12: 0000000000000000 [30259.826068] R13: ffff8c800715b300 R14: ffff8c80169c2480 R15: ffff8c8005da28e0 [30259.833223] FS: 0000000000000000(0000) GS:ffff8c803f840000(0000) knlGS:0000000000000000 [30259.841338] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [30259.847100] CR2: 0000000000000198 CR3: 000000081242e000 CR4: 00000000007607e0 [30259.854256] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [30259.861412] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [30259.868568] PKRU: 00000000 [30259.871278] Call Trace: [30259.873737] [<ffffffffc035c948>] qedf_post_io_req+0x148/0x680 [qedf] [30259.880201] [<ffffffffc035d070>] qedf_queuecommand+0x1f0/0x240 [qedf] [30259.886749] [<ffffffffa329b050>] scsi_dispatch_cmd+0xb0/0x240 [30259.892600] [<ffffffffa32a45bc>] scsi_request_fn+0x4cc/0x680 [30259.898364] [<ffffffffa3118ad9>] __blk_run_queue+0x39/0x50 [30259.903954] [<ffffffffa3114393>] __elv_add_request+0xd3/0x260 [30259.909805] [<ffffffffa311baf0>] blk_insert_cloned_request+0xf0/0x1b0 [30259.916358] [<ffffffffc010b622>] map_request+0x142/0x220 [dm_mod] [30259.922560] [<ffffffffc010b716>] map_tio_request+0x16/0x40 [dm_mod] [30259.928932] [<ffffffffa2ebb1f5>] kthread_worker_fn+0x85/0x180 [30259.934782] [<ffffffffa2ebb170>] ? kthread_stop+0xf0/0xf0 [30259.940284] [<ffffffffa2ebae31>] kthread+0xd1/0xe0 [30259.945176] [<ffffffffa2ebad60>] ? insert_kthread_work+0x40/0x40 [30259.951290] [<ffffffffa351f61d>] ret_from_fork_nospec_begin+0x7/0x21 [30259.957750] [<ffffffffa2ebad60>] ? insert_kthread_work+0x40/0x40 [30259.963860] Code: fe 41 55 49 89 d5 41 54 53 48 89 f3 48 83 ec 58 4c 8b 67 28 4c 8b 4e 18 65 48 8b 04 25 28 00 00 00 48 89 45 d0 31 c0 4c 8b 7e 58 <49> 8b 84 24 98 01 00 00 48 8b 00 f6 80 31 01 00 00 10 0f 85 0b [30259.983372] RIP [<ffffffffc035b1ed>] qedf_init_task.isra.16+0x3d/0x450 [qedf] [30259.990630] RSP <ffff8c801efdbbb0> [30259.994127] CR2: 0000000000000198
--- drivers/scsi/qedf/qedf_io.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/qedf/qedf_io.c +1 -0
@@ -902,6 +902,7 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req)if (!test_bit (QEDF_RPORT_SESSION_READY , &fcport->flags)) {QEDF_ERR (&(qedf->dbg_ctx),"Session not offloaded yet.\n" );kref_put (&io_req->refcount, qedf_release_cmd); +return -EINVAL ; }/* Obtain free SQE */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 267/276 spi: imx: stop buffer overflow in RX FIFO flush
In reply to Greg Kroah-Hartman[ Upstream commit c842749ea1d32513f9e603c074d60d7aa07cb2ef ]
Commit 71abd29057cb ("spi: imx: Add support for SPI Slave mode") added an RX FIFO flush before start of a transfer. In slave mode, the master may have sent more data than expected and this data will still be in the RX FIFO at the start of the next transfer, and so needs to be flushed.
However, the code to do the flush was accidentally saving this data into the previous transfer's RX buffer, clobbering the contents of whatever followed that buffer.
Change it to empty the FIFO and throw away the data. Every one of the RX functions for the different eCSPI versions and modes reads the RX FIFO data using the same readl() call, so just use that, rather than using the spi_imx->rx function pointer and making sure all the different rx functions have a working "throw away" mode.
There is another issue, which affects master mode when switching from DMA to PIO. There can be extra data in the RX FIFO which triggers this flush code, causing memory corruption in the same manner. I don't know why this data is unexpectedly in the FIFO. It's likely there is a different bug or erratum responsible for that. But regardless of that, I think this is proper fix the for bug at hand here.
--- drivers/spi/spi-imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-imx.c +1 -1
@@ -1427,7 +1427,7 @@ static int spi_imx_transfer(struct spi_device *spi,/* flush rxfifo before transfer */ while (spi_imx->devtype_data->rx_available (spi_imx)) - spi_imx->rx (spi_imx); +readl (spi_imx->base +MXC_CSPIRXDATA );if (spi_imx->slave_mode)return spi_imx_pio_transfer_slave (spi, transfer);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 266/276 spi: rspi: Fix sequencer reset during initialization
In reply to Greg Kroah-Hartman[ Upstream commit 26843bb128590edd7eba1ad7ce22e4b9f1066ce3 ]
While the sequencer is reset after each SPI message since commit 880c6d114fd79a69 ("spi: rspi: Add support for Quad and Dual SPI Transfers on QSPI"), it was never reset for the first message, thus relying on reset state or bootloader settings.
Fix this by initializing it explicitly during configuration.
--- drivers/spi/spi-rspi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/spi/spi-rspi.c +6 -3
@@ -279,7 +279,8 @@ static int rspi_set_config_register(struct rspi_data *rspi, int access_size)/* Sets parity, interrupt mask */ rspi_write8 (rspi,0x00 ,RSPI_SPCR2 ); -/* Sets SPCMD */ +/* Resets sequencer */ +rspi_write8 (rspi,0 ,RSPI_SPSCR ); rspi->spcmd |=SPCMD_SPB_8_TO_16 (access_size);rspi_write16 (rspi, rspi->spcmd,RSPI_SPCMD0 );
@@ -323,7 +324,8 @@ static int rspi_rz_set_config_register(struct rspi_data *rspi, int access_size)rspi_write8 (rspi,0x00 ,RSPI_SSLND );rspi_write8 (rspi,0x00 ,RSPI_SPND ); -/* Sets SPCMD */ +/* Resets sequencer */ +rspi_write8 (rspi,0 ,RSPI_SPSCR ); rspi->spcmd |=SPCMD_SPB_8_TO_16 (access_size);rspi_write16 (rspi, rspi->spcmd,RSPI_SPCMD0 );
@@ -374,7 +376,8 @@ static int qspi_set_config_register(struct rspi_data *rspi, int access_size)/* Sets buffer to allow normal operation */ rspi_write8 (rspi,0x00 ,QSPI_SPBFCR ); -/* Sets SPCMD */ +/* Resets sequencer */ +rspi_write8 (rspi,0 ,RSPI_SPSCR );rspi_write16 (rspi, rspi->spcmd,RSPI_SPCMD0 );/* Sets RSPI mode */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 261/276 scsi: lpfc: Fix fc4type information for FDMI
In reply to Greg Kroah-Hartman[ Upstream commit 32a80c093b524a0682f1c6166c910387b116ffce ]
The driver is reporting support for NVME even when not configured for NVME operation.
Fix (and make more readable) when NVME protocol support is indicated.
--- drivers/scsi/lpfc/lpfc_ct.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +10 -7
@@ -2120,10 +2120,11 @@ lpfc_fdmi_port_attr_fc4type(struct lpfc_vport *vport, ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue;memset (ae,0 ,32 ); - ae->un.AttrTypes[3 ] =0x02 ;/* Type 1 - ELS */ - ae->un.AttrTypes[2 ] =0x01 ;/* Type 8 - FCP */ - ae->un.AttrTypes[6 ] =0x01 ;/* Type 40 - NVME */ - ae->un.AttrTypes[7 ] =0x01 ;/* Type 32 - CT */ + ae->un.AttrTypes[3 ] =0x02 ;/* Type 0x1 - ELS */ + ae->un.AttrTypes[2 ] =0x01 ;/* Type 0x8 - FCP */ +if (vport->nvmei_support || vport->phba->nvmet_support) + ae->un.AttrTypes[6 ] =0x01 ;/* Type 0x28 - NVME */ + ae->un.AttrTypes[7 ] =0x01 ;/* Type 0x20 - CT */ size =FOURBYTES +32 ; ad->AttrLen =cpu_to_be16 (size); ad->AttrType =cpu_to_be16 (RPRT_SUPPORTED_FC4_TYPES );
@@ -2428,9 +2429,11 @@ lpfc_fdmi_port_attr_active_fc4type(struct lpfc_vport *vport, ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue;memset (ae,0 ,32 ); - ae->un.AttrTypes[3 ] =0x02 ;/* Type 1 - ELS */ - ae->un.AttrTypes[2 ] =0x01 ;/* Type 8 - FCP */ - ae->un.AttrTypes[7 ] =0x01 ;/* Type 32 - CT */ + ae->un.AttrTypes[3 ] =0x02 ;/* Type 0x1 - ELS */ + ae->un.AttrTypes[2 ] =0x01 ;/* Type 0x8 - FCP */ +if (vport->phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) + ae->un.AttrTypes[6 ] =0x1 ;/* Type 0x28 - NVME */ + ae->un.AttrTypes[7 ] =0x01 ;/* Type 0x20 - CT */ size =FOURBYTES +32 ; ad->AttrLen =cpu_to_be16 (size); ad->AttrType =cpu_to_be16 (RPRT_ACTIVE_FC4_TYPES );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 252/276 media: staging: davinci_vpfe: disallow building with COMPILE_TEST
In reply to Greg Kroah-Hartman[ Upstream commit 49dc762cffd8305a861ca649e82dc5533b3e3344 ]
The driver should really call dm365_isif_setup_pinmux() through a callback, but uses a hack to include a davinci specific machine header file when compile testing instead. This works almost everywhere, but not on the ARM omap1 platform, which has another header named mach/mux.h. This causes a build failure:
drivers/staging/media/davinci_vpfe/dm365_isif.c:2028:2: error: implicit declaration of function 'davinci_cfg_reg' [-Werror,-Wimplicit-function-declaration]
davinci_cfg_reg(DM365_VIN_CAM_WEN);
^
drivers/staging/media/davinci_vpfe/dm365_isif.c:2028:2: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
drivers/staging/media/davinci_vpfe/dm365_isif.c:2028:18: error: use of undeclared identifier 'DM365_VIN_CAM_WEN'
davinci_cfg_reg(DM365_VIN_CAM_WEN);
^
drivers/staging/media/davinci_vpfe/dm365_isif.c:2029:18: error: use of undeclared identifier 'DM365_VIN_CAM_VD'
davinci_cfg_reg(DM365_VIN_CAM_VD);
^
drivers/staging/media/davinci_vpfe/dm365_isif.c:2030:18: error: use of undeclared identifier 'DM365_VIN_CAM_HD'
davinci_cfg_reg(DM365_VIN_CAM_HD);
^
drivers/staging/media/davinci_vpfe/dm365_isif.c:2031:18: error: use of undeclared identifier 'DM365_VIN_YIN4_7_EN'
davinci_cfg_reg(DM365_VIN_YIN4_7_EN);
^
drivers/staging/media/davinci_vpfe/dm365_isif.c:2032:18: error: use of undeclared identifier 'DM365_VIN_YIN0_3_EN'
davinci_cfg_reg(DM365_VIN_YIN0_3_EN);
^7 errors generated.
Exclude omap1 from compile-testing, under the assumption that all others still work.
--- drivers/staging/media/davinci_vpfe/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/davinci_vpfe/Kconfig +1 -1
@@ -1,7 +1,7 @@ config VIDEO_DM365_VPFE tristate "DM365 VPFE Media Controller Capture Driver" depends on VIDEO_V4L2 - depends on (ARCH_DAVINCI_DM365 && !VIDEO_DM365_ISIF) || COMPILE_TEST + depends on (ARCH_DAVINCI_DM365 && !VIDEO_DM365_ISIF) || (COMPILE_TEST && !ARCH_OMAP1) depends on VIDEO_V4L2_SUBDEV_API depends on VIDEO_DAVINCI_VPBE_DISPLAY select VIDEOBUF2_DMA_CONTIG
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 253/276 drm/amd/display: Fix Divide by 0 in memory calculations
In reply to Greg Kroah-Hartman[ Upstream commit 59979bf8be1784ebfc44215031c6c88ca22ae65d ]
Check if we get any values equal to 0, and set to 1 if so.
--- .../drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c +15 -5
@@ -406,15 +406,25 @@ void dpp1_dscl_calc_lb_num_partitions(int *num_part_y, int *num_part_c) { + int lb_memory_size, lb_memory_size_c, lb_memory_size_a, num_partitions_a, + lb_bpc, memory_line_size_y, memory_line_size_c, memory_line_size_a; +int line_size = scl_data->viewport.width < scl_data->recout.width ? scl_data->viewport.width : scl_data->recout.width;int line_size_c = scl_data->viewport_c.width < scl_data->recout.width ? scl_data->viewport_c.width : scl_data->recout.width; -int lb_bpc =dpp1_dscl_get_lb_depth_bpc (scl_data->lb_params.depth); -int memory_line_size_y = (line_size * lb_bpc +71 ) /72 ;/* +71 to ceil */ -int memory_line_size_c = (line_size_c * lb_bpc +71 ) /72 ;/* +71 to ceil */ -int memory_line_size_a = (line_size +5 ) /6 ;/* +5 to ceil */ -int lb_memory_size, lb_memory_size_c, lb_memory_size_a, num_partitions_a; + +if (line_size ==0 ) + line_size =1 ; + +if (line_size_c ==0 ) + line_size_c =1 ; + + + lb_bpc =dpp1_dscl_get_lb_depth_bpc (scl_data->lb_params.depth); + memory_line_size_y = (line_size * lb_bpc +71 ) /72 ;/* +71 to ceil */ + memory_line_size_c = (line_size_c * lb_bpc +71 ) /72 ;/* +71 to ceil */ + memory_line_size_a = (line_size +5 ) /6 ;/* +5 to ceil */ if (lb_config ==LB_MEMORY_CONFIG_1 ) { lb_memory_size =816 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 224/276 thunderbolt: property: Fix a missing check of kzalloc
In reply to Greg Kroah-Hartman[ Upstream commit 6183d5a51866f3acdeeb66b75e87d44025b01a55 ]
No check is enforced for the return value of kzalloc, which may lead to NULL-pointer dereference.
The patch fixes this issue.
--- drivers/thunderbolt/property.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/thunderbolt/property.c +6 -1
@@ -581,7 +581,12 @@ int tb_property_add_text(struct tb_property_dir *parent, const char *key,return -ENOMEM ; property->length = size /4 ; - property->value.data =kzalloc (size,GFP_KERNEL ); + property->value.text =kzalloc (size,GFP_KERNEL ); +if (!property->value.text) { +kfree (property); +return -ENOMEM ; + } +strcpy (property->value.text, text);list_add_tail (&property->list, &parent->properties);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 247/276 tinydrm/mipi-dbi: Use dma-safe buffers for all SPI transfers
In reply to Greg Kroah-Hartman[ Upstream commit a89bfc5d9a0732d84b4de311e27133daa0586316 ]
Buffers passed to spi_sync() must be dma-safe even for tiny buffers since some SPI controllers use DMA for all transfers.
Example splat with CONFIG_DMA_API_DEBUG enabled:
[ 23.750467] DMA-API: dw_dmac_pci 0000:00:15.0: device driver maps memory from stack [probable addr=000000001e49185d] [ 23.750529] WARNING: CPU: 1 PID: 1296 at kernel/dma/debug.c:1161 check_for_stack+0xb7/0x190 [ 23.750533] Modules linked in: mmc_block(+) spi_pxa2xx_platform(+) pwm_lpss_pci pwm_lpss spi_pxa2xx_pci sdhci_pci cqhci intel_mrfld_pwrbtn extcon_intel_mrfld sdhci intel_mrfld_adc led_class mmc_core ili9341 mipi_dbi tinydrm backlight ti_ads7950 industrialio_triggered_buffer kfifo_buf intel_soc_pmic_mrfld hci_uart btbcm [ 23.750599] CPU: 1 PID: 1296 Comm: modprobe Not tainted 5.0.0-rc7+ #236 [ 23.750605] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48 [ 23.750620] RIP: 0010:check_for_stack+0xb7/0x190 [ 23.750630] Code: 8b 6d 50 4d 85 ed 75 04 4c 8b 6d 10 48 89 ef e8 2f 8b 44 00 48 89 c6 4a 8d 0c 23 4c 89 ea 48 c7 c7 88 d0 82 b4 e8 40 7c f9 ff <0f> 0b 8b 05 79 00 4b 01 85 c0 74 07 5b 5d 41 5c 41 5d c3 8b 05 54 [ 23.750637] RSP: 0000:ffff97bbc0292fa0 EFLAGS: 00010286 [ 23.750646] RAX: 0000000000000000 RBX: ffff97bbc0290000 RCX: 0000000000000006 [ 23.750652] RDX: 0000000000000007 RSI: 0000000000000002 RDI: ffff94b33e115450 [ 23.750658] RBP: ffff94b33c8578b0 R08: 0000000000000002 R09: 00000000000201c0 [ 23.750664] R10: 00000006ecb0ccc6 R11: 0000000000034f38 R12: 000000000000316c [ 23.750670] R13: ffff94b33c84b250 R14: ffff94b33dedd5a0 R15: 0000000000000001 [ 23.750679] FS: 0000000000000000(0000) GS:ffff94b33e100000(0063) knlGS:00000000f7faf690 [ 23.750686] CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 [ 23.750691] CR2: 00000000f7f54faf CR3: 000000000722c000 CR4: 00000000001006e0 [ 23.750696] Call Trace: [ 23.750713] debug_dma_map_sg+0x100/0x340 [ 23.750727] ? dma_direct_map_sg+0x3b/0xb0 [ 23.750739] spi_map_buf+0x25a/0x300 [ 23.750751] __spi_pump_messages+0x2a4/0x680 [ 23.750762] __spi_sync+0x1dd/0x1f0 [ 23.750773] spi_sync+0x26/0x40 [ 23.750790] mipi_dbi_typec3_command_read+0x14d/0x240 [mipi_dbi] [ 23.750802] ? spi_finalize_current_transfer+0x10/0x10 [ 23.750821] mipi_dbi_typec3_command+0x1bc/0x1d0 [mipi_dbi]
--- drivers/gpu/drm/tinydrm/ili9225.c | 6 ++-- drivers/gpu/drm/tinydrm/mipi-dbi.c | 58 +++++++++++++++++++++--------- include/drm/tinydrm/mipi-dbi.h | 5 +-- 3 files changed, 48 insertions(+), 21 deletions(-)
drivers/gpu/drm/tinydrm/ili9225.c +3 -3
@@ -278,7 +278,7 @@ static void ili9225_pipe_disable(struct drm_simple_display_pipe *pipe) mipi->enabled = false; } -static int ili9225_dbi_command (struct mipi_dbi *mipi,u8 cmd,u8 *par, +static int ili9225_dbi_command (struct mipi_dbi *mipi,u8 *cmd,u8 *par,size_t num) {struct spi_device *spi = mipi->spi;
@@ -288,11 +288,11 @@ static int ili9225_dbi_command(struct mipi_dbi *mipi, u8 cmd, u8 *par,gpiod_set_value_cansleep (mipi->dc,0 ); speed_hz =mipi_dbi_spi_cmd_max_speed (spi,1 ); - ret =tinydrm_spi_transfer (spi, speed_hz,NULL ,8 , &cmd,1 ); + ret =tinydrm_spi_transfer (spi, speed_hz,NULL ,8 , cmd,1 );if (ret || !num)return ret; -if (cmd ==ILI9225_WRITE_DATA_TO_GRAM && !mipi->swap_bytes) +if (*cmd ==ILI9225_WRITE_DATA_TO_GRAM && !mipi->swap_bytes) bpw =16 ;gpiod_set_value_cansleep (mipi->dc,1 );
drivers/gpu/drm/tinydrm/mipi-dbi.c +42 -16
130 lines not on this page · raw message
include/drm/tinydrm/mipi-dbi.h +3 -2
@@ -42,7 +42,7 @@ struct mipi_dbi {struct spi_device *spi;bool enabled;struct mutex cmdlock; -int (*command)(struct mipi_dbi *mipi,u8 cmd,u8 *param,size_t num); +int (*command)(struct mipi_dbi *mipi,u8 *cmd,u8 *param,size_t num);const u8 *read_commands;struct gpio_desc *dc;u16 *tx_buf;
@@ -79,6 +79,7 @@ u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len);int mipi_dbi_command_read (struct mipi_dbi *mipi,u8 cmd,u8 *val);int mipi_dbi_command_buf (struct mipi_dbi *mipi,u8 cmd,u8 *data,size_t len); +int mipi_dbi_command_stackbuf (struct mipi_dbi *mipi,u8 cmd,u8 *data,size_t len);int mipi_dbi_buf_copy (void *dst,struct drm_framebuffer *fb,struct drm_clip_rect *clip,bool swap);/**
@@ -96,7 +97,7 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, #define mipi_dbi_command(mipi, cmd, seq...) \ ({ \ u8 d[] = { seq }; \ - mipi_dbi_command_buf(mipi, cmd, d, ARRAY_SIZE(d)); \ + mipi_dbi_command_stackbuf(mipi, cmd, d, ARRAY_SIZE(d)); \ })#ifdef CONFIG_DEBUG_FS
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 248/276 igb: Exclude device from suspend direct complete optimization
In reply to Greg Kroah-Hartman[ Upstream commit 5b6e13216be29ced7350d9c354a1af8fe0ad9a3e ]
igb sets different WoL settings in system suspend callback and runtime suspend callback.
The suspend direct complete optimization leaves igb in runtime suspended state with wrong WoL setting during system suspend.
To fix this, we need to disable suspend direct complete optimization to let igb always use suspend callback to set correct WoL during system suspend.
--- drivers/net/ethernet/intel/igb/igb_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/igb/igb_main.c +3 -0
@@ -3468,6 +3468,9 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)break ; } } + +dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NEVER_SKIP ); +pm_runtime_put_noidle (&pdev->dev);return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 249/276 media: si2165: fix a missing check of return value
In reply to Greg Kroah-Hartman[ Upstream commit 0ab34a08812a3334350dbaf69a018ee0ab3d2ddd ]
si2165_readreg8() may fail. Looking into si2165_readreg8(), we will find that "val_tmp" will be an uninitialized value when regmap_read() fails. "val_tmp" is then assigned to "val". So if si2165_readreg8() fails, "val" will be a random value. Further use will lead to undefined behaviors. The fix checks if si2165_readreg8() fails, and if so, returns its error code upstream.
--- drivers/media/dvb-frontends/si2165.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/media/dvb-frontends/si2165.c +5 -3
@@ -275,18 +275,20 @@ static u32 si2165_get_fe_clk(struct si2165_state *state)static int si2165_wait_init_done (struct si2165_state *state) { -int ret = -EINVAL ; +int ret;u8 val =0 ;int i;for (i =0 ; i <3 ; ++i) { -si2165_readreg8 (state,REG_INIT_DONE , &val); + ret =si2165_readreg8 (state,REG_INIT_DONE , &val); +if (ret <0 ) +return ret;if (val ==0x01 )return 0 ;usleep_range (1000 ,50000 ); }dev_err (&state->client->dev,"init_done was not set\n" ); -return ret; +return -EINVAL ; } static int si2165_upload_firmware_block(struct si2165_state *state,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 244/276 drm/amd/display: fix releasing planes when exiting odm
In reply to Greg Kroah-Hartman[ Upstream commit bc2193992b00488f5734613ac95b78ef2d2803ab ]
Releasing planes should not release the 2nd odm pipe right away, this change leaves us with 2 pipes with null planes and same stream when planes are released during odm.
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +4 -2
@@ -1401,10 +1401,12 @@ bool dc_remove_plane_from_context(* For head pipe detach surfaces from pipe for tail * pipe just zero it out */ -if (!pipe_ctx->top_pipe) { +if (!pipe_ctx->top_pipe || + (!pipe_ctx->top_pipe->top_pipe && + pipe_ctx->top_pipe->stream_res.opp != pipe_ctx->stream_res.opp)) { pipe_ctx->plane_state =NULL ; pipe_ctx->bottom_pipe =NULL ; - }else { + }else {memset (pipe_ctx,0 ,sizeof (*pipe_ctx)); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 243/276 thunderbolt: Fix to check for kmemdup failure
In reply to Greg Kroah-Hartman[ Upstream commit 2cc12751cf464a722ff57b54d17d30c84553f9c0 ]
Memory allocated via kmemdup might fail and return a NULL pointer. This patch adds a check on the return value of kmemdup and passes the error upstream.
--- drivers/thunderbolt/switch.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/thunderbolt/switch.c +16 -6
@@ -1289,13 +1289,14 @@ int tb_switch_configure(struct tb_switch *sw)return tb_plug_events_active (sw, true); } -static void tb_switch_set_uuid (struct tb_switch *sw) +static int tb_switch_set_uuid (struct tb_switch *sw) {u32 uuid[4 ]; -int cap; +int cap, ret; + ret =0 ;if (sw->uuid) -return ; +return ret;/* * The newer controllers include fused UUID as part of link
@@ -1303,7 +1304,9 @@ static void tb_switch_set_uuid(struct tb_switch *sw)*/ cap =tb_switch_find_vse_cap (sw,TB_VSE_CAP_LINK_CONTROLLER );if (cap >0 ) { -tb_sw_read (sw, uuid,TB_CFG_SWITCH , cap +3 ,4 ); + ret =tb_sw_read (sw, uuid,TB_CFG_SWITCH , cap +3 ,4 ); +if (ret) +return ret; }else {/* * ICM generates UUID based on UID and fills the upper
@@ -1318,6 +1321,9 @@ static void tb_switch_set_uuid(struct tb_switch *sw) } sw->uuid =kmemdup (uuid,sizeof (uuid),GFP_KERNEL ); +if (!sw->uuid) + ret = -ENOMEM ; +return ret; }static int tb_switch_add_dma_port (struct tb_switch *sw)
@@ -1367,7 +1373,9 @@ static int tb_switch_add_dma_port(struct tb_switch *sw)if (status) {tb_sw_info (sw,"switch flash authentication failed\n" ); -tb_switch_set_uuid (sw); + ret =tb_switch_set_uuid (sw); +if (ret) +return ret;nvm_set_auth_status (sw, status); }
@@ -1417,7 +1425,9 @@ int tb_switch_add(struct tb_switch *sw) }tb_sw_info (sw,"uid: %#llx\n" , sw->uid); -tb_switch_set_uuid (sw); + ret =tb_switch_set_uuid (sw); +if (ret) +return ret;for (i =0 ; i <= sw->config.max_port_number; i++) {if (sw->ports[i].disabled) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 242/276 thunderbolt: Fix to check return value of ida_simple_get
In reply to Greg Kroah-Hartman[ Upstream commit 9aabb68568b473bf2f0b179d053b403961e42e4d ]
In enumerate_services, ida_simple_get on failure can return an error and leaks memory. The patch ensures that the dev_set_name is set on non failure cases, and releases memory during failure.
--- drivers/thunderbolt/xdomain.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/thunderbolt/xdomain.c +7 -1
@@ -743,6 +743,7 @@ static void enumerate_services(struct tb_xdomain *xd)struct tb_service *svc;struct tb_property *p;struct device *dev; +int id;/* * First remove all services that are not available anymore in
@@ -771,7 +772,12 @@ static void enumerate_services(struct tb_xdomain *xd)break ; } - svc->id =ida_simple_get (&xd->service_ids,0 ,0 ,GFP_KERNEL ); + id =ida_simple_get (&xd->service_ids,0 ,0 ,GFP_KERNEL ); +if (id <0 ) { +kfree (svc); +break ; + } + svc->id = id; svc->dev.bus = &tb_bus_type; svc->dev.type = &tb_service_type; svc->dev.parent = &xd->dev;
Signature · 1 line
2.20.1