5.14.19-rc1 review
Subsystems (13)
Greg Kroah-Hartman
maintainerPATCH 252/849 ia64: dont do IA64_CMPXCHG_DEBUG without CONFIG_PRINTK
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit c15b5fc054c3d6c97e953617605235c5cb8ce979 ]
When CONFIG_PRINTK is not set, the CMPXCHG_BUGCHECK() macro calls _printk(), but _printk() is a static inline function, not available as an extern.
Since the purpose of the macro is to print the BUGCHECK info, make this config option depend on PRINTK.
Fixes multiple occurrences of this build error:
../include/linux/printk.h:208:5: error: static declaration of '_printk' follows non-static declaration
208 | int _printk(const char *s, ...)
| ^~~~~~~
In file included from ../arch/ia64/include/asm/cmpxchg.h:5, ../arch/ia64/include/uapi/asm/cmpxchg.h:146:28: note: previous declaration of '_printk' with type 'int(const char *, ...)'
146 | extern int _printk(const char *fmt, ...);
--- arch/ia64/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/ia64/Kconfig.debug +1 -1
@@ -39,7 +39,7 @@ config DISABLE_VHPT config IA64_DEBUG_CMPXCHG bool "Turn on compare-and-exchange bug checking (slow!)" - depends on DEBUG_KERNEL + depends on DEBUG_KERNEL && PRINTK help Selecting this option turns on bug checking for the IA-64 compare-and-exchange instructions. This is slow! Itaniums
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 280/849 drm/msm: prevent NULL dereference in msm_gpu_crashstate_capture()
In reply to Greg Kroah-HartmanFrom: Tim Gardner <[email protected]>
[ Upstream commit b220c154832c5cd0df34cbcbcc19d7135c16e823 ]
Coverity complains of a possible NULL dereference:
CID 120718 (#1 of 1): Dereference null return value (NULL_RETURNS)
23. dereference: Dereferencing a pointer that might be NULL state->bos when calling msm_gpu_crashstate_get_bo. [show details]
301 msm_gpu_crashstate_get_bo(state, submit->bos[i].obj,
302 submit->bos[i].iova, submit->bos[i].flags);
Fix this by employing the same state->bos NULL check as is used in the next for loop.
--- drivers/gpu/drm/msm/msm_gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_gpu.c +1 -1
@@ -404,7 +404,7 @@ static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, state->bos =kcalloc (nr,sizeof (struct msm_gpu_state_bo ),GFP_KERNEL ); -for (i =0 ; i < submit->nr_bos; i++) { +for (i =0 ; state->bos && i < submit->nr_bos; i++) {if (should_dump (submit, i)) {msm_gpu_crashstate_get_bo (state, submit->bos[i].obj, submit->bos[i].iova, submit->bos[i].flags);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 441/849 media: ivtv: fix build for UML
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 6cb67bea945bdf0ad40e633cd2d9fbeb0855675b ]
Prevent the use of page table macros and types from 2 conflicting places. This fixes multiple build errors and warnings, e.g.:
../arch/x86/include/asm/pgtable_64_types.h:21:34: error: conflicting types for ‘pte_t’
typedef struct { pteval_t pte; } pte_t;
^~~~~
In file included from ../include/linux/mm_types_task.h:16:0,
from ../include/linux/mm_types.h:5,
from ../include/linux/buildid.h:5,
from ../include/linux/module.h:14,
from ../drivers/media/pci/ivtv/ivtv-driver.h:40,
from ../drivers/media/pci/ivtv/ivtvfb.c:29:../arch/um/include/asm/page.h:57:39: note: previous declaration of ‘pte_t’ was here
typedef struct { unsigned long pte; } pte_t;
../arch/x86/include/asm/pgtable_types.h:284:43: error: expected ‘)’ before ‘prot’
static inline pgprot_t pgprot_nx(pgprot_t prot)
^
../include/linux/pgtable.h:914:26: note: in definition of macro ‘pgprot_nx’
#define pgprot_nx(prot) (prot)
^~~~
In file included from ../arch/x86/include/asm/memtype.h:6:0,
from ../drivers/media/pci/ivtv/ivtvfb.c:40:../arch/x86/include/asm/pgtable_types.h:288:0: warning: "pgprot_nx" redefined
#define pgprot_nx pgprot_nx
../arch/x86/include/asm/page_types.h:11:0: warning: "PAGE_SIZE" redefined
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
In file included from ../include/linux/mm_types_task.h:16:0,
from ../include/linux/mm_types.h:5,
from ../include/linux/buildid.h:5,
from ../include/linux/module.h:14,
from ../drivers/media/pci/ivtv/ivtv-driver.h:40,
from ../drivers/media/pci/ivtv/ivtvfb.c:29:../arch/um/include/asm/page.h:14:0: note: this is the location of the previous definition
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
--- drivers/media/pci/ivtv/ivtvfb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/ivtv/ivtvfb.c +2 -2
@@ -36,7 +36,7 @@#include <linux/fb.h> #include <linux/ivtvfb.h> -#ifdef CONFIG_X86_64 +#if defined(CONFIG_X86_64 ) && !defined(CONFIG_UML )#include <asm/memtype.h> #endif
@@ -1157,7 +1157,7 @@ static int ivtvfb_init_card(struct ivtv *itv) {int rc; -#ifdef CONFIG_X86_64 +#if defined(CONFIG_X86_64 ) && !defined(CONFIG_UML )if (pat_enabled ()) {if (ivtvfb_force_pat) {pr_info ("PAT is enabled. Write-combined framebuffer caching will be disabled.\n" );
Signature · 9 lines
2.33.0 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Greg Kroah-Hartman
maintainerPATCH 429/849 net: fealnx: fix build for UML
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit cd2621d07d517473611b170c69beb6524c677740 ]
On i386, when builtin (not a loadable module), the fealnx driver inspects boot_cpu_data to see what CPU family it is running on, and then acts on that data. The "family" struct member (x86) does not exist when running on UML, so prevent that test and do the default action.
Prevents this build error on UML + i386:
../drivers/net/ethernet/fealnx.c: In function ‘netdev_open’:../drivers/net/ethernet/fealnx.c:861:19: error: ‘struct cpuinfo_um’ has no member named ‘x86’
--- drivers/net/ethernet/fealnx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/fealnx.c +1 -1
@@ -857,7 +857,7 @@ static int netdev_open(struct net_device *dev) np->bcrvalue |=0x04 ;/* big-endian */ #endif -#if defined(__i386__) && !defined(MODULE ) +#if defined(__i386__) && !defined(MODULE ) && !defined(CONFIG_UML )if (boot_cpu_data.x86 <=4 ) np->crvalue =0xa00 ;else
Signature · 9 lines
2.33.0 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Greg Kroah-Hartman
maintainerPATCH 430/849 net: tulip: winbond-840: fix build for UML
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit a3d708925fcca1a2f7219bc9ce93e6341f85c1e0 ]
On i386, when builtin (not a loadable module), the winbond-840 driver inspects boot_cpu_data to see what CPU family it is running on, and then acts on that data. The "family" struct member (x86) does not exist when running on UML, so prevent that test and do the default action.
Prevents this build error on UML + i386:
../drivers/net/ethernet/dec/tulip/winbond-840.c: In function ‘init_registers’:../drivers/net/ethernet/dec/tulip/winbond-840.c:882:19: error: ‘struct cpuinfo_um’ has no member named ‘x86’
if (boot_cpu_data.x86 <= 4) {
--- drivers/net/ethernet/dec/tulip/winbond-840.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/dec/tulip/winbond-840.c +1 -1
@@ -877,7 +877,7 @@ static void init_registers(struct net_device *dev)8000 16 longwords 0200 2 longwords 2000 32 longwords C000 32 longwords 0400 4 longwords */ -#if defined (__i386__) && !defined(MODULE ) +#if defined (__i386__) && !defined(MODULE ) && !defined(CONFIG_UML )/* When not a module we can work around broken '486 PCI boards. */ if (boot_cpu_data.x86 <=4 ) { i |=0x4800 ;
Signature · 9 lines
2.33.0 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Greg Kroah-Hartman
maintainerPATCH 10/849 scsi: lpfc: Dont release final kref on Fport node while ABTS outstanding
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
commit 982fc3965d1350d3332e04046b0e101006184ba9 upstream.
In a rarely executed path, FLOGI failure, there is a refcounting error. If FLOGI completed with an error, typically a timeout, the initial completion handler would remove the job reference. However, the job completion isn't the actual end of the job/exchange as the timeout usually initiates an ABTS, and upon that ABTS completion, a final completion is sent. The driver removes the reference again in the final completion. Thus the imbalance.
In the buggy cases, if there was a link bounce while the delayed response is outstanding, the fport node may be referenced again but there was no additional reference as it is already present. The delayed completion then occurs and removes the last reference freeing the node and causing issues in the link up processed that is using the node.
Fix this scenario by removing the snippet that removed the reference in the initial FLOGI completion. The bad snippet was poorly trying to identify the FLOGI as OK to do so by realizing the node was not registered with either SCSI or NVMe transport.
--- drivers/scsi/lpfc/lpfc_els.c | 11 +++++------ drivers/scsi/lpfc/lpfc_hbadisc.c | 10 ++++++---- drivers/scsi/lpfc/lpfc_nvme.c | 5 +++-- 3 files changed, 14 insertions(+), 12 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +5 -6
@@ -1056,9 +1056,10 @@ stop_rr_fcf_flogi:lpfc_printf_vlog (vport,KERN_WARNING ,LOG_TRACE_EVENT ,"0150 FLOGI failure Status:x%x/x%x " -"xri x%x TMO:x%x\n" , +"xri x%x TMO:x%x refcnt %d\n" , irsp->ulpStatus, irsp->un.ulpWord[4 ], - cmdiocb->sli4_xritag, irsp->ulpTimeout); + cmdiocb->sli4_xritag, irsp->ulpTimeout, +kref_read (&ndlp->kref));/* If this is not a loop open failure, bail out */ if (!(irsp->ulpStatus == IOSTAT_LOCAL_REJECT &&
@@ -1119,12 +1120,12 @@ stop_rr_fcf_flogi:/* FLOGI completes successfully */ lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS ,"0101 FLOGI completes successfully, I/O tag:x%x, " -"xri x%x Data: x%x x%x x%x x%x x%x x%x x%x\n" , +"xri x%x Data: x%x x%x x%x x%x x%x x%x x%x %d\n" , cmdiocb->iotag, cmdiocb->sli4_xritag, irsp->un.ulpWord[4 ], sp->cmn.e_d_tov, sp->cmn.w2.r_a_tov, sp->cmn.edtovResolution, vport->port_state, vport->fc_flag, - sp->cmn.priority_tagging); + sp->cmn.priority_tagging,kref_read (&ndlp->kref));if (sp->cmn.priority_tagging) vport->vmid_flag |=LPFC_VMID_ISSUE_QFPA ;
@@ -1202,8 +1203,6 @@ flogifail: phba->fcf.fcf_flag &= ~FCF_DISCOVERY ;spin_unlock_irq (&phba->hbalock); -if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD |NVME_XPT_REGD ))) -lpfc_nlp_put (ndlp);if (!lpfc_error_lost_link (irsp)) {/* FLOGI failed, so just use loop map to make discovery list */ lpfc_disc_list_loopmap (vport);
drivers/scsi/lpfc/lpfc_hbadisc.c +6 -4
@@ -4429,8 +4429,9 @@ lpfc_register_remote_port(struct lpfc_vpfc_remote_port_rolechg (rport, rport_ids.roles);lpfc_printf_vlog (ndlp->vport,KERN_INFO ,LOG_NODE , -"3183 %s rport x%px DID x%x, role x%x\n" , - __func__, rport, rport->port_id, rport->roles); +"3183 %s rport x%px DID x%x, role x%x refcnt %d\n" , + __func__, rport, rport->port_id, rport->roles, +kref_read (&ndlp->kref));if ((rport->scsi_target_id !=-1 ) && (rport->scsi_target_id <LPFC_MAX_TARGET )) {
@@ -4455,8 +4456,9 @@ lpfc_unregister_remote_port(struct lpfc_lpfc_printf_vlog (vport,KERN_INFO ,LOG_NODE ,"3184 rport unregister x%06x, rport x%px " -"xptflg x%x\n" , - ndlp->nlp_DID, rport, ndlp->fc4_xpt_flags); +"xptflg x%x refcnt %d\n" , + ndlp->nlp_DID, rport, ndlp->fc4_xpt_flags, +kref_read (&ndlp->kref));fc_remote_port_delete (rport);lpfc_nlp_put (ndlp);
drivers/scsi/lpfc/lpfc_nvme.c +3 -2
@@ -209,8 +209,9 @@ lpfc_nvme_remoteport_delete(struct nvme_* calling state machine to remove the node. */ lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME_DISC , -"6146 remoteport delete of remoteport x%px\n" , - remoteport); +"6146 remoteport delete of remoteport x%px, ndlp x%px " +"DID x%x xflags x%x\n" , + remoteport, ndlp, ndlp->nlp_DID, ndlp->fc4_xpt_flags);spin_lock_irq (&ndlp->lock);/* The register rebind might have occurred before the delete
Greg Kroah-Hartman
maintainerPATCH 2/849 usb: xhci: Enable runtime-pm by default on AMD Yellow Carp platform
In reply to Greg Kroah-HartmanFrom: Nehal Bakulchandra Shah <[email protected]>
commit 660a92a59b9e831a0407e41ff62875656d30006e upstream.
AMD's Yellow Carp platform supports runtime power management for XHCI Controllers, so enable the same by default for all XHCI Controllers.
[ regrouped and aligned the PCI_DEVICE_ID definitions -Mathias]
--- drivers/usb/host/xhci-pci.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/usb/host/xhci-pci.c +16 -0
@@ -65,6 +65,13 @@#define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba#define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb#define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 0x161a +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 0x161b +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 0x161d +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 0x161e +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 0x15d6 +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 0x15d7 +#define PCI_DEVICE_ID_ASMEDIA_1042_XHCI 0x1042#define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142#define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242
@@ -317,6 +324,15 @@ static void xhci_pci_quirks(struct devic pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4)) xhci->quirks |= XHCI_NO_SOFT_RETRY; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && + (pdev->device ==PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 || + pdev->device ==PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 || + pdev->device ==PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 || + pdev->device ==PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 || + pdev->device ==PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 || + pdev->device ==PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 )) + xhci->quirks |=XHCI_DEFAULT_PM_RUNTIME_ALLOW ; +if (xhci->quirks &XHCI_RESET_ON_RESUME )xhci_dbg_trace (xhci, trace_xhci_dbg_quirks,"QUIRK: Resetting on resume" );
Greg Kroah-Hartman
maintainerPATCH 18/849 exfat: fix incorrect loading of i_blocks for large files
In reply to Greg Kroah-HartmanFrom: Sungjong Seo <[email protected]>
commit 0c336d6e33f4bedc443404c89f43c91c8bd9ee11 upstream.
When calculating i_blocks, there was a mistake that was masked with a 32-bit variable. So i_blocks for files larger than 4 GiB had incorrect values. Mask with a 64-bit variable instead of 32-bit one.
--- fs/exfat/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/exfat/inode.c +1 -1
@@ -604,7 +604,7 @@ static int exfat_fill_inode(struct inodeexfat_save_attr (inode, info->attr); inode->i_blocks = ((i_size_read (inode) + (sbi->cluster_size -1 )) & - ~(sbi->cluster_size -1 )) >> inode->i_blkbits; + ~((loff_t )sbi->cluster_size -1 )) >> inode->i_blkbits; inode->i_mtime = info->mtime; inode->i_ctime = info->mtime; ei->i_crtime = info->crtime;
Greg Kroah-Hartman
maintainerPATCH 21/849 tpm: Check for integer overflow in tpm2_map_response_body()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit a0bcce2b2a169e10eb265c8f0ebdd5ae4c875670 upstream.
The "4 * be32_to_cpu(data->count)" multiplication can potentially overflow which would lead to memory corruption. Add a check for that.
--- drivers/char/tpm/tpm2-space.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/char/tpm/tpm2-space.c +3 -0
@@ -455,6 +455,9 @@ static int tpm2_map_response_body(structif (be32_to_cpu (data->capability) !=TPM2_CAP_HANDLES )return 0 ; +if (be32_to_cpu (data->count) > (UINT_MAX -TPM_HEADER_SIZE -9 ) /4 ) +return -EFAULT ; +if (len !=TPM_HEADER_SIZE +9 +4 *be32_to_cpu (data->count))return -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 22/849 firmware/psci: fix application of sizeof to pointer
In reply to Greg Kroah-HartmanFrom: jing yangyang <[email protected]>
commit 2ac5fb35cd520ab1851c9a4816c523b65276052f upstream.
sizeof when applied to a pointer typed expression gives the size of the pointer.
./drivers/firmware/psci/psci_checker.c:158:41-47: ERROR application of sizeof to pointer
This issue was detected with the help of Coccinelle.
--- drivers/firmware/psci/psci_checker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/psci/psci_checker.c +1 -1
@@ -155,7 +155,7 @@ static int alloc_init_cpu_groups(cpumaskif (!alloc_cpumask_var (&tmp,GFP_KERNEL ))return -ENOMEM ; - cpu_groups =kcalloc (nb_available_cpus,sizeof (cpu_groups), + cpu_groups =kcalloc (nb_available_cpus,sizeof (*cpu_groups),GFP_KERNEL );if (!cpu_groups) {free_cpumask_var (tmp);
Greg Kroah-Hartman
maintainerPATCH 19/849 parisc: Fix set_fixmap() on PA1.x CPUs
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 6e866a462867b60841202e900f10936a0478608c upstream.
Fix a kernel crash which happens on PA1.x CPUs while initializing the FTRACE/KPROBE breakpoints. The PTE table entries for the fixmap area were not created correctly.
--- arch/parisc/mm/fixmap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/parisc/mm/fixmap.c +1 -4
@@ -20,12 +20,9 @@ void notrace set_fixmap(enum fixed_addrepte_t *pte;if (pmd_none (*pmd)) - pmd =pmd_alloc (NULL , pud, vaddr); - - pte =pte_offset_kernel (pmd, vaddr); -if (pte_none (*pte)) pte =pte_alloc_kernel (pmd, vaddr); + pte =pte_offset_kernel (pmd, vaddr);set_pte_at (&init_mm, vaddr, pte,__mk_pte (phys,PAGE_KERNEL_RWX ));flush_tlb_kernel_range (vaddr, vaddr +PAGE_SIZE ); }
Greg Kroah-Hartman
maintainerPATCH 20/849 parisc: Fix ptrace check on syscall return
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 8779e05ba8aaffec1829872ef9774a71f44f6580 upstream.
The TIF_XXX flags are stored in the flags field in the thread_info struct (TI_FLAGS), not in the flags field of the task_struct structure (TASK_FLAGS).
It seems this bug didn't generate any important side-effects, otherwise it wouldn't have went unnoticed for 12 years (since v2.6.32).
--- arch/parisc/kernel/entry.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/entry.S +1 -1
@@ -1834,7 +1834,7 @@ syscall_restore: LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* Are we being ptraced? */ - ldw TASK_FLAGS(%r1),%r19 + LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 ldi _TIF_SYSCALL_TRACE_MASK,%r2 and,COND(=) %r19,%r2,%r0 b,n syscall_restore_rfi
Greg Kroah-Hartman
maintainerPATCH 23/849 crypto: s5p-sss - Add error handling in s5p_aes_probe()
In reply to Greg Kroah-HartmanFrom: Tang Bin <[email protected]>
commit a472cc0dde3eb057db71c80f102556eeced03805 upstream.
The function s5p_aes_probe() does not perform sufficient error checking after executing platform_get_resource(), thus fix it.
--- drivers/crypto/s5p-sss.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/s5p-sss.c +2 -0
@@ -2171,6 +2171,8 @@ static int s5p_aes_probe(struct platform variant =find_s5p_sss_version (pdev); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) +return -EINVAL ;/* * Note: HASH and PRNG uses the same registers in secss, avoid
Greg Kroah-Hartman
maintainerPATCH 13/849 scsi: qla2xxx: Fix use after free in eh_abort path
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
commit 3d33b303d4f3b74a71bede5639ebba3cfd2a2b4d upstream.
In eh_abort path driver prematurely exits the call to upper layer. Check whether command is aborted / completed by firmware before exiting the call.
9 [ffff8b1ebf803c00] page_fault at ffffffffb0389778
[exception RIP: qla2x00_status_entry+0x48d]
RIP: ffffffffc04fa62d RSP: ffff8b1ebf803cb0 RFLAGS: 00010082 RAX: 00000000ffffffff RBX: 00000000000e0000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 00000000000013d8 RDI: fffff3253db78440 RBP: ffff8b1ebf803dd0 R8: ffff8b1ebcd9b0c0 R9: 0000000000000000 R10: ffff8b1e38a30808 R11: 0000000000001000 R12: 00000000000003e9 R13: 0000000000000000 R14: ffff8b1ebcd9d740 R15: 0000000000000028 ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
10 [ffff8b1ebf803cb0] enqueue_entity at ffffffffafce708f
11 [ffff8b1ebf803d00] enqueue_task_fair at ffffffffafce7b88 12 [ffff8b1ebf803dd8] qla24xx_process_response_queue at ffffffffc04fc9a6 [qla2xxx]
13 [ffff8b1ebf803e78] qla24xx_msix_rsp_q at ffffffffc04ff01b [qla2xxx] 14 [ffff8b1ebf803eb0] __handle_irq_event_percpu at ffffffffafd50714
--- drivers/scsi/qla2xxx/qla_os.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +5 -3
@@ -1237,6 +1237,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)uint32_t ratov_j;struct qla_qpair *qpair;unsigned long flags; +int fast_fail_status =SUCCESS ;if (qla2x00_isp_reg_stat (ha)) { ql_log(ql_log_info, vha, 0x8042,
@@ -1245,9 +1246,10 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)return FAILED ; } +/* Save any FAST_IO_FAIL value to return later if abort succeeds */ ret =fc_block_scsi_eh (cmd);if (ret !=0 ) -return ret; + fast_fail_status = ret; sp =scsi_cmd_priv (cmd); qpair = sp->qpair;
@@ -1255,7 +1257,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) vha->cmd_timeout_cnt++;if ((sp->fcport && sp->fcport->deleted) || !qpair) -return SUCCESS ; +return fast_fail_status !=SUCCESS ? fast_fail_status :FAILED ;spin_lock_irqsave (qpair->qp_lock_ptr, flags); sp->comp = ∁
@@ -1290,7 +1292,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) __func__, ha->r_a_tov/10); ret =FAILED ; }else { - ret =SUCCESS ; + ret = fast_fail_status; }break ;default :
Greg Kroah-Hartman
maintainerPATCH 15/849 char: xillybus: fix msg_ep UAF in xillyusb_probe()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
commit 15c9a359094ec6251578b02387436bc64f11a477 upstream.
When endpoint_alloc() return failed in xillyusb_setup_base_eps(), 'xdev->msg_ep' will be freed but not set to NULL. That lets program enter fail handling to cleanup_dev() in xillyusb_probe(). Check for 'xdev->msg_ep' is invalid in cleanup_dev() because 'xdev->msg_ep' did not set to NULL when was freed. So the UAF problem for 'xdev->msg_ep' is triggered.
==================================================================
BUG: KASAN: use-after-free in fifo_mem_release+0x1f4/0x210 CPU: 0 PID: 166 Comm: kworker/0:2 Not tainted 5.15.0-rc5+ #19 Call Trace: dump_stack_lvl+0xe2/0x152 print_address_description.constprop.0+0x21/0x140 ? fifo_mem_release+0x1f4/0x210 kasan_report.cold+0x7f/0x11b ? xillyusb_probe+0x530/0x700 ? fifo_mem_release+0x1f4/0x210 fifo_mem_release+0x1f4/0x210 ? __sanitizer_cov_trace_pc+0x1d/0x50 endpoint_dealloc+0x35/0x2b0 cleanup_dev+0x90/0x120 xillyusb_probe+0x59a/0x700
...
Freed by task 166: kasan_save_stack+0x1b/0x40 kasan_set_track+0x1c/0x30 kasan_set_free_info+0x20/0x30 __kasan_slab_free+0x109/0x140 kfree+0x117/0x4c0 xillyusb_probe+0x606/0x700
Set 'xdev->msg_ep' to NULL after being freed in xillyusb_setup_base_eps() to fix the UAF problem.
--- drivers/char/xillybus/xillyusb.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/xillybus/xillyusb.c +1 -0
@@ -1912,6 +1912,7 @@ static int xillyusb_setup_base_eps(struc dealloc:endpoint_dealloc (xdev->msg_ep);/* Also frees FIFO mem if allocated */ + xdev->msg_ep =NULL ;return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 16/849 mmc: mtk-sd: Add wait dma stop done flow
In reply to Greg Kroah-HartmanFrom: Derong Liu <[email protected]>
commit 43e5fee317f4b0a48992b8b07935b1a3ac20ce84 upstream.
We found this issue on a 5G platform, during CMDQ error handling, if DMA status is active when it call msdc_reset_hw(), it means mmc host hw reset and DMA transfer will be parallel, mmc host may access sram region unexpectedly. According to the programming guide of mtk-sd host, it needs to wait for dma stop done after set dma stop.
This change should be applied to all SoCs.
--- drivers/mmc/host/mtk-sd.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mmc/host/mtk-sd.c +5 -0
@@ -8,6 +8,7 @@#include <linux/clk.h> #include <linux/delay.h> #include <linux/dma-mapping.h> +#include <linux/iopoll.h> #include <linux/ioport.h> #include <linux/irq.h> #include <linux/of_address.h>
@@ -2330,6 +2331,7 @@ static void msdc_cqe_enable(struct mmc_hstatic void msdc_cqe_disable (struct mmc_host *mmc,bool recovery) {struct msdc_host *host =mmc_priv (mmc); +unsigned int val =0 ;/* disable cmdq irq */ sdr_clr_bits (host->base +MSDC_INTEN ,MSDC_INT_CMDQ );
@@ -2339,6 +2341,9 @@ static void msdc_cqe_disable(struct mmc_if (recovery) {sdr_set_field (host->base +MSDC_DMA_CTRL ,MSDC_DMA_CTRL_STOP ,1 ); +if (WARN_ON (readl_poll_timeout (host->base +MSDC_DMA_CFG , val, + !(val &MSDC_DMA_CFG_STS ),1 ,3000 ))) +return ;msdc_reset_hw (host); } }
Greg Kroah-Hartman
maintainerPATCH 17/849 mmc: dw_mmc: Dont wait for DRTO on Write RSP error
In reply to Greg Kroah-HartmanFrom: Christian Löhle <[email protected]>
commit 43592c8736e84025d7a45e61a46c3fa40536a364 upstream.
Only wait for DRTO on reads, otherwise the driver hangs.
The driver prevents sending CMD12 on response errors like CRCs. According to the comment this is because some cards have problems with this during the UHS tuning sequence. Unfortunately this workaround currently also applies for any command with data. On reads this will set the drto timer, which then triggers after a while. On writes this will not set any timer and the tasklet will not be scheduled again.
I cannot test for the UHS workarounds need, but even if so, it should at most apply to reads. I have observed many hangs when CMD25 response contained a CRC error. This patch fixes this without touching the actual UHS tuning workaround.
--- drivers/mmc/host/dw_mmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/dw_mmc.c +2 -1
@@ -2014,7 +2014,8 @@ static void dw_mci_tasklet_func(struct t* delayed. Allowing the transfer to take place * avoids races and keeps things simple. */ -if (err != -ETIMEDOUT ) { +if (err != -ETIMEDOUT && + host->dir_status ==DW_MCI_RECV_STATUS ) { state =STATE_SENDING_DATA ;continue ; }
Greg Kroah-Hartman
maintainerPATCH 3/849 Input: iforce - fix control-message timeout
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 744d0090a5f6dfa4c81b53402ccdf08313100429 upstream.
USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
--- drivers/input/joystick/iforce/iforce-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/joystick/iforce/iforce-usb.c +1 -1
@@ -92,7 +92,7 @@ static int iforce_usb_get_id(struct ifor id,USB_TYPE_VENDOR |USB_DIR_IN |USB_RECIP_INTERFACE , - 0, 0, buf, IFORCE_MAX_LENGTH, HZ); + 0, 0, buf, IFORCE_MAX_LENGTH, 1000);if (status <0 ) {dev_err (&iforce_usb->intf->dev,"usb_submit_urb failed: %d\n" , status);
Greg Kroah-Hartman
maintainerPATCH 14/849 ce/gf100: fix incorrect CE0 address calculation on some GPUs
In reply to Greg Kroah-HartmanFrom: Ben Skeggs <[email protected]>
commit 93f43ed81abec8c805e1b77eb1d20dbc51a24dc4 upstream.
The code which constructs the modules for each engine present on the GPU passes -1 for 'instance' on non-instanced engines, which affects how the name for a sub-device is generated. This is then stored as 'instance 0' in nvkm_subdev.inst, so code can potentially be shared with earlier GPUs that only had a single instance of an engine.
However, GF100's CE constructor uses this value to calculate the address of its falcon before it's translated, resulting in CE0 getting the wrong address.
This slightly modifies the approach, always passing a valid instance for engines that *can* have multiple copies, and having the code for earlier GPUs explicitly ask for non-instanced name generation.
--- drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c +1 -1
@@ -78,6 +78,6 @@ int gt215_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_engine **pengine) { - return nvkm_falcon_new_(>215_ce, device, type, inst, + return nvkm_falcon_new_(>215_ce, device, type, -1, (device->chipset != 0xaf), 0x104000, pengine); }
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +1 -2
@@ -3147,8 +3147,7 @@ nvkm_device_ctor(const struct nvkm_devicWARN_ON (device->chip->ptr.inst & ~((1 <<ARRAY_SIZE (device->ptr)) -1 )); \for (j =0 ; device->chip->ptr.inst && j <ARRAY_SIZE (device->ptr); j++) { \if ((device->chip->ptr.inst &BIT (j)) && (subdev_mask &BIT_ULL (type))) { \ -int inst = (device->chip->ptr.inst ==1 ) ?-1 : (j); \ - ret = device->chip->ptr.ctor (device, (type), inst, &device->ptr[j]); \ + ret = device->chip->ptr.ctor (device, (type), (j), &device->ptr[j]); \ subdev =nvkm_device_subdev (device, (type), (j)); \if (ret) { \nvkm_subdev_del (&subdev); \
Greg Kroah-Hartman
maintainerPATCH 27/849 media: ir-kbd-i2c: improve responsiveness of hauppauge zilog receivers
In reply to Greg Kroah-HartmanFrom: Sean Young <[email protected]>
commit c73ba202a851c0b611ef2c25e568fadeff5e667f upstream.
The IR receiver has two issues:
- Sometimes there is no response to a button press
- Sometimes a button press is repeated when it should not have been
Hanging the polling interval fixes this behaviour.
--- drivers/media/i2c/ir-kbd-i2c.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/ir-kbd-i2c.c +1 -0
@@ -791,6 +791,7 @@ static int ir_probe(struct i2c_client *c rc_proto =RC_PROTO_BIT_RC5 |RC_PROTO_BIT_RC6_MCE |RC_PROTO_BIT_RC6_6A_32 ; ir_codes =RC_MAP_HAUPPAUGE ; + ir->polling_interval =125 ; probe_tx = true;break ; }
Greg Kroah-Hartman
maintainerPATCH 28/849 media: v4l2-ioctl: Fix check_ext_ctrls
In reply to Greg Kroah-HartmanFrom: Ricardo Ribalda <[email protected]>
commit 861f92cb9160b14beef0ada047384c2340701ee2 upstream.
Drivers that do not use the ctrl-framework use this function instead.
Fix the following issues:
- Do not check for multiple classes when getting the DEF_VAL.
- Return -EINVAL for request_api calls
- Default value cannot be changed, return EINVAL as soon as possible.
- Return the right error_idx
[If an error is found when validating the list of controls passed with VIDIOC_G_EXT_CTRLS, then error_idx shall be set to ctrls->count to indicate to userspace that no actual hardware was touched. It would have been much nicer of course if error_idx could point to the control index that failed the validation, but sadly that's not how the API was designed.]
Fixes v4l2-compliance:
Control ioctls (Input 0):
warn: v4l2-test-controls.cpp(834): error_idx should be equal to count
warn: v4l2-test-controls.cpp(855): error_idx should be equal to count
fail: v4l2-test-controls.cpp(813): doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
Buffer ioctls (Input 0):
fail: v4l2-test-buffers.cpp(1994): ret != EINVAL && ret != EBADR && ret != ENOTTY test Requests: FAIL
--- drivers/media/v4l2-core/v4l2-ioctl.c | 60 ++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 21 deletions(-)
drivers/media/v4l2-core/v4l2-ioctl.c +39 -21
@@ -869,7 +869,7 @@ static void v4l_print_default(const voidpr_cont ("driver-specific ioctl\n" ); } -static int check_ext_ctrls (struct v4l2_ext_controls *c,int allow_priv) +static bool check_ext_ctrls (struct v4l2_ext_controls *c,unsigned long ioctl) {__u32 i;
@@ -878,23 +878,41 @@ static int check_ext_ctrls(struct v4l2_efor (i =0 ; i < c->count; i++) c->controls[i].reserved2[0 ] =0 ; -/* V4L2_CID_PRIVATE_BASE cannot be used as control class -when using extended controls. -Only when passed in through VIDIOC_G_CTRL and VIDIOC_S_CTRL -is it allowed for backwards compatibility. -*/ -if (!allow_priv && c->which ==V4L2_CID_PRIVATE_BASE ) -return 0 ; -if (!c->which) -return 1 ; +switch (c->which) { +case V4L2_CID_PRIVATE_BASE : +/* +* V4L2_CID_PRIVATE_BASE cannot be used as control class +* when using extended controls. +* Only when passed in through VIDIOC_G_CTRL and VIDIOC_S_CTRL +* is it allowed for backwards compatibility. +*/ +if (ioctl ==VIDIOC_G_CTRL || ioctl ==VIDIOC_S_CTRL ) +return false; +break ; +case V4L2_CTRL_WHICH_DEF_VAL : +/* Default value cannot be changed */ +if (ioctl ==VIDIOC_S_EXT_CTRLS || + ioctl ==VIDIOC_TRY_EXT_CTRLS ) { + c->error_idx = c->count; +return false; + } +return true; +case V4L2_CTRL_WHICH_CUR_VAL : +return true; +case V4L2_CTRL_WHICH_REQUEST_VAL : + c->error_idx = c->count; +return false; + } +/* Check that all controls are from the same control class. */ for (i =0 ; i < c->count; i++) {if (V4L2_CTRL_ID2WHICH (c->controls[i].id) != c->which) { - c->error_idx = i; -return 0 ; + c->error_idx = ioctl ==VIDIOC_TRY_EXT_CTRLS ? i : + c->count; +return false; } } -return 1 ; +return true; }static int check_fmt (struct file *file,enum v4l2_buf_type type)
@@ -2187,7 +2205,7 @@ static int v4l_g_ctrl(const struct v4l2_ ctrls.controls = &ctrl; ctrl.id = p->id; ctrl.value = p->value; -if (check_ext_ctrls (&ctrls,1 )) { +if (check_ext_ctrls (&ctrls,VIDIOC_G_CTRL )) {int ret = ops->vidioc_g_ext_ctrls (file, fh, &ctrls);if (ret ==0 )
@@ -2221,7 +2239,7 @@ static int v4l_s_ctrl(const struct v4l2_ ctrls.controls = &ctrl; ctrl.id = p->id; ctrl.value = p->value; -if (check_ext_ctrls (&ctrls,1 )) +if (check_ext_ctrls (&ctrls,VIDIOC_S_CTRL ))return ops->vidioc_s_ext_ctrls (file, fh, &ctrls);return -EINVAL ; }
@@ -2243,8 +2261,8 @@ static int v4l_g_ext_ctrls(const struct vfd, vfd->v4l2_dev->mdev, p);if (ops->vidioc_g_ext_ctrls ==NULL )return -ENOTTY ; -return check_ext_ctrls (p,0 ) ? ops->vidioc_g_ext_ctrls (file, fh, p) : - -EINVAL ; +return check_ext_ctrls (p,VIDIOC_G_EXT_CTRLS ) ? + ops->vidioc_g_ext_ctrls (file, fh, p) : -EINVAL ; } static int v4l_s_ext_ctrls(const struct v4l2_ioctl_ops *ops,
@@ -2264,8 +2282,8 @@ static int v4l_s_ext_ctrls(const struct vfd, vfd->v4l2_dev->mdev, p);if (ops->vidioc_s_ext_ctrls ==NULL )return -ENOTTY ; -return check_ext_ctrls (p,0 ) ? ops->vidioc_s_ext_ctrls (file, fh, p) : - -EINVAL ; +return check_ext_ctrls (p,VIDIOC_S_EXT_CTRLS ) ? + ops->vidioc_s_ext_ctrls (file, fh, p) : -EINVAL ; } static int v4l_try_ext_ctrls(const struct v4l2_ioctl_ops *ops,
@@ -2285,8 +2303,8 @@ static int v4l_try_ext_ctrls(const struc vfd, vfd->v4l2_dev->mdev, p);if (ops->vidioc_try_ext_ctrls ==NULL )return -ENOTTY ; -return check_ext_ctrls (p,0 ) ? ops->vidioc_try_ext_ctrls (file, fh, p) : - -EINVAL ; +return check_ext_ctrls (p,VIDIOC_TRY_EXT_CTRLS ) ? + ops->vidioc_try_ext_ctrls (file, fh, p) : -EINVAL ; }/*
Greg Kroah-Hartman
maintainerPATCH 4/849 Input: elantench - fix misreporting trackpoint coordinates
In reply to Greg Kroah-HartmanFrom: Phoenix Huang <[email protected]>
commit be896bd3b72b44126c55768f14c22a8729b0992e upstream.
Some firmwares occasionally report bogus data from trackpoint, with X or Y displacement being too large (outside of [-127, 127] range). Let's drop such packets so that we do not generate jumps.
--- drivers/input/mouse/elantech.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/input/mouse/elantech.c +13 -0
@@ -517,6 +517,19 @@ static void elantech_report_trackpoint(scase 0x16008020U :case 0x26800010U :case 0x36808000U : + +/* +* This firmware misreport coordinates for trackpoint +* occasionally. Discard packets outside of [-127, 127] range +* to prevent cursor jumps. +*/ +if (packet[4 ] ==0x80 || packet[5 ] ==0x80 || + packet[1 ] >>7 == packet[4 ] >>7 || + packet[2 ] >>7 == packet[5 ] >>7 ) { +elantech_debug ("discarding packet [%6ph]\n" , packet); +break ; + + } x = packet[4 ] - (int )((packet[1 ]^0x80 ) <<1 ); y = (int )((packet[2 ]^0x80 ) <<1 ) - packet[5 ];
Greg Kroah-Hartman
maintainerPATCH 7/849 ocfs2: fix data corruption on truncate
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 839b63860eb3835da165642923120d305925561d upstream.
Patch series "ocfs2: Truncate data corruption fix".
As further testing has shown, commit 5314454ea3f ("ocfs2: fix data corruption after conversion from inline format") didn't fix all the data corruption issues the customer started observing after 6dbf7bb55598 ("fs: Don't invalidate page buffers in block_write_full_page()") This time I have tracked them down to two bugs in ocfs2 truncation code.
One bug (truncating page cache before clearing tail cluster and setting i_size) could cause data corruption even before 6dbf7bb55598, but before that commit it needed a race with page fault, after 6dbf7bb55598 it started to be pretty deterministic.
Another bug (zeroing pages beyond old i_size) used to be harmless inefficiency before commit 6dbf7bb55598. But after commit 6dbf7bb55598 in combination with the first bug it resulted in deterministic data corruption.
Although fixing only the first problem is needed to stop data corruption, I've fixed both issues to make the code more robust.
This patch (of 2):
ocfs2_truncate_file() did unmap invalidate page cache pages before zeroing partial tail cluster and setting i_size. Thus some pages could be left (and likely have left if the cluster zeroing happened) in the page cache beyond i_size after truncate finished letting user possibly see stale data once the file was extended again. Also the tail cluster zeroing was not guaranteed to finish before truncate finished causing possible stale data exposure. The problem started to be particularly easy to hit after commit 6dbf7bb55598 "fs: Don't invalidate page buffers in block_write_full_page()" stopped invalidation of pages beyond i_size from page writeback path.
Fix these problems by unmapping and invalidating pages in the page cache after the i_size is reduced and tail cluster is zeroed out.
--- fs/ocfs2/file.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ocfs2/file.c +6 -2
@@ -476,10 +476,11 @@ int ocfs2_truncate_file(struct inode *in* greater than page size, so we have to truncate them * anyway. */ -unmap_mapping_range (inode->i_mapping, new_i_size +PAGE_SIZE -1 ,0 ,1 ); -truncate_inode_pages (inode->i_mapping, new_i_size);if (OCFS2_I (inode)->ip_dyn_features &OCFS2_INLINE_DATA_FL ) { +unmap_mapping_range (inode->i_mapping, + new_i_size +PAGE_SIZE -1 ,0 ,1 ); +truncate_inode_pages (inode->i_mapping, new_i_size); status =ocfs2_truncate_inline (inode, di_bh, new_i_size,i_size_read (inode),1 );if (status)
@@ -498,6 +499,9 @@ int ocfs2_truncate_file(struct inode *in goto bail_unlock_sem; } +unmap_mapping_range (inode->i_mapping, new_i_size +PAGE_SIZE -1 ,0 ,1 ); +truncate_inode_pages (inode->i_mapping, new_i_size); + status =ocfs2_commit_truncate (osb, inode, di_bh);if (status <0 ) {mlog_errno (status);
Greg Kroah-Hartman
maintainerPATCH 611/849 ARM: dts: stm32: Reduce DHCOR SPI NOR frequency to 50 MHz
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 2012579b31293d0a8cf2024e9dab66810bf1a15e ]
The SPI NOR is a bit further away from the SoC on DHCOR than on DHCOM, which causes additional signal delay. At 108 MHz, this delay triggers a sporadic issue where the first bit of RX data is not received by the QSPI controller.
There are two options of addressing this problem, either by using the DLYB block to compensate the extra delay, or by reducing the QSPI bus clock frequency. The former requires calibration and that is overly complex, so opt for the second option.
--- arch/arm/boot/dts/stm32mp15xx-dhcor-som.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/stm32mp15xx-dhcor-som.dtsi +1 -1
@@ -202,7 +202,7 @@ compatible = "jedec,spi-nor"; reg = <0>; spi-rx-bus-width = <4>; - spi-max-frequency = <108000000>; + spi-max-frequency = <50000000>; #address-cells = <1>; #size-cells = <1>; };
Signature · 9 lines
2.33.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 605/849 usb: musb: select GENERIC_PHY instead of depending on it
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit fde1fbedbaed4e76cef4600d775b185f59b9b568 ]
The kconfig symbol GENERIC_PHY says:
All the users of this framework should select this config.
and around 136 out of 138 drivers do so, so change USB_MUSB_MEDIATEK to do so also.
This (also) fixes a long circular dependency problem for an upcoming patch.
--- drivers/usb/musb/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/musb/Kconfig +1 -1
@@ -120,7 +120,7 @@ config USB_MUSB_MEDIATEK tristate "MediaTek platforms" depends on ARCH_MEDIATEK || COMPILE_TEST depends on NOP_USB_XCEIV - depends on GENERIC_PHY + select GENERIC_PHY select USB_ROLE_SWITCH comment "MUSB DMA mode"
Signature · 9 lines
2.33.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Greg Kroah-Hartman
maintainerPATCH 5/849 Input: i8042 - Add quirk for Fujitsu Lifebook T725
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 16e28abb7290c4ca3b3a0f333ba067f34bb18c86 upstream.
Fujitsu Lifebook T725 laptop requires, like a few other similar models, the nomux and notimeout options to probe the touchpad properly. This patch adds the corresponding quirk entries.
--- drivers/input/serio/i8042-x86ia64io.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +14 -0
@@ -273,6 +273,13 @@ static const struct dmi_system_id __init }, }, { +/* Fujitsu Lifebook T725 laptop */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"FUJITSU" ), + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T725"), + }, + }, + {/* Fujitsu Lifebook U745 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
@@ -841,6 +848,13 @@ static const struct dmi_system_id __init }, }, { +/* Fujitsu Lifebook T725 laptop */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"FUJITSU" ), + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T725"), + }, + }, + {/* Fujitsu U574 laptop */ /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */ .matches = {
Greg Kroah-Hartman
maintainerPATCH 24/849 media: rkvdec: Do not override sizeimage for output format
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
commit 298d8e8f7bcf023aceb60232d59b983255fec0df upstream.
The rkvdec H.264 decoder currently overrides sizeimage for the output format. This causes issues when userspace requires and requests a larger buffer, but ends up with one of insufficient size.
Instead, only provide a default size if none was requested. This fixes the video_decode_accelerator_tests from Chromium failing on the first frame due to insufficient buffer space. It also aligns the behavior of the rkvdec driver with the Hantro and Cedrus drivers.
--- drivers/staging/media/rkvdec/rkvdec-h264.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/media/rkvdec/rkvdec-h264.c +3 -2
@@ -1015,8 +1015,9 @@ static int rkvdec_h264_adjust_fmt(structstruct v4l2_pix_format_mplane *fmt = &f->fmt.pix_mp; fmt->num_planes =1 ; - fmt->plane_fmt[0 ].sizeimage = fmt->width * fmt->height * -RKVDEC_H264_MAX_DEPTH_IN_BYTES ; +if (!fmt->plane_fmt[0 ].sizeimage) + fmt->plane_fmt[0 ].sizeimage = fmt->width * fmt->height * +RKVDEC_H264_MAX_DEPTH_IN_BYTES ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 25/849 media: ite-cir: IR receiver stop working after receive overflow
In reply to Greg Kroah-HartmanFrom: Sean Young <[email protected]>
commit fdc881783099c6343921ff017450831c8766d12a upstream.
On an Intel NUC6iSYK, no IR is reported after a receive overflow.
When a receiver overflow occurs, this condition is only cleared by reading the fifo. Make sure we read anything in the fifo.
--- drivers/media/rc/ite-cir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/ite-cir.c +1 -1
@@ -242,7 +242,7 @@ static irqreturn_t ite_cir_isr(int irq, }/* check for the receive interrupt */ -if (iflags &ITE_IRQ_RX_FIFO ) { +if (iflags & (ITE_IRQ_RX_FIFO |ITE_IRQ_RX_FIFO_OVERRUN )) {/* read the FIFO bytes */ rx_bytes = dev->params->get_rx_bytes (dev, rx_buf,ITE_RX_FIFO_LEN );
Greg Kroah-Hartman
maintainerPATCH 26/849 media: rkvdec: Support dynamic resolution changes
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
commit 0887e9e152efbd3601d6c907e90033d25067277d upstream.
The mem-to-mem stateless decoder API specifies support for dynamic resolution changes. In particular, the decoder should accept format changes on the OUTPUT queue even when buffers have been allocated, as long as it is not streaming.
Relax restrictions for S_FMT as described in the previous paragraph, and as long as the codec format remains the same. This aligns it with the Hantro and Cedrus decoders. This change was mostly based on commit ae02d49493b5 ("media: hantro: Fix s_fmt for dynamic resolution changes").
Since rkvdec_s_fmt() is now just a wrapper around the output/capture variants without any additional shared functionality, drop the wrapper and call the respective functions directly.
--- drivers/staging/media/rkvdec/rkvdec.c | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/staging/media/rkvdec/rkvdec.c +20 -20
@@ -280,31 +280,20 @@ static int rkvdec_try_output_fmt(structreturn 0 ; } -static int rkvdec_s_fmt (struct file *file,void *priv, -struct v4l2_format *f, -int (*try_fmt)(struct file *,void *, -struct v4l2_format *)) +static int rkvdec_s_capture_fmt (struct file *file,void *priv, +struct v4l2_format *f) {struct rkvdec_ctx *ctx =fh_to_rkvdec_ctx (priv);struct vb2_queue *vq; +int ret; -if (!try_fmt) -return -EINVAL ; - - vq =v4l2_m2m_get_vq (ctx->fh.m2m_ctx, f->type); +/* Change not allowed if queue is busy */ + vq =v4l2_m2m_get_vq (ctx->fh.m2m_ctx, +V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE );if (vb2_is_busy (vq))return -EBUSY ; -return try_fmt (file, priv, f); -} - -static int rkvdec_s_capture_fmt (struct file *file,void *priv, -struct v4l2_format *f) -{ -struct rkvdec_ctx *ctx =fh_to_rkvdec_ctx (priv); -int ret; - - ret =rkvdec_s_fmt (file, priv, f, rkvdec_try_capture_fmt); + ret =rkvdec_try_capture_fmt (file, priv, f);if (ret)return ret;
@@ -319,10 +308,21 @@ static int rkvdec_s_output_fmt(struct fistruct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx;const struct rkvdec_coded_fmt_desc *desc;struct v4l2_format *cap_fmt; -struct vb2_queue *peer_vq; +struct vb2_queue *peer_vq, *vq;int ret;/* +* In order to support dynamic resolution change, the decoder admits +* a resolution change, as long as the pixelformat remains. Can't be +* done if streaming. +*/ + vq =v4l2_m2m_get_vq (m2m_ctx,V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ); +if (vb2_is_streaming (vq) || + (vb2_is_busy (vq) && + f->fmt.pix_mp.pixelformat != ctx->coded_fmt.fmt.pix_mp.pixelformat)) +return -EBUSY ; + +/* * Since format change on the OUTPUT queue will reset the CAPTURE * queue, we can't allow doing so when the CAPTURE queue has buffers * allocated.
@@ -331,7 +331,7 @@ static int rkvdec_s_output_fmt(struct fiif (vb2_is_busy (peer_vq))return -EBUSY ; - ret =rkvdec_s_fmt (file, priv, f, rkvdec_try_output_fmt); + ret =rkvdec_try_output_fmt (file, priv, f);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 29/849 ALSA: hda/realtek: Fix mic mute LED for the HP Spectre x360 14
In reply to Greg Kroah-HartmanFrom: Johnathon Clark <[email protected]>
commit 5fc462c3aaad601d5089fd5588a5799896a6937d upstream.
On the 'HP Spectre x360 Convertible 14-ea0xx' the microphone mute led is controlled by GPIO 0x04. The speaker mute LED does not seem to be exposed by GPIO and is there not set.
[ a slight coding-style fix by tiwai ]
--- sound/pci/hda/patch_realtek.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
sound/pci/hda/patch_realtek.c +17 -0
@@ -4367,6 +4367,16 @@ static void alc287_fixup_hp_gpio_led(stralc_fixup_hp_gpio_led (codec, action,0x10 ,0 ); } +static void alc245_fixup_hp_gpio_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) + spec->micmute_led_polarity =1 ; +alc_fixup_hp_gpio_led (codec, action,0 ,0x04 ); +} +/* turn on/off mic-mute LED per capture hook via VREF change */ static int vref_micmute_led_set (struct led_classdev *led_cdev,enum led_brightness brightness)
@@ -6683,6 +6693,7 @@ enum {ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK ,ALC287_FIXUP_HP_GPIO_LED ,ALC256_FIXUP_HP_HEADSET_MIC , +ALC245_FIXUP_HP_GPIO_LED ,ALC236_FIXUP_DELL_AIO_HEADSET_MIC ,ALC282_FIXUP_ACER_DISABLE_LINEOUT , ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
@@ -7307,6 +7318,8 @@ static const struct hda_fixup alc269_fix [ALC245_FIXUP_HP_X360_AMP] = { .type = HDA_FIXUP_FUNC, .v.func = alc245_fixup_hp_x360_amp, + .chained = true, + .chain_id =ALC245_FIXUP_HP_GPIO_LED }, [ALC288_FIXUP_DELL_HEADSET_MODE] = { .type = HDA_FIXUP_FUNC,
@@ -8402,6 +8415,10 @@ static const struct hda_fixup alc269_fix .type = HDA_FIXUP_FUNC, .v.func = alc256_fixup_tongfang_reset_persistent_settings, }, + [ALC245_FIXUP_HP_GPIO_LED] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc245_fixup_hp_gpio_led, + }, }; static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Greg Kroah-Hartman
maintainerPATCH 6/849 libata: fix read log timeout value
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit 68dbbe7d5b4fde736d104cbbc9a2fce875562012 upstream.
Some ATA drives are very slow to respond to READ_LOG_EXT and READ_LOG_DMA_EXT commands issued from ata_dev_configure() when the device is revalidated right after resuming a system or inserting the ATA adapter driver (e.g. ahci). The default 5s timeout (ATA_EH_CMD_DFL_TIMEOUT) used for these commands is too short, causing errors during the device configuration. Ex:
...
ata9: SATA max UDMA/133 abar m524288@0x9d200000 port 0x9d200400 irq 209
ata9: SATA link up 6.0 Gbps (SStatus 133 SControl 300) ata9.00: ATA-9: XXX XXXXXXXXXXXXXXX, XXXXXXXX, max UDMA/133 ata9.00: qc timeout (cmd 0x2f)
ata9.00: Read log page 0x00 failed, Emask 0x4
ata9.00: Read log page 0x00 failed, Emask 0x40
ata9.00: NCQ Send/Recv Log not supported
ata9.00: Read log page 0x08 failed, Emask 0x40
ata9.00: 27344764928 sectors, multi 16: LBA48 NCQ (depth 32), AA ata9.00: Read log page 0x00 failed, Emask 0x40
ata9.00: ATA Identify Device Log not supported
ata9.00: failed to set xfermode (err_mask=0x40)
ata9: SATA link up 6.0 Gbps (SStatus 133 SControl 300) ata9.00: configured for UDMA/133
...
The timeout error causes a soft reset of the drive link, followed in most cases by a successful revalidation as that give enough time to the drive to become fully ready to quickly process the read log commands. However, in some cases, this also fails resulting in the device being dropped.
Fix this by using adding the ata_eh_revalidate_timeouts entries for the READ_LOG_EXT and READ_LOG_DMA_EXT commands. This defines a timeout increased to 15s, retriable one time.
--- drivers/ata/libata-eh.c | 8 ++++++++ include/linux/libata.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/ata/libata-eh.c +8 -0
@@ -93,6 +93,12 @@ static const unsigned long ata_eh_identi ULONG_MAX, }; +static const unsigned long ata_eh_revalidate_timeouts[] = { +15000 ,/* Some drives are slow to read log pages when waking-up */ +15000 ,/* combined time till here is enough even for media access */ +ULONG_MAX , +}; +static const unsigned long ata_eh_flush_timeouts[] = {15000 ,/* be generous with flush */ 15000 ,/* ditto */
@@ -129,6 +135,8 @@ static const struct ata_eh_cmd_timeout_e ata_eh_cmd_timeout_table[ATA_EH_CMD_TIMEOUT_TABLE_SIZE] = { { .commands = CMDS(ATA_CMD_ID_ATA, ATA_CMD_ID_ATAPI), .timeouts = ata_eh_identify_timeouts, }, + { .commands = CMDS(ATA_CMD_READ_LOG_EXT, ATA_CMD_READ_LOG_DMA_EXT), + .timeouts = ata_eh_revalidate_timeouts, }, { .commands = CMDS(ATA_CMD_READ_NATIVE_MAX, ATA_CMD_READ_NATIVE_MAX_EXT), .timeouts = ata_eh_other_timeouts, }, { .commands = CMDS(ATA_CMD_SET_MAX, ATA_CMD_SET_MAX_EXT),
include/linux/libata.h +1 -1
@@ -390,7 +390,7 @@ enum {/* This should match the actual table size of * ata_eh_cmd_timeout_table in libata-eh.c. */ - ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 6, + ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 7,/* Horkage types. May be set by libata or controller on drives (some horkage may be drive/controller pair dependent */
Greg Kroah-Hartman
maintainerPATCH 8/849 scsi: core: Avoid leaving shost->last_reset with stale value if EH does not run
In reply to Greg Kroah-HartmanFrom: Ewan D. Milne <[email protected]>
commit 5ae17501bc62a49b0b193dcce003f16375f16654 upstream.
The changes to issue the abort from the scmd->abort_work instead of the EH thread introduced a problem if eh_deadline is used. If aborting the command(s) is successful, and there are never any scmds added to the shost->eh_cmd_q, there is no code path which will reset the ->last_reset value back to zero.
The effect of this is that after a successful abort with no EH thread activity, a subsequent timeout, perhaps a long time later, might immediately be considered past a user-set eh_deadline time, and the host will be reset with no attempt at recovery.
Fix this by resetting ->last_reset back to zero in scmd_eh_abort_handler() if it is determined that the EH thread will not run to do this.
Thanks to Gopinath Marappan for investigating this problem.
--- drivers/scsi/hosts.c | 1 + drivers/scsi/scsi_error.c | 25 +++++++++++++++++++++++++ drivers/scsi/scsi_lib.c | 1 + include/scsi/scsi_cmnd.h | 2 +- include/scsi/scsi_host.h | 1 + 5 files changed, 29 insertions(+), 1 deletion(-)
drivers/scsi/hosts.c +1 -0
@@ -388,6 +388,7 @@ struct Scsi_Host *scsi_host_alloc(struct shost->shost_state =SHOST_CREATED ;INIT_LIST_HEAD (&shost->__devices);INIT_LIST_HEAD (&shost->__targets); +INIT_LIST_HEAD (&shost->eh_abort_list);INIT_LIST_HEAD (&shost->eh_cmd_q);INIT_LIST_HEAD (&shost->starved_list);init_waitqueue_head (&shost->host_wait);
drivers/scsi/scsi_error.c +25 -0
@@ -135,6 +135,23 @@ static bool scsi_eh_should_retry_cmd(strreturn true; } +static void scsi_eh_complete_abort (struct scsi_cmnd *scmd,struct Scsi_Host *shost) +{ +unsigned long flags; + +spin_lock_irqsave (shost->host_lock, flags); +list_del_init (&scmd->eh_entry); +/* +* If the abort succeeds, and there is no further +* EH action, clear the ->last_reset time. +*/ +if (list_empty (&shost->eh_abort_list) && +list_empty (&shost->eh_cmd_q)) +if (shost->eh_deadline !=-1 ) + shost->last_reset =0 ; +spin_unlock_irqrestore (shost->host_lock, flags); +} +/** * scmd_eh_abort_handler - Handle command aborts * @work: command to be aborted.
@@ -152,6 +169,7 @@ scmd_eh_abort_handler(struct work_struct container_of(work, struct scsi_cmnd, abort_work.work);struct scsi_device *sdev = scmd->device;enum scsi_disposition rtn; +unsigned long flags;if (scsi_host_eh_past_deadline (sdev->host)) { SCSI_LOG_ERROR_RECOVERY(3,
@@ -175,12 +193,14 @@ scmd_eh_abort_handler(struct work_structSCSI_LOG_ERROR_RECOVERY (3 ,scmd_printk (KERN_WARNING , scmd,"retry aborted command\n" )); +scsi_eh_complete_abort (scmd, sdev->host);scsi_queue_insert (scmd,SCSI_MLQUEUE_EH_RETRY );return ; }else {SCSI_LOG_ERROR_RECOVERY (3 ,scmd_printk (KERN_WARNING , scmd,"finish aborted command\n" )); +scsi_eh_complete_abort (scmd, sdev->host);scsi_finish_command (scmd);return ; }
@@ -193,6 +213,9 @@ scmd_eh_abort_handler(struct work_struct } } +spin_lock_irqsave (sdev->host->host_lock, flags); +list_del_init (&scmd->eh_entry); +spin_unlock_irqrestore (sdev->host->host_lock, flags);scsi_eh_scmd_add (scmd); }
@@ -223,6 +246,8 @@ scsi_abort_command(struct scsi_cmnd *scmspin_lock_irqsave (shost->host_lock, flags);if (shost->eh_deadline !=-1 && !shost->last_reset) shost->last_reset = jiffies; +BUG_ON (!list_empty (&scmd->eh_entry)); +list_add_tail (&scmd->eh_entry, &shost->eh_abort_list);spin_unlock_irqrestore (shost->host_lock, flags); scmd->eh_eflags |=SCSI_EH_ABORT_SCHEDULED ;
drivers/scsi/scsi_lib.c +1 -0
@@ -1136,6 +1136,7 @@ void scsi_init_command(struct scsi_devic cmd->sense_buffer = buf; cmd->prot_sdb = prot; cmd->flags = flags; +INIT_LIST_HEAD (&cmd->eh_entry);INIT_DELAYED_WORK (&cmd->abort_work, scmd_eh_abort_handler); cmd->jiffies_at_alloc = jiffies_at_alloc; cmd->retries = retries;
include/scsi/scsi_cmnd.h +1 -1
@@ -68,7 +68,7 @@ struct scsi_pointer {struct scsi_cmnd {struct scsi_request req;struct scsi_device *device; -struct list_head eh_entry;/* entry for the host eh_cmd_q */ +struct list_head eh_entry;/* entry for the host eh_abort_list/eh_cmd_q */ struct delayed_work abort_work;struct rcu_head rcu;
include/scsi/scsi_host.h +1 -0
@@ -556,6 +556,7 @@ struct Scsi_Host {struct mutex scan_mutex;/* serialize scanning activity */ +struct list_head eh_abort_list;struct list_head eh_cmd_q;struct task_struct * ehandler;/* Error recovery thread. */ struct completion * eh_action;/* Wait for specific actions on the
Greg Kroah-Hartman
maintainerPATCH 52/849 x86/sme: Use #define USE_EARLY_PGTABLE_L5 in mem_encrypt_identity.c
In reply to Greg Kroah-HartmanFrom: Tom Lendacky <[email protected]>
commit e7d445ab26db833d6640d4c9a08bee176777cc82 upstream.
When runtime support for converting between 4-level and 5-level pagetables was added to the kernel, the SME code that built pagetables was updated to use the pagetable functions, e.g. p4d_offset(), etc., in order to simplify the code. However, the use of the pagetable functions in early boot code requires the use of the USE_EARLY_PGTABLE_L5 #define in order to ensure that the proper definition of pgtable_l5_enabled() is used.
Without the #define, pgtable_l5_enabled() is #defined as cpu_feature_enabled(X86_FEATURE_LA57). In early boot, the CPU features have not yet been discovered and populated, so pgtable_l5_enabled() will return false even when 5-level paging is enabled. This causes the SME code to always build 4-level pagetables to perform the in-place encryption. If 5-level paging is enabled, switching to the SME pagetables results in a page-fault that kills the boot.
Adding the #define results in pgtable_l5_enabled() using the __pgtable_l5_enabled variable set in early boot and the SME code building pagetables for the proper paging level.
--- arch/x86/mm/mem_encrypt_identity.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/x86/mm/mem_encrypt_identity.c +9 -0
@@ -27,6 +27,15 @@#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKS +/* +* This code runs before CPU feature bits are set. By default, the +* pgtable_l5_enabled() function uses bit X86_FEATURE_LA57 to determine if +* 5-level paging is active, so that won't work here. USE_EARLY_PGTABLE_L5 +* is provided to handle this situation and, instead, use a variable that +* has been set by the early boot code. +*/ +#define USE_EARLY_PGTABLE_L5 +#include <linux/kernel.h> #include <linux/mm.h> #include <linux/mem_encrypt.h>
Greg Kroah-Hartman
maintainerPATCH 56/849 KVM: arm64: Report corrupted refcount at EL2
In reply to Greg Kroah-HartmanFrom: Quentin Perret <[email protected]>
[ Upstream commit 7615c2a514788559c6684234b8fc27f3a843c2c6 ]
Some of the refcount manipulation helpers used at EL2 are instrumented to catch a corrupted state, but not all of them are treated equally. Let's make things more consistent by instrumenting hyp_page_ref_dec_and_test() as well.
--- arch/arm64/kvm/hyp/nvhe/page_alloc.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kvm/hyp/nvhe/page_alloc.c +1 -0
@@ -152,6 +152,7 @@ static inline void hyp_page_ref_inc(struct hyp_page *p)static inline int hyp_page_ref_dec_and_test (struct hyp_page *p) { +BUG_ON (!p->refcount); p->refcount--;return (p->refcount ==0 ); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 57/849 ASoC: soc-core: fix null-ptr-deref in snd_soc_del_component_unlocked()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit c448b7aa3e66042fc0f849d9a0fb90d1af82e948 ]
'component' is allocated in snd_soc_register_component(), but component->list is not initalized, this may cause snd_soc_del_component_unlocked() deref null ptr in the error handing case.
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] RIP: 0010:__list_del_entry_valid+0x81/0xf0 Call Trace: snd_soc_del_component_unlocked+0x69/0x1b0 [snd_soc_core] snd_soc_add_component.cold+0x54/0x6c [snd_soc_core] snd_soc_register_component+0x70/0x90 [snd_soc_core] devm_snd_soc_register_component+0x5e/0xd0 [snd_soc_core] tas2552_probe+0x265/0x320 [snd_soc_tas2552] ? tas2552_component_probe+0x1e0/0x1e0 [snd_soc_tas2552] i2c_device_probe+0xa31/0xbe0
Fix by adding INIT_LIST_HEAD() to snd_soc_component_initialize().
--- sound/soc/soc-core.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/soc-core.c +1 -0
@@ -2599,6 +2599,7 @@ int snd_soc_component_initialize(struct snd_soc_component *component,INIT_LIST_HEAD (&component->dai_list);INIT_LIST_HEAD (&component->dobj_list);INIT_LIST_HEAD (&component->card_list); +INIT_LIST_HEAD (&component->list);mutex_init (&component->io_mutex); component->name =fmt_single_name (dev, &component->id);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 61/849 net: sparx5: Add of_node_put() before goto
In reply to Greg Kroah-HartmanFrom: Wan Jiabing <[email protected]>
[ Upstream commit d9fd7e9fccfac466fb528a783f2fc76f2982604c ]
Fix following coccicheck warning:
./drivers/net/ethernet/microchip/sparx5/s4parx5_main.c:723:1-33: WARNING: Function for_each_available_child_of_node should have of_node_put() before goto
Early exits from for_each_available_child_of_node should decrement the node reference counter.
--- drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/microchip/sparx5/sparx5_main.c +1 -0
@@ -743,6 +743,7 @@ static int mchp_sparx5_probe(struct platform_device *pdev) err =dev_err_probe (sparx5->dev,PTR_ERR (serdes),"port %u: missing serdes\n" , portno); +of_node_put (portnp); goto cleanup_config; } config->portno = portno;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 34/849 ALSA: hda/realtek: Add quirk for ASUS UX550VE
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 4fad4fb9871b43389e4f4bead18ec693064697bb upstream.
ASUS UX550VE (SSID 1043:1970) requires a similar workaround for managing the routing of the 4 speakers like some other ASUS models. Add a corresponding quirk entry for fixing it.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -8666,6 +8666,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1043 ,0x18b1 ,"Asus MJ401TA" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x18f1 ,"Asus FX505DT" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x194e ,"ASUS UX563FD" ,ALC294_FIXUP_ASUS_HPE ), +SND_PCI_QUIRK (0x1043 ,0x1970 ,"ASUS UX550VE" ,ALC289_FIXUP_ASUS_GA401 ),SND_PCI_QUIRK (0x1043 ,0x1982 ,"ASUS B1400CEPE" ,ALC256_FIXUP_ASUS_HPE ),SND_PCI_QUIRK (0x1043 ,0x19ce ,"ASUS B9450FA" ,ALC294_FIXUP_ASUS_HPE ), SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 35/849 ALSA: hda/realtek: Add quirk for HP EliteBook 840 G7 mute LED
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
commit c058493df7edcef8f48c1494d9a84218519f966b upstream.
The mute and micmute LEDs don't work on HP EliteBook 840 G7. The same quirk for other HP laptops can let LEDs work, so apply it.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -8606,6 +8606,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x103c ,0x8716 ,"HP Elite Dragonfly G2 Notebook PC" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x8720 ,"HP EliteBook x360 1040 G8 Notebook PC" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x8724 ,"HP EliteBook 850 G7" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8728 ,"HP EliteBook 840 G7" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8729 ,"HP" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8730 ,"HP ProBook 445 G7" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ), SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Greg Kroah-Hartman
maintainerPATCH 65/849 scsi: qla2xxx: Fix unmap of already freed sgl
In reply to Greg Kroah-HartmanFrom: Dmitry Bogdanov <[email protected]>
[ Upstream commit 4a8f71014b4d56c4fb287607e844c0a9f68f46d9 ]
The sgl is freed in the target stack in target_release_cmd_kref() before calling qlt_free_cmd() but there is an unmap of sgl in qlt_free_cmd() that causes a panic if sgl is not yet DMA unmapped:
NIP dma_direct_unmap_sg+0xdc/0x180
LR dma_direct_unmap_sg+0xc8/0x180
Call Trace: ql_dbg_prefix+0x68/0xc0 [qla2xxx] (unreliable) dma_unmap_sg_attrs+0x54/0xf0 qlt_unmap_sg.part.19+0x54/0x1c0 [qla2xxx] qlt_free_cmd+0x124/0x1d0 [qla2xxx] tcm_qla2xxx_release_cmd+0x4c/0xa0 [tcm_qla2xxx] target_put_sess_cmd+0x198/0x370 [target_core_mod] transport_generic_free_cmd+0x6c/0x1b0 [target_core_mod] tcm_qla2xxx_complete_free+0x6c/0x90 [tcm_qla2xxx]
The sgl may be left unmapped in error cases of response sending. For instance, qlt_rdy_to_xfer() maps sgl and exits when session is being deleted keeping the sgl mapped.
This patch removes use-after-free of the sgl and ensures that the sgl is unmapped for any command that was not sent to firmware.
--- drivers/scsi/qla2xxx/qla_target.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +5 -9
@@ -3261,8 +3261,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type,"RESET-RSP online/active/old-count/new-count = %d/%d/%d/%d.\n" , vha->flags.online,qla2x00_reset_active (vha), cmd->reset_count, qpair->chip_reset); -spin_unlock_irqrestore (qpair->qp_lock_ptr, flags); -return 0 ; + goto out_unmap_unlock; }/* Does F/W have an IOCBs for this request */
@@ -3385,10 +3384,6 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd) prm.sg =NULL ; prm.req_cnt =1 ; -/* Calculate number of entries and segments required */ -if (qlt_pci_map_calc_cnt (&prm) !=0 ) -return -EAGAIN ; -if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) || (cmd->sess && cmd->sess->deleted)) {/*
@@ -3406,6 +3401,10 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd)return 0 ; } +/* Calculate number of entries and segments required */ +if (qlt_pci_map_calc_cnt (&prm) !=0 ) +return -EAGAIN ; +spin_lock_irqsave (qpair->qp_lock_ptr, flags);/* Does F/W have an IOCBs for this request */ res =qlt_check_reserve_free_req (qpair, prm.req_cnt);
@@ -3810,9 +3809,6 @@ void qlt_free_cmd(struct qla_tgt_cmd *cmd)BUG_ON (cmd->cmd_in_wq); -if (cmd->sg_mapped) -qlt_unmap_sg (cmd->vha, cmd); -if (!cmd->q_full)qlt_decr_num_pend_cmds (cmd->vha);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 81/849 gpio: mlxbf2.c: Add check for bgpio_init failure
In reply to Greg Kroah-HartmanFrom: Asmaa Mnebhi <[email protected]>
[ Upstream commit c0eee6fbfa2b3377f1efed10dad539abeb7312aa ]
Add a check if bgpio_init fails.
--- drivers/gpio/gpio-mlxbf2.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpio/gpio-mlxbf2.c +5 -0
@@ -268,6 +268,11 @@ mlxbf2_gpio_probe(struct platform_device *pdev)NULL , 0); +if (ret) { +dev_err (dev,"bgpio_init failed\n" ); +return ret; + } + gc->direction_input = mlxbf2_gpio_direction_input; gc->direction_output = mlxbf2_gpio_direction_output; gc->ngpio = npins;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 83/849 nvmet-tcp: fix a memory leak when releasing a queue
In reply to Greg Kroah-HartmanFrom: Maurizio Lombardi <[email protected]>
[ Upstream commit 926245c7d22271307606c88b1fbb2539a8550e94 ]
page_frag_free() won't completely release the memory allocated for the commands, the cache page must be explicitly freed by calling __page_frag_cache_drain().
This bug can be easily reproduced by repeatedly executing the following command on the initiator:
$echo 1 > /sys/devices/virtual/nvme-fabrics/ctl/nvme0/reset_controller
--- drivers/nvme/target/tcp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/target/tcp.c +3 -0
@@ -1428,6 +1428,7 @@ static void nvmet_tcp_uninit_data_in_cmds(struct nvmet_tcp_queue *queue)static void nvmet_tcp_release_queue_work (struct work_struct *w) { +struct page *page;struct nvmet_tcp_queue *queue = container_of(w, struct nvmet_tcp_queue, release_work);
@@ -1447,6 +1448,8 @@ static void nvmet_tcp_release_queue_work(struct work_struct *w)nvmet_tcp_free_crypto (queue);ida_simple_remove (&nvmet_tcp_queue_ida, queue->idx); + page =virt_to_head_page (queue->pf_cache.va); +__page_frag_cache_drain (page, queue->pf_cache.pagecnt_bias);kfree (queue); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 84/849 spi: spl022: fix Microwire full duplex mode
In reply to Greg Kroah-HartmanFrom: Thomas Perrot <[email protected]>
[ Upstream commit d81d0e41ed5fe7229a2c9a29d13bad288c7cf2d2 ]
There are missing braces in the function that verify controller parameters, then an error is always returned when the parameter to select Microwire frames operation is used on devices allowing it.
--- drivers/spi/spi-pl022.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/spi-pl022.c +3 -2
@@ -1716,12 +1716,13 @@ static int verify_controller_parameters(struct pl022 *pl022,return -EINVAL ; } }else { -if (chip_info->duplex !=SSP_MICROWIRE_CHANNEL_FULL_DUPLEX ) +if (chip_info->duplex !=SSP_MICROWIRE_CHANNEL_FULL_DUPLEX ) {dev_err (&pl022->adev->dev,"Microwire half duplex mode requested," " but this is only available in the" " ST version of PL022\n" ); -return -EINVAL ; +return -EINVAL ; + } } }return 0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 82/849 xen/netfront: stop tx queues during live migration
In reply to Greg Kroah-HartmanFrom: Dongli Zhang <[email protected]>
[ Upstream commit 042b2046d0f05cf8124c26ff65dbb6148a4404fb ]
The tx queues are not stopped during the live migration. As a result, the ndo_start_xmit() may access netfront_info->queues which is freed by talk_to_netback()->xennet_destroy_queues().
This patch is to netif_device_detach() at the beginning of xen-netfront resuming, and netif_device_attach() at the end of resuming.
CPU A CPU B
talk_to_netback()
-> if (info->queues)
xennet_destroy_queues(info);
to free netfront_info->queues
xennet_start_xmit()
to access netfront_info->queues-> err = xennet_create_queues(info, &num_queues);
The idea is borrowed from virtio-net.
--- drivers/net/xen-netfront.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/xen-netfront.c +8 -0
@@ -1669,6 +1669,10 @@ static int netfront_resume(struct xenbus_device *dev)dev_dbg (&dev->dev,"%s\n" , dev->nodename); +netif_tx_lock_bh (info->netdev); +netif_device_detach (info->netdev); +netif_tx_unlock_bh (info->netdev); +xennet_disconnect_backend (info);return 0 ; }
@@ -2283,6 +2287,10 @@ static int xennet_connect(struct net_device *dev)* domain a kick because we've probably just requeued some * packets. */ +netif_tx_lock_bh (np->netdev); +netif_device_attach (np->netdev); +netif_tx_unlock_bh (np->netdev); +netif_carrier_on (np->netdev);for (j =0 ; j < num_queues; ++j) { queue = &np->queues[j];
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 87/849 drm: panel-orientation-quirks: Add quirk for GPD Win3
In reply to Greg Kroah-HartmanFrom: Mario <[email protected]>
[ Upstream commit 61b1d445f3bfe4c3ba4335ceeb7e8ba688fd31e2 ]
Fixes screen orientation for GPD Win 3 handheld gaming console.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -191,6 +191,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), }, .driver_data = (void *)&gpd_win2, + }, { /* GPD Win 3 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"GPD" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"G1618-03" ) + }, + .driver_data = (void *)&lcd720x1280_rightside_up, }, { /* I.T.Works TW891 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "To be filled by O.E.M."),
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 90/849 net: hns3: change hclge/hclgevf workqueue to WQ_UNBOUND mode
In reply to Greg Kroah-HartmanFrom: Yufeng Mo <[email protected]>
[ Upstream commit f29da4088fb4eeba457219a931327d1d5f45196a ]
Currently, the workqueue of hclge/hclgevf is executed on the CPU that initiates scheduling requests by default. In stress scenarios, the CPU may be busy and workqueue scheduling is completed after a long period of time. To avoid this situation and implement proper scheduling, use the WQ_UNBOUND mode instead. In this way, the workqueue can be performed on a relatively idle CPU.
--- .../hisilicon/hns3/hns3pf/hclge_main.c | 34 +++---------------- .../hisilicon/hns3/hns3pf/hclge_main.h | 1 - .../hisilicon/hns3/hns3vf/hclgevf_main.c | 2 +- 3 files changed, 6 insertions(+), 31 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +5 -29
@@ -2846,33 +2846,28 @@ static void hclge_mbx_task_schedule(struct hclge_dev *hdev) {if (!test_bit (HCLGE_STATE_REMOVING , &hdev->state) && !test_and_set_bit (HCLGE_STATE_MBX_SERVICE_SCHED , &hdev->state)) -mod_delayed_work_on (cpumask_first (&hdev->affinity_mask), - hclge_wq, &hdev->service_task,0 ); +mod_delayed_work (hclge_wq, &hdev->service_task,0 ); }static void hclge_reset_task_schedule (struct hclge_dev *hdev) {if (!test_bit (HCLGE_STATE_REMOVING , &hdev->state) && !test_and_set_bit (HCLGE_STATE_RST_SERVICE_SCHED , &hdev->state)) -mod_delayed_work_on (cpumask_first (&hdev->affinity_mask), - hclge_wq, &hdev->service_task,0 ); +mod_delayed_work (hclge_wq, &hdev->service_task,0 ); }static void hclge_errhand_task_schedule (struct hclge_dev *hdev) {if (!test_bit (HCLGE_STATE_REMOVING , &hdev->state) && !test_and_set_bit (HCLGE_STATE_ERR_SERVICE_SCHED , &hdev->state)) -mod_delayed_work_on (cpumask_first (&hdev->affinity_mask), - hclge_wq, &hdev->service_task,0 ); +mod_delayed_work (hclge_wq, &hdev->service_task,0 ); }void hclge_task_schedule (struct hclge_dev *hdev,unsigned long delay_time) {if (!test_bit (HCLGE_STATE_REMOVING , &hdev->state) && !test_bit (HCLGE_STATE_RST_FAIL , &hdev->state)) -mod_delayed_work_on (cpumask_first (&hdev->affinity_mask), - hclge_wq, &hdev->service_task, - delay_time); +mod_delayed_work (hclge_wq, &hdev->service_task, delay_time); }static int hclge_get_mac_link_status (struct hclge_dev *hdev,int *link_status)
@@ -3490,33 +3485,14 @@ static void hclge_get_misc_vector(struct hclge_dev *hdev) hdev->num_msi_used +=1 ; } -static void hclge_irq_affinity_notify (struct irq_affinity_notify *notify, -const cpumask_t *mask) -{ - struct hclge_dev *hdev = container_of(notify, struct hclge_dev, - affinity_notify); - -cpumask_copy (&hdev->affinity_mask, mask); -} - -static void hclge_irq_affinity_release (struct kref *ref) -{ -} -static void hclge_misc_affinity_setup (struct hclge_dev *hdev) {irq_set_affinity_hint (hdev->misc_vector.vector_irq, &hdev->affinity_mask); - - hdev->affinity_notify.notify = hclge_irq_affinity_notify; - hdev->affinity_notify.release = hclge_irq_affinity_release; -irq_set_affinity_notifier (hdev->misc_vector.vector_irq, - &hdev->affinity_notify); }static void hclge_misc_affinity_teardown (struct hclge_dev *hdev) { -irq_set_affinity_notifier (hdev->misc_vector.vector_irq,NULL );irq_set_affinity_hint (hdev->misc_vector.vector_irq,NULL ); }
@@ -13040,7 +13016,7 @@ static int hclge_init(void) {pr_info ("%s is initializing\n" ,HCLGE_NAME ); - hclge_wq =alloc_workqueue ("%s" ,0 ,0 ,HCLGE_NAME ); + hclge_wq =alloc_workqueue ("%s" ,WQ_UNBOUND ,0 ,HCLGE_NAME );if (!hclge_wq) {pr_err ("%s: failed to create workqueue\n" ,HCLGE_NAME );return -ENOMEM ;
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +0 -1
@@ -942,7 +942,6 @@ struct hclge_dev {/* affinity mask and notify for misc interrupt */ cpumask_t affinity_mask; -struct irq_affinity_notify affinity_notify;struct hclge_ptp *ptp; };
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +1 -1
@@ -3890,7 +3890,7 @@ static int hclgevf_init(void) {pr_info ("%s is initializing\n" ,HCLGEVF_NAME ); - hclgevf_wq =alloc_workqueue ("%s" ,0 ,0 ,HCLGEVF_NAME ); + hclgevf_wq =alloc_workqueue ("%s" ,WQ_UNBOUND ,0 ,HCLGEVF_NAME );if (!hclgevf_wq) {pr_err ("%s: failed to create workqueue\n" ,HCLGEVF_NAME );return -ENOMEM ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 86/849 watchdog: Fix OMAP watchdog early handling
In reply to Greg Kroah-HartmanFrom: Walter Stoll <[email protected]>
[ Upstream commit cd004d8299f1dc6cfa6a4eea8f94cb45eaedf070 ]
TI's implementation does not service the watchdog even if the kernel command line parameter omap_wdt.early_enable is set to 1. This patch fixes the issue.
--- drivers/watchdog/omap_wdt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/watchdog/omap_wdt.c +5 -1
@@ -268,8 +268,12 @@ static int omap_wdt_probe(struct platform_device *pdev) wdev->wdog.bootstatus =WDIOF_CARDRESET ; } -if (!early_enable) +if (early_enable) { +omap_wdt_start (&wdev->wdog); +set_bit (WDOG_HW_RUNNING , &wdev->wdog.status); + }else {omap_wdt_disable (wdev); + } ret =watchdog_register_device (&wdev->wdog);if (ret) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 88/849 block: schedule queue restart after BLK_STS_ZONE_RESOURCE
In reply to Greg Kroah-HartmanFrom: Naohiro Aota <[email protected]>
[ Upstream commit 9586e67b911c95ba158fcc247b230e9c2d718623 ]
When dispatching a zone append write request to a SCSI zoned block device, if the target zone of the request is already locked, the device driver will return BLK_STS_ZONE_RESOURCE and the request will be pushed back to the hctx dipatch queue. The queue will be marked as RESTART in dd_finish_request() and restarted in __blk_mq_free_request(). However, this restart applies to the hctx of the completed request. If the requeued request is on a different hctx, dispatch will no be retried until another request is submitted or the next periodic queue run triggers, leading to up to 30 seconds latency for the requeued request.
Fix this problem by scheduling a queue restart similarly to the BLK_STS_RESOURCE case or when we cannot get the budget.
Also, consolidate the checks into the "need_resource" variable to simplify the condition.
--- block/blk-mq.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
block/blk-mq.c +9 -4
@@ -1318,6 +1318,7 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,int errors, queued;blk_status_t ret =BLK_STS_OK ;LIST_HEAD (zone_list); +bool needs_resource = false;if (list_empty (list))return false;
@@ -1363,6 +1364,8 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list, queued++;break ;case BLK_STS_RESOURCE : + needs_resource = true; + fallthrough;case BLK_STS_DEV_RESOURCE :blk_mq_handle_dev_resource (rq, list); goto out;
@@ -1373,6 +1376,7 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,* accept. */ blk_mq_handle_zone_resource (rq, &zone_list); + needs_resource = true;break ;default : errors++;
@@ -1399,7 +1403,6 @@ out:/* For non-shared tags, the RESTART check will suffice */ bool no_tag = prep ==PREP_DISPATCH_NO_TAG && (hctx->flags &BLK_MQ_F_TAG_QUEUE_SHARED ); -bool no_budget_avail = prep ==PREP_DISPATCH_NO_BUDGET ;if (nr_budgets)blk_mq_release_budgets (q, list);
@@ -1440,14 +1443,16 @@ out:* If driver returns BLK_STS_RESOURCE and SCHED_RESTART * bit is set, run queue after a delay to avoid IO stalls * that could otherwise occur if the queue is idle. We'll do -* similar if we couldn't get budget and SCHED_RESTART is set. +* similar if we couldn't get budget or couldn't lock a zone +* and SCHED_RESTART is set. */ needs_restart =blk_mq_sched_needs_restart (hctx); +if (prep ==PREP_DISPATCH_NO_BUDGET ) + needs_resource = true;if (!needs_restart || (no_tag &&list_empty_careful (&hctx->dispatch_wait.entry)))blk_mq_run_hw_queue (hctx, true); -else if (needs_restart && (ret ==BLK_STS_RESOURCE || - no_budget_avail)) +else if (needs_restart && needs_resource)blk_mq_delay_run_hw_queue (hctx,BLK_MQ_RESOURCE_DELAY );blk_mq_update_dispatch_busy (hctx, true);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 89/849 nvmet-tcp: fix header digest verification
In reply to Greg Kroah-HartmanFrom: Amit Engel <[email protected]>
[ Upstream commit 86aeda32b887cdaeb0f4b7bfc9971e36377181c7 ]
Pass the correct length to nvmet_tcp_verify_hdgst, which is the pdu header length. This fixes a wrong behaviour where header digest verification passes although the digest is wrong.
--- drivers/nvme/target/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/tcp.c +1 -1
@@ -1096,7 +1096,7 @@ recv: }if (queue->hdr_digest && -nvmet_tcp_verify_hdgst (queue, &queue->pdu, queue->offset)) { +nvmet_tcp_verify_hdgst (queue, &queue->pdu, hdr->hlen)) {nvmet_tcp_fatal_error (queue);/* fatal */ return -EPROTO ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 91/849 net: hns3: ignore reset event before initialization process is done
In reply to Greg Kroah-HartmanFrom: Guangbin Huang <[email protected]>
[ Upstream commit 0251d196b0e1a19c870be882e5d4f496de8ab758 ]
Currently, if there is a reset event triggered by RAS during device in initialization process, driver may run reset process concurrently with initialization process. In this case, it may cause problem. For example, the RSS indirection table may has not been alloc memory in initialization process yet, but it is used in reset process, it will cause a call trace like this:
[61228.744836] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 ... [61228.897677] Workqueue: hclgevf hclgevf_service_task [hclgevf] [61228.911390] pstate: 40400009 (nZcv daif +PAN -UAO -TCO BTYPE=--) [61228.918670] pc : hclgevf_set_rss_indir_table+0xb4/0x190 [hclgevf] [61228.927812] lr : hclgevf_set_rss_indir_table+0x90/0x190 [hclgevf] [61228.937248] sp : ffff8000162ebb50 [61228.941087] x29: ffff8000162ebb50 x28: ffffb77add72dbc0 x27: ffff0820c7dc8080 [61228.949516] x26: 0000000000000000 x25: ffff0820ad4fc880 x24: ffff0820c7dc8080 [61228.958220] x23: ffff0820c7dc8090 x22: 00000000ffffffff x21: 0000000000000040 [61228.966360] x20: ffffb77add72b9c0 x19: 0000000000000000 x18: 0000000000000030 [61228.974646] x17: 0000000000000000 x16: ffffb77ae713feb0 x15: ffff0820ad4fcce8 [61228.982808] x14: ffffffffffffffff x13: ffff8000962eb7f7 x12: 00003834ec70c960 [61228.991990] x11: 00e0fafa8c206982 x10: 9670facc78a8f9a8 x9 : ffffb77add717530 [61229.001123] x8 : ffff0820ad4fd6b8 x7 : 0000000000000000 x6 : 0000000000000011 [61229.010249] x5 : 00000000000cb1b0 x4 : 0000000000002adb x3 : 0000000000000049 [61229.018662] x2 : ffff8000162ebbb8 x1 : 0000000000000000 x0 : 0000000000000480 [61229.027002] Call trace: [61229.030177] hclgevf_set_rss_indir_table+0xb4/0x190 [hclgevf] [61229.039009] hclgevf_rss_init_hw+0x128/0x1b4 [hclgevf] [61229.046809] hclgevf_reset_rebuild+0x17c/0x69c [hclgevf] [61229.053862] hclgevf_reset_service_task+0x4cc/0xa80 [hclgevf] [61229.061306] hclgevf_service_task+0x6c/0x630 [hclgevf] [61229.068491] process_one_work+0x1dc/0x48c [61229.074121] worker_thread+0x15c/0x464 [61229.078562] kthread+0x168/0x16c [61229.082873] ret_from_fork+0x10/0x18 [61229.088221] Code: 7900e7f6 f904a683 d503201f 9101a3e2 (38616b43) [61229.095357] ---[ end trace 153661a538f6768c ]---
To fix this problem, don't schedule reset task before initialization process is done.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 1 + drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 3 +++ drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h | 1 + 3 files changed, 5 insertions(+)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +1 -0
@@ -2852,6 +2852,7 @@ static void hclge_mbx_task_schedule(struct hclge_dev *hdev)static void hclge_reset_task_schedule (struct hclge_dev *hdev) {if (!test_bit (HCLGE_STATE_REMOVING , &hdev->state) && +test_bit (HCLGE_STATE_SERVICE_INITED , &hdev->state) && !test_and_set_bit (HCLGE_STATE_RST_SERVICE_SCHED , &hdev->state))mod_delayed_work (hclge_wq, &hdev->service_task,0 ); }
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +3 -0
@@ -2230,6 +2230,7 @@ static void hclgevf_get_misc_vector(struct hclgevf_dev *hdev)void hclgevf_reset_task_schedule (struct hclgevf_dev *hdev) {if (!test_bit (HCLGEVF_STATE_REMOVING , &hdev->state) && +test_bit (HCLGEVF_STATE_SERVICE_INITED , &hdev->state) && !test_and_set_bit (HCLGEVF_STATE_RST_SERVICE_SCHED , &hdev->state))mod_delayed_work (hclgevf_wq, &hdev->service_task,0 );
@@ -3443,6 +3444,8 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)hclgevf_init_rxd_adv_layout (hdev); +set_bit (HCLGEVF_STATE_SERVICE_INITED , &hdev->state); + hdev->last_reset_time = jiffies;dev_info (&hdev->pdev->dev,"finished initializing %s driver\n" ,HCLGEVF_DRIVER_NAME );
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h +1 -0
@@ -144,6 +144,7 @@ enum hclgevf_states {HCLGEVF_STATE_REMOVING ,HCLGEVF_STATE_NIC_REGISTERED ,HCLGEVF_STATE_ROCE_REGISTERED , +HCLGEVF_STATE_SERVICE_INITED ,/* task states */ HCLGEVF_STATE_RST_SERVICE_SCHED , HCLGEVF_STATE_RST_HANDLING,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 93/849 vmxnet3: do not stop tx queues after netif_device_detach()
In reply to Greg Kroah-HartmanFrom: Dongli Zhang <[email protected]>
[ Upstream commit 9159f102402a64ac85e676b75cc1f9c62c5b4b73 ]
The netif_device_detach() conditionally stops all tx queues if the queues are running. There is no need to call netif_tx_stop_all_queues() again.
--- drivers/net/vmxnet3/vmxnet3_drv.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/vmxnet3/vmxnet3_drv.c +0 -1
@@ -3749,7 +3749,6 @@ vmxnet3_suspend(struct device *device)vmxnet3_free_intr_resources (adapter);netif_device_detach (netdev); -netif_tx_stop_all_queues (netdev);/* Create wake-up filters. */ pmConf = adapter->pm_conf;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 95/849 net/smc: Fix smc_link->llc_testlink_time overflow
In reply to Greg Kroah-HartmanFrom: Tony Lu <[email protected]>
[ Upstream commit c4a146c7cf5e8ad76231523b174d161bf152c6e7 ]
The value of llc_testlink_time is set to the value stored in net->ipv4.sysctl_tcp_keepalive_time when linkgroup init. The value of sysctl_tcp_keepalive_time is already jiffies, so we don't need to multiply by HZ, which would cause smc_link->llc_testlink_time overflow, and test_link send flood.
--- net/smc/smc_llc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/smc_llc.c +1 -1
@@ -1822,7 +1822,7 @@ void smc_llc_link_active(struct smc_link *link) link->smcibdev->ibdev->name, link->ibport); link->state =SMC_LNK_ACTIVE ;if (link->lgr->llc_testlink_time) { - link->llc_testlink_time = link->lgr->llc_testlink_time *HZ ; + link->llc_testlink_time = link->lgr->llc_testlink_time;schedule_delayed_work (&link->llc_testlink_wrk, link->llc_testlink_time); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 94/849 nfp: bpf: relax prog rejection for mtu check through max_pkt_offset
In reply to Greg Kroah-HartmanFrom: Yu Xiao <[email protected]>
[ Upstream commit 90a881fc352a953f1c8beb61977a2db0818157d4 ]
MTU change is refused whenever the value of new MTU is bigger than the max packet bytes that fits in NFP Cluster Target Memory (CTM). However, an eBPF program doesn't always need to access the whole packet data.
The maximum direct packet access (DPA) offset has always been caculated by verifier and stored in the max_pkt_offset field of prog aux data.
--- drivers/net/ethernet/netronome/nfp/bpf/main.c | 16 +++++++++++----- drivers/net/ethernet/netronome/nfp/bpf/main.h | 2 ++ .../net/ethernet/netronome/nfp/bpf/offload.c | 17 +++++++++++++---- 3 files changed, 26 insertions(+), 9 deletions(-)
drivers/net/ethernet/netronome/nfp/bpf/main.c +11 -5
@@ -182,15 +182,21 @@ static int nfp_bpf_check_mtu(struct nfp_app *app, struct net_device *netdev, int new_mtu) { struct nfp_net *nn = netdev_priv(netdev); -unsigned int max_mtu; +struct nfp_bpf_vnic *bv; +struct bpf_prog *prog;if (~nn->dp.ctrl &NFP_NET_CFG_CTRL_BPF )return 0 ; - max_mtu =nn_readb (nn,NFP_NET_CFG_BPF_INL_MTU ) *64 -32 ; -if (new_mtu > max_mtu) { -nn_info (nn,"BPF offload active, MTU over %u not supported\n" , - max_mtu); +if (nn->xdp_hw.prog) { + prog = nn->xdp_hw.prog; + }else { + bv = nn->app_priv; + prog = bv->tc_prog; + } + +if (nfp_bpf_offload_check_mtu (nn, prog, new_mtu)) { +nn_info (nn,"BPF offload active, potential packet access beyond hardware packet boundary" );return -EBUSY ; }return 0 ;
drivers/net/ethernet/netronome/nfp/bpf/main.h +2 -0
@@ -560,6 +560,8 @@ bool nfp_is_subprog_start(struct nfp_insn_meta *meta);void nfp_bpf_jit_prepare (struct nfp_prog *nfp_prog);int nfp_bpf_jit (struct nfp_prog *prog);bool nfp_bpf_supported_opcode (u8 code); +bool nfp_bpf_offload_check_mtu (struct nfp_net *nn,struct bpf_prog *prog, +unsigned int mtu);int nfp_verify_insn (struct bpf_verifier_env *env,int insn_idx,int prev_insn_idx);
drivers/net/ethernet/netronome/nfp/bpf/offload.c +13 -4
@@ -481,19 +481,28 @@ int nfp_bpf_event_output(struct nfp_app_bpf *bpf, const void *data,return 0 ; } +bool nfp_bpf_offload_check_mtu (struct nfp_net *nn,struct bpf_prog *prog, +unsigned int mtu) +{ +unsigned int fw_mtu, pkt_off; + + fw_mtu =nn_readb (nn,NFP_NET_CFG_BPF_INL_MTU ) *64 -32 ; + pkt_off =min (prog->aux->max_pkt_offset, mtu); + +return fw_mtu < pkt_off; +} +static int nfp_net_bpf_load (struct nfp_net *nn,struct bpf_prog *prog,struct netlink_ext_ack *extack) {struct nfp_prog *nfp_prog = prog->aux->offload->dev_priv; -unsigned int fw_mtu, pkt_off, max_stack, max_prog_len; +unsigned int max_stack, max_prog_len;dma_addr_t dma_addr;void *img;int err; - fw_mtu =nn_readb (nn,NFP_NET_CFG_BPF_INL_MTU ) *64 -32 ; - pkt_off =min (prog->aux->max_pkt_offset, nn->dp.netdev->mtu); -if (fw_mtu < pkt_off) { +if (nfp_bpf_offload_check_mtu (nn, prog, nn->dp.netdev->mtu)) {NL_SET_ERR_MSG_MOD (extack,"BPF offload not supported with potential packet access beyond HW packet split boundary" );return -EOPNOTSUPP ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 92/849 r8169: Add device 10ec:8162 to driver r8169
In reply to Greg Kroah-HartmanFrom: Janghyub Seo <[email protected]>
[ Upstream commit 72f898ca0ab85fde6facf78b14d9f67a4a7b32d1 ]
This patch makes the driver r8169 pick up device Realtek Semiconductor Co. , Ltd. Device [10ec:8162].
--- drivers/net/ethernet/realtek/r8169_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/realtek/r8169_main.c +1 -0
@@ -157,6 +157,7 @@ static const struct pci_device_id rtl8169_pci_tbl[] = { { PCI_VDEVICE(REALTEK, 0x8129) }, { PCI_VDEVICE(REALTEK, 0x8136), RTL_CFG_NO_GBIT }, { PCI_VDEVICE(REALTEK, 0x8161) }, + { PCI_VDEVICE(REALTEK, 0x8162) }, { PCI_VDEVICE(REALTEK, 0x8167) }, { PCI_VDEVICE(REALTEK, 0x8168) }, { PCI_VDEVICE(NCUBE, 0x8168) },
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 97/849 tools/testing/selftests/vm/split_huge_page_test.c: fix application of sizeof to pointer
In reply to Greg Kroah-HartmanFrom: David Yang <[email protected]>
[ Upstream commit 9c7516d669e68e94e17203469a873ff5d1d3a41a ]
The coccinelle check report:
./tools/testing/selftests/vm/split_huge_page_test.c:344:36-42:
ERROR: application of sizeof to pointer
Use "strlen" to fix it.
--- tools/testing/selftests/vm/split_huge_page_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/vm/split_huge_page_test.c +1 -1
@@ -341,7 +341,7 @@ void split_file_backed_thp(void) }/* write something to the file, so a file-backed THP can be allocated */ - num_written =write (fd, tmpfs_loc,sizeof (tmpfs_loc)); + num_written =write (fd, tmpfs_loc,strlen (tmpfs_loc) +1 );close (fd);if (num_written <1 ) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 98/849 btrfs: clear MISSING device status bit in btrfs_close_one_device
In reply to Greg Kroah-HartmanFrom: Li Zhang <[email protected]>
commit 5d03dbebba2594d2e6fbf3b5dd9060c5a835de3b upstream.
Reported bug: https://github.com/kdave/btrfs-progs/issues/389
There's a problem with scrub reporting aborted status but returning error code 0, on a filesystem with missing and readded device.
Roughly these steps:
- mkfs -d raid1 dev1 dev2
- fill with data
- unmount
- make dev1 disappear
- mount -o degraded
- copy more data
- make dev1 appear again
Running scrub afterwards reports that the command was aborted, but the system log message says the exit code was 0.
It seems that the cause of the error is decrementing fs_devices->missing_devices but not clearing device->dev_state. Every time we umount filesystem, it would call close_ctree, And it would eventually involve btrfs_close_one_device to close the device, but it only decrements fs_devices->missing_devices but does not clear the device BTRFS_DEV_STATE_MISSING bit. Worse, this bug will cause Integer Overflow, because every time umount, fs_devices->missing_devices will decrease. If fs_devices->missing_devices value hit 0, it would overflow.
With added debugging:
loop1: detected capacity change from 0 to 20971520
BTRFS: device fsid 56ad51f1-5523-463b-8547-c19486c51ebb devid 1 transid 21 /dev/loop1 scanned by systemd-udevd (2311)
loop2: detected capacity change from 0 to 20971520
BTRFS: device fsid 56ad51f1-5523-463b-8547-c19486c51ebb devid 2 transid 17 /dev/loop2 scanned by systemd-udevd (2313) BTRFS info (device loop1): flagging fs with big metadata feature
BTRFS info (device loop1): allowing degraded mounts
BTRFS info (device loop1): using free space tree
BTRFS info (device loop1): has skinny extents
BTRFS info (device loop1): before clear_missing.00000000f706684d /dev/loop1 0
BTRFS warning (device loop1): devid 2 uuid 6635ac31-56dd-4852-873b-c60f5e2d53d2 is missing
BTRFS info (device loop1): before clear_missing.0000000000000000 /dev/loop2 1
BTRFS info (device loop1): flagging fs with big metadata feature
BTRFS info (device loop1): allowing degraded mounts
BTRFS info (device loop1): using free space tree
BTRFS info (device loop1): has skinny extents
BTRFS info (device loop1): before clear_missing.00000000f706684d /dev/loop1 0
BTRFS warning (device loop1): devid 2 uuid 6635ac31-56dd-4852-873b-c60f5e2d53d2 is missing
BTRFS info (device loop1): before clear_missing.0000000000000000 /dev/loop2 0
BTRFS info (device loop1): flagging fs with big metadata feature
BTRFS info (device loop1): allowing degraded mounts
BTRFS info (device loop1): using free space tree
BTRFS info (device loop1): has skinny extents
BTRFS info (device loop1): before clear_missing.00000000f706684d /dev/loop1 18446744073709551615 BTRFS warning (device loop1): devid 2 uuid 6635ac31-56dd-4852-873b-c60f5e2d53d2 is missing
BTRFS info (device loop1): before clear_missing.0000000000000000 /dev/loop2 18446744073709551615
If fs_devices->missing_devices is 0, next time it would be 18446744073709551615
After apply this patch, the fs_devices->missing_devices seems to be right:
$ truncate -s 10g test1 $ truncate -s 10g test2 $ losetup /dev/loop1 test1 $ losetup /dev/loop2 test2 $ mkfs.btrfs -draid1 -mraid1 /dev/loop1 /dev/loop2 -f $ losetup -d /dev/loop2 $ mount -o degraded /dev/loop1 /mnt/1 $ umount /mnt/1 $ mount -o degraded /dev/loop1 /mnt/1 $ umount /mnt/1 $ mount -o degraded /dev/loop1 /mnt/1 $ umount /mnt/1 $ dmesg
loop1: detected capacity change from 0 to 20971520
loop2: detected capacity change from 0 to 20971520
BTRFS: device fsid 15aa1203-98d3-4a66-bcae-ca82f629c2cd devid 1 transid 5 /dev/loop1 scanned by mkfs.btrfs (1863)
BTRFS: device fsid 15aa1203-98d3-4a66-bcae-ca82f629c2cd devid 2 transid 5 /dev/loop2 scanned by mkfs.btrfs (1863) BTRFS info (device loop1): flagging fs with big metadata feature
BTRFS info (device loop1): allowing degraded mounts
BTRFS info (device loop1): disk space caching is enabled
BTRFS info (device loop1): has skinny extents
BTRFS info (device loop1): before clear_missing.00000000975bd577 /dev/loop1 0
BTRFS warning (device loop1): devid 2 uuid 8b333791-0b3f-4f57-b449-1c1ab6b51f38 is missing BTRFS info (device loop1): before clear_missing.0000000000000000 /dev/loop2 1
BTRFS info (device loop1): checking UUID tree
BTRFS info (device loop1): flagging fs with big metadata feature
BTRFS info (device loop1): allowing degraded mounts
BTRFS info (device loop1): disk space caching is enabled
BTRFS info (device loop1): has skinny extents
BTRFS info (device loop1): before clear_missing.00000000975bd577 /dev/loop1 0
BTRFS warning (device loop1): devid 2 uuid 8b333791-0b3f-4f57-b449-1c1ab6b51f38 is missing BTRFS info (device loop1): before clear_missing.0000000000000000 /dev/loop2 1
BTRFS info (device loop1): flagging fs with big metadata feature
BTRFS info (device loop1): allowing degraded mounts
BTRFS info (device loop1): disk space caching is enabled
BTRFS info (device loop1): has skinny extents
BTRFS info (device loop1): before clear_missing.00000000975bd577 /dev/loop1 0
BTRFS warning (device loop1): devid 2 uuid 8b333791-0b3f-4f57-b449-1c1ab6b51f38 is missing BTRFS info (device loop1): before clear_missing.0000000000000000 /dev/loop2 1
--- fs/btrfs/volumes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/volumes.c +3 -1
@@ -1134,8 +1134,10 @@ static void btrfs_close_one_device(strucif (device->devid ==BTRFS_DEV_REPLACE_DEVID )clear_bit (BTRFS_DEV_STATE_REPLACE_TGT , &device->dev_state); -if (test_bit (BTRFS_DEV_STATE_MISSING , &device->dev_state)) +if (test_bit (BTRFS_DEV_STATE_MISSING , &device->dev_state)) { +clear_bit (BTRFS_DEV_STATE_MISSING , &device->dev_state); fs_devices->missing_devices--; + }btrfs_close_bdev (device);if (device->bdev) {
Greg Kroah-Hartman
maintainerPATCH 99/849 btrfs: fix lost error handling when replaying directory deletes
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 10adb1152d957a4d570ad630f93a88bb961616c1 upstream.
At replay_dir_deletes(), if find_dir_range() returns an error we break out of the main while loop and then assign a value of 0 (success) to the 'ret' variable, resulting in completely ignoring that an error happened. Fix that by jumping to the 'out' label when find_dir_range() returns an error (negative value).
--- fs/btrfs/tree-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/tree-log.c +3 -1
@@ -2505,7 +2505,9 @@ again:else { ret =find_dir_range (log, path, dirid, key_type, &range_start, &range_end); -if (ret !=0 ) +if (ret <0 ) + goto out; +else if (ret >0 )break ; }
Greg Kroah-Hartman
maintainerPATCH 70/849 hyperv/vmbus: include linux/bitops.h
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 8017c99680fa65e1e8d999df1583de476a187830 ]
On arm64 randconfig builds, hyperv sometimes fails with this error:
In file included from drivers/hv/hv_trace.c:3:
In file included from drivers/hv/hyperv_vmbus.h:16:
In file included from arch/arm64/include/asm/sync_bitops.h:5:arch/arm64/include/asm/bitops.h:11:2: error: only <linux/bitops.h> can be included directly
In file included from include/asm-generic/bitops/hweight.h:5:include/asm-generic/bitops/arch_hweight.h:9:9: error: implicit declaration of function '__sw_hweight32' [-Werror,-Wimplicit-function-declaration] include/asm-generic/bitops/atomic.h:17:7: error: implicit declaration of function 'BIT_WORD' [-Werror,-Wimplicit-function-declaration]
Include the correct header first.
--- drivers/hv/hyperv_vmbus.h | 1 + 1 file changed, 1 insertion(+)
drivers/hv/hyperv_vmbus.h +1 -0
@@ -13,6 +13,7 @@#define _HYPERV_VMBUS_H#include <linux/list.h> +#include <linux/bitops.h> #include <asm/sync_bitops.h> #include <asm/hyperv-tlfs.h> #include <linux/atomic.h>
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 72/849 reset: tegra-bpmp: Handle errors in BPMP response
In reply to Greg Kroah-HartmanFrom: Mikko Perttunen <[email protected]>
[ Upstream commit c045ceb5a145d2a9a4bf33cbc55185ddf99f60ab ]
The return value from tegra_bpmp_transfer indicates the success or failure of the IPC transaction with BPMP. If the transaction succeeded, we also need to check the actual command's result code. Add code to do this.
--- drivers/reset/tegra/reset-bpmp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/reset/tegra/reset-bpmp.c +8 -1
@@ -20,6 +20,7 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc,struct tegra_bpmp *bpmp =to_tegra_bpmp (rstc);struct mrq_reset_request request;struct tegra_bpmp_message msg; +int err;memset (&request,0 ,sizeof (request)); request.cmd = command;
@@ -30,7 +31,13 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc, msg.tx.data = &request; msg.tx.size =sizeof (request); -return tegra_bpmp_transfer (bpmp, &msg); + err =tegra_bpmp_transfer (bpmp, &msg); +if (err) +return err; +if (msg.rx.ret) +return -EINVAL ; + +return 0 ; } static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 71/849 ARM: dts: sun7i: A20-olinuxino-lime2: Fix ethernet phy-mode
In reply to Greg Kroah-HartmanFrom: Bastien Roucariès <[email protected]>
[ Upstream commit 55dd7e059098ce4bd0a55c251cb78e74604abb57 ]
Commit bbc4d71d6354 ("net: phy: realtek: fix rtl8211e rx/tx delay config") sets the RX/TX delay according to the phy-mode property in the device tree. For the A20-olinuxino-lime2 board this is "rgmii", which is the wrong setting.
Following the example of a900cac3750b ("ARM: dts: sun7i: a20: bananapro:
Fix ethernet phy-mode") the phy-mode is changed to "rgmii-id" which gets the Ethernet working again on this board.
--- arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts +1 -1
@@ -112,7 +112,7 @@ pinctrl-names = "default"; pinctrl-0 = <&gmac_rgmii_pins>; phy-handle = <&phy1>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; status = "okay"; };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 74/849 mmc: winbond: dont build on M68K
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 162079f2dccd02cb4b6654defd32ca387dd6d4d4 ]
The Winbond MMC driver fails to build on ARCH=m68k so prevent that build config. Silences these build errors:
../drivers/mmc/host/wbsd.c: In function 'wbsd_request_end':../drivers/mmc/host/wbsd.c:212:28: error: implicit declaration of function 'claim_dma_lock' [-Werror=implicit-function-declaration]
212 | dmaflags = claim_dma_lock();../drivers/mmc/host/wbsd.c:215:17: error: implicit declaration of function 'release_dma_lock'; did you mean 'release_task'? [-Werror=implicit-function-declaration]
215 | release_dma_lock(dmaflags);
--- drivers/mmc/host/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/Kconfig +1 -1
@@ -506,7 +506,7 @@ config MMC_OMAP_HS config MMC_WBSD tristate "Winbond W83L51xD SD/MMC Card Interface support" - depends on ISA_DMA_API + depends on ISA_DMA_API && !M68K help This selects the Winbond(R) W83L51xD Secure digital and Multimedia card Interface.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 85/849 net: multicast: calculate csum of looped-back and forwarded packets
In reply to Greg Kroah-HartmanFrom: Cyril Strejc <[email protected]>
[ Upstream commit 9122a70a6333705c0c35614ddc51c274ed1d3637 ]
During a testing of an user-space application which transmits UDP multicast datagrams and utilizes multicast routing to send the UDP datagrams out of defined network interfaces, I've found a multicast router does not fill-in UDP checksum into locally produced, looped-back and forwarded UDP datagrams, if an original output NIC the datagrams are sent to has UDP TX checksum offload enabled.
The datagrams are sent malformed out of the NIC the datagrams have been forwarded to.
It is because:
1. If TX checksum offload is enabled on the output NIC, UDP checksum is not calculated by kernel and is not filled into skb data.
2. dev_loopback_xmit(), which is called solely by ip_mc_finish_output(), sets skb->ip_summed = CHECKSUM_UNNECESSARY unconditionally.
3. Since 35fc92a9 ("[NET]: Allow forwarding of ip_summed except CHECKSUM_COMPLETE"), the ip_summed value is preserved during forwarding.
4. If ip_summed != CHECKSUM_PARTIAL, checksum is not calculated during a packet egress.
The minimum fix in dev_loopback_xmit():
1. Preserves skb->ip_summed CHECKSUM_PARTIAL. This is the case when the original output NIC has TX checksum offload enabled. The effects are:
a) If the forwarding destination interface supports TX checksum offloading, the NIC driver is responsible to fill-in the checksum.
b) If the forwarding destination interface does NOT support TX checksum offloading, checksums are filled-in by kernel before skb is submitted to the NIC driver.
c) For local delivery, checksum validation is skipped as in the case of CHECKSUM_UNNECESSARY, thanks to skb_csum_unnecessary().
2. Translates ip_summed CHECKSUM_NONE to CHECKSUM_UNNECESSARY. It means, for CHECKSUM_NONE, the behavior is unmodified and is there to skip a looped-back packet local delivery checksum validation.
--- include/net/udp.h | 5 +++-- net/core/dev.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-)
include/net/udp.h +3 -2
@@ -494,8 +494,9 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,* CHECKSUM_NONE in __udp_gso_segment. UDP GRO indeed builds partial * packets in udp_gro_complete_segment. As does UDP GSO, verified by * udp_send_skb. But when those packets are looped in dev_loopback_xmit -* their ip_summed is set to CHECKSUM_UNNECESSARY. Reset in this -* specific case, where PARTIAL is both correct and required. +* their ip_summed CHECKSUM_NONE is changed to CHECKSUM_UNNECESSARY. +* Reset in this specific case, where PARTIAL is both correct and +* required. */ if (skb->pkt_type ==PACKET_LOOPBACK ) skb->ip_summed =CHECKSUM_PARTIAL ;
net/core/dev.c +2 -1
@@ -3995,7 +3995,8 @@ int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *skb)skb_reset_mac_header (skb);__skb_pull (skb,skb_network_offset (skb)); skb->pkt_type =PACKET_LOOPBACK ; - skb->ip_summed =CHECKSUM_UNNECESSARY ; +if (skb->ip_summed ==CHECKSUM_NONE ) + skb->ip_summed =CHECKSUM_UNNECESSARY ;WARN_ON (!skb_dst (skb));skb_dst_force (skb);netif_rx_ni (skb);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 68/849 sfc: Export fibre-specific supported link modes
In reply to Greg Kroah-HartmanFrom: Erik Ekman <[email protected]>
[ Upstream commit c62041c5baa9ded3bc6fd38d3f724de70683b489 ]
The 1/10GbaseT modes were set up for cards with SFP+ cages in 3497ed8c852a5 ("sfc: report supported link speeds on SFP connections"). 10GbaseT was likely used since no 10G fibre mode existed.
The missing fibre modes for 1/10G were added to ethtool.h in 5711a9822144 ("net: ethtool: add support for 1000BaseX and missing 10G link modes") shortly thereafter.
The user guide available at https://support-nic.xilinx.com/wp/drivers
lists support for the following cable and transceiver types in section 2.9:
- QSFP28 100G Direct Attach Cables
- QSFP28 100G SR Optical Transceivers (with SR4 modules listed)
- SFP28 25G Direct Attach Cables
- SFP28 25G SR Optical Transceivers
- QSFP+ 40G Direct Attach Cables
- QSFP+ 40G Active Optical Cables
- QSFP+ 40G SR4 Optical Transceivers
- QSFP+ to SFP+ Breakout Direct Attach Cables
- QSFP+ to SFP+ Breakout Active Optical Cables
- SFP+ 10G Direct Attach Cables
- SFP+ 10G SR Optical Transceivers
- SFP+ 10G LR Optical Transceivers
- SFP 1000BASE‐T Transceivers
- 1G Optical Transceivers
(From user guide issue 28. Issue 16 which also includes older cards like SFN5xxx/SFN6xxx has matching lists for 1/10/40G transceiver types.)
Regarding SFP+ 10GBASE‐T transceivers the latest guide says:
"Solarflare adapters do not support 10GBASE‐T transceiver modules."
Tested using SFN5122F-R7 (with 2 SFP+ ports). Supported link modes do not change depending on module used (tested with 1000BASE-T, 1000BASE-BX10, 10GBASE-LR). Before:
$ ethtool ext
Settings for ext:
Supported ports: [ FIBRE ]
Supported link modes: 1000baseT/Full
10000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: No
Supported FEC modes: Not reported
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Link partner advertised link modes: Not reported
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: No
Link partner advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: off
Port: FIBRE
PHYAD: 255
Transceiver: internal
Current message level: 0x000020f7 (8439)
drv probe link ifdown ifup rx_err tx_err hw
Link detected: yesAfter:
$ ethtool ext
Settings for ext:
Supported ports: [ FIBRE ]
Supported link modes: 1000baseT/Full
1000baseX/Full
10000baseCR/Full
10000baseSR/Full
10000baseLR/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: No
Supported FEC modes: Not reported
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Link partner advertised link modes: Not reported
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: No
Link partner advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: off
Port: FIBRE
PHYAD: 255
Transceiver: internal
Supports Wake-on: g
Wake-on: d
Current message level: 0x000020f7 (8439)
drv probe link ifdown ifup rx_err tx_err hw
Link detected: yes--- drivers/net/ethernet/sfc/mcdi_port_common.c | 37 +++++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-)
drivers/net/ethernet/sfc/mcdi_port_common.c +26 -11
@@ -132,16 +132,27 @@ void mcdi_to_ethtool_linkset(u32 media, u32 cap, unsigned long *linkset)case MC_CMD_MEDIA_SFP_PLUS :case MC_CMD_MEDIA_QSFP_PLUS :SET_BIT (FIBRE ); -if (cap & (1 <<MC_CMD_PHY_CAP_1000FDX_LBN )) +if (cap & (1 <<MC_CMD_PHY_CAP_1000FDX_LBN )) { SET_BIT(1000baseT_Full); -if (cap & (1 <<MC_CMD_PHY_CAP_10000FDX_LBN )) - SET_BIT(10000baseT_Full); -if (cap & (1 <<MC_CMD_PHY_CAP_40000FDX_LBN )) + SET_BIT(1000baseX_Full); + } +if (cap & (1 <<MC_CMD_PHY_CAP_10000FDX_LBN )) { + SET_BIT(10000baseCR_Full); + SET_BIT(10000baseLR_Full); + SET_BIT(10000baseSR_Full); + } +if (cap & (1 <<MC_CMD_PHY_CAP_40000FDX_LBN )) { SET_BIT(40000baseCR4_Full); -if (cap & (1 <<MC_CMD_PHY_CAP_100000FDX_LBN )) + SET_BIT(40000baseSR4_Full); + } +if (cap & (1 <<MC_CMD_PHY_CAP_100000FDX_LBN )) { SET_BIT(100000baseCR4_Full); -if (cap & (1 <<MC_CMD_PHY_CAP_25000FDX_LBN )) + SET_BIT(100000baseSR4_Full); + } +if (cap & (1 <<MC_CMD_PHY_CAP_25000FDX_LBN )) { SET_BIT(25000baseCR_Full); + SET_BIT(25000baseSR_Full); + }if (cap & (1 <<MC_CMD_PHY_CAP_50000FDX_LBN )) SET_BIT(50000baseCR2_Full);break ;
@@ -192,15 +203,19 @@ u32 ethtool_linkset_to_mcdi_cap(const unsigned long *linkset) result |= (1 <<MC_CMD_PHY_CAP_100FDX_LBN ); if (TEST_BIT(1000baseT_Half)) result |= (1 <<MC_CMD_PHY_CAP_1000HDX_LBN ); - if (TEST_BIT(1000baseT_Full) || TEST_BIT(1000baseKX_Full)) + if (TEST_BIT(1000baseT_Full) || TEST_BIT(1000baseKX_Full) || + TEST_BIT(1000baseX_Full)) result |= (1 <<MC_CMD_PHY_CAP_1000FDX_LBN ); - if (TEST_BIT(10000baseT_Full) || TEST_BIT(10000baseKX4_Full)) + if (TEST_BIT(10000baseT_Full) || TEST_BIT(10000baseKX4_Full) || + TEST_BIT(10000baseCR_Full) || TEST_BIT(10000baseLR_Full) || + TEST_BIT(10000baseSR_Full)) result |= (1 <<MC_CMD_PHY_CAP_10000FDX_LBN ); - if (TEST_BIT(40000baseCR4_Full) || TEST_BIT(40000baseKR4_Full)) + if (TEST_BIT(40000baseCR4_Full) || TEST_BIT(40000baseKR4_Full) || + TEST_BIT(40000baseSR4_Full)) result |= (1 <<MC_CMD_PHY_CAP_40000FDX_LBN ); - if (TEST_BIT(100000baseCR4_Full)) + if (TEST_BIT(100000baseCR4_Full) || TEST_BIT(100000baseSR4_Full)) result |= (1 <<MC_CMD_PHY_CAP_100000FDX_LBN ); - if (TEST_BIT(25000baseCR_Full)) + if (TEST_BIT(25000baseCR_Full) || TEST_BIT(25000baseSR_Full)) result |= (1 <<MC_CMD_PHY_CAP_25000FDX_LBN ); if (TEST_BIT(50000baseCR2_Full)) result |= (1 <<MC_CMD_PHY_CAP_50000FDX_LBN );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 119/849 evm: mark evm_fixmode as __ro_after_init
In reply to Greg Kroah-HartmanFrom: Austin Kim <[email protected]>
commit 32ba540f3c2a7ef61ed5a577ce25069a3d714fc9 upstream.
The evm_fixmode is only configurable by command-line option and it is never modified outside initcalls, so declaring it with __ro_after_init is better.
--- security/integrity/evm/evm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/evm/evm_main.c +1 -1
@@ -78,7 +78,7 @@ static struct xattr_list evm_config_defaLIST_HEAD (evm_config_xattrnames); -static int evm_fixmode; +static int evm_fixmode__ro_after_init ;static int __init evm_set_fixmode (char *str) {if (strncmp (str,"fix" ,3 ) ==0 )
Greg Kroah-Hartman
maintainerPATCH 116/849 ath10k: fix division by zero in send path
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit a006acb931317aad3a8dd41333ebb0453caf49b8 upstream.
Add the missing endpoint max-packet sanity check to probe() to avoid division by zero in ath10k_usb_hif_tx_sg() in case a malicious device has broken descriptors (or when doing descriptor fuzz testing).
Note that USB core will reject URBs submitted for endpoints with zero wMaxPacketSize but that drivers doing packet-size calculations still need to handle this (cf. commit 2548288b4fb0 ("USB: Fix: Don't skip endpoint descriptors with maxpacket=0")).
--- drivers/net/wireless/ath/ath10k/usb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath10k/usb.c +5 -0
@@ -853,6 +853,11 @@ static int ath10k_usb_setup_pipe_resourcle16_to_cpu (endpoint->wMaxPacketSize), endpoint->bInterval); } + +/* Ignore broken descriptors. */ +if (usb_endpoint_maxp (endpoint) ==0 ) +continue ; + urbcount =0 ; pipe_num =
Greg Kroah-Hartman
maintainerPATCH 117/849 PCI: Mark Atheros QCA6174 to avoid bus reset
In reply to Greg Kroah-HartmanFrom: Ingmar Klein <[email protected]>
commit e3f4bd3462f6f796594ecc0dda7144ed2d1e5a26 upstream.
When passing the Atheros QCA6174 through to a virtual machine, the VM hangs at the point where the ath10k driver loads.
Add a quirk to avoid bus resets on this device, which avoids the hang.
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -3573,6 +3573,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ADECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x003c , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0033 , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0034 , quirk_no_bus_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x003e , quirk_no_bus_reset);/* * Root port on some Cavium CN8xxx chips do not successfully complete a bus
Greg Kroah-Hartman
maintainerPATCH 118/849 rtl8187: fix control-message timeouts
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 2e9be536a213e838daed6ba42024dd68954ac061 upstream.
USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
--- drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c +7 -7
@@ -28,7 +28,7 @@ u8 rtl818x_ioread8_idx(struct rtl8187_prusb_control_msg (priv->udev,usb_rcvctrlpipe (priv->udev,0 ),RTL8187_REQ_GET_REG ,RTL8187_REQT_READ , (unsigned long )addr, idx &0x03 , - &priv->io_dmabuf->bits8,sizeof (val),HZ /2 ); + &priv->io_dmabuf->bits8,sizeof (val),500 ); val = priv->io_dmabuf->bits8;mutex_unlock (&priv->io_mutex);
@@ -45,7 +45,7 @@ u16 rtl818x_ioread16_idx(struct rtl8187_usb_control_msg (priv->udev,usb_rcvctrlpipe (priv->udev,0 ),RTL8187_REQ_GET_REG ,RTL8187_REQT_READ , (unsigned long )addr, idx &0x03 , - &priv->io_dmabuf->bits16,sizeof (val),HZ /2 ); + &priv->io_dmabuf->bits16,sizeof (val),500 ); val = priv->io_dmabuf->bits16;mutex_unlock (&priv->io_mutex);
@@ -62,7 +62,7 @@ u32 rtl818x_ioread32_idx(struct rtl8187_usb_control_msg (priv->udev,usb_rcvctrlpipe (priv->udev,0 ),RTL8187_REQ_GET_REG ,RTL8187_REQT_READ , (unsigned long )addr, idx &0x03 , - &priv->io_dmabuf->bits32,sizeof (val),HZ /2 ); + &priv->io_dmabuf->bits32,sizeof (val),500 ); val = priv->io_dmabuf->bits32;mutex_unlock (&priv->io_mutex);
@@ -79,7 +79,7 @@ void rtl818x_iowrite8_idx(struct rtl8187usb_control_msg (priv->udev,usb_sndctrlpipe (priv->udev,0 ),RTL8187_REQ_SET_REG ,RTL8187_REQT_WRITE , (unsigned long )addr, idx &0x03 , - &priv->io_dmabuf->bits8,sizeof (val),HZ /2 ); + &priv->io_dmabuf->bits8,sizeof (val),500 );mutex_unlock (&priv->io_mutex); }
@@ -93,7 +93,7 @@ void rtl818x_iowrite16_idx(struct rtl818usb_control_msg (priv->udev,usb_sndctrlpipe (priv->udev,0 ),RTL8187_REQ_SET_REG ,RTL8187_REQT_WRITE , (unsigned long )addr, idx &0x03 , - &priv->io_dmabuf->bits16,sizeof (val),HZ /2 ); + &priv->io_dmabuf->bits16,sizeof (val),500 );mutex_unlock (&priv->io_mutex); }
@@ -107,7 +107,7 @@ void rtl818x_iowrite32_idx(struct rtl818usb_control_msg (priv->udev,usb_sndctrlpipe (priv->udev,0 ),RTL8187_REQ_SET_REG ,RTL8187_REQT_WRITE , (unsigned long )addr, idx &0x03 , - &priv->io_dmabuf->bits32,sizeof (val),HZ /2 ); + &priv->io_dmabuf->bits32,sizeof (val),500 );mutex_unlock (&priv->io_mutex); }
@@ -183,7 +183,7 @@ static void rtl8225_write_8051(struct ieusb_control_msg (priv->udev,usb_sndctrlpipe (priv->udev,0 ),RTL8187_REQ_SET_REG ,RTL8187_REQT_WRITE , addr,0x8225 , &priv->io_dmabuf->bits16,sizeof (data), -HZ /2 ); +500 );mutex_unlock (&priv->io_mutex);
Greg Kroah-Hartman
maintainerPATCH 120/849 ifb: Depend on netfilter alternatively to tc
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 046178e726c2977d686ba5e07105d5a6685c830e upstream.
IFB originally depended on NET_CLS_ACT for traffic redirection. But since v4.5, that may be achieved with NFT_FWD_NETDEV as well.
--- drivers/net/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/Kconfig +1 -1
@@ -150,7 +150,7 @@ config NET_FC config IFB tristate "Intermediate Functional Block support" - depends on NET_CLS_ACT + depends on NET_ACT_MIRRED || NFT_FWD_NETDEV select NET_REDIRECT help This is an intermediate driver that allows sharing of
Greg Kroah-Hartman
maintainerPATCH 115/849 ath10k: fix control-message timeout
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 5286132324230168d3fab6ffc16bfd7de85bdfb4 upstream.
USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
--- drivers/net/wireless/ath/ath10k/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/usb.c +1 -1
@@ -525,7 +525,7 @@ static int ath10k_usb_submit_ctrl_in(str req,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE , value, index, buf, - size, 2 * HZ); + size, 2000);if (ret <0 ) { ath10k_warn(ar, "Failed to read usb control message: %d\n",
Greg Kroah-Hartman
maintainerPATCH 112/849 mwifiex: fix division by zero in fw download path
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 89f8765a11d8df49296d92c404067f9b5c58ee26 upstream.
Add the missing endpoint sanity checks to probe() to avoid division by zero in mwifiex_write_data_sync() in case a malicious device has broken descriptors (or when doing descriptor fuzz testing).
Only add checks for the firmware-download boot stage, which require both command endpoints, for now. The driver looks like it will handle a missing endpoint during normal operation without oopsing, albeit not very gracefully as it will try to submit URBs to the default pipe and fail.
Note that USB core will reject URBs submitted for endpoints with zero wMaxPacketSize but that drivers doing packet-size calculations still need to handle this (cf. commit 2548288b4fb0 ("USB: Fix: Don't skip endpoint descriptors with maxpacket=0")).
--- drivers/net/wireless/marvell/mwifiex/usb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/net/wireless/marvell/mwifiex/usb.c +16 -0
@@ -505,6 +505,22 @@ static int mwifiex_usb_probe(struct usb_ } } +switch (card->usb_boot_state) { +case USB8XXX_FW_DNLD : +/* Reject broken descriptors. */ +if (!card->rx_cmd_ep || !card->tx_cmd_ep) +return -ENODEV ; +if (card->bulk_out_maxpktsize ==0 ) +return -ENODEV ; +break ; +case USB8XXX_FW_READY : +/* Assume the driver can handle missing endpoints for now. */ +break ; +default : +WARN_ON (1 ); +return -ENODEV ; + } +usb_set_intfdata (intf, card); ret = mwifiex_add_card(card, &card->fw_done, &usb_ops,
Greg Kroah-Hartman
maintainerPATCH 114/849 ath6kl: fix control-message timeout
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit a066d28a7e729f808a3e6eff22e70c003091544e upstream.
USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
--- drivers/net/wireless/ath/ath6kl/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/usb.c +1 -1
@@ -912,7 +912,7 @@ static int ath6kl_usb_submit_ctrl_in(str req,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE , value, index, buf, - size, 2 * HZ); + size, 2000);if (ret <0 ) {ath6kl_warn ("Failed to read usb control message: %d\n" , ret);
Greg Kroah-Hartman
maintainerPATCH 113/849 ath6kl: fix division by zero in send path
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit c1b9ca365deae667192be9fe24db244919971234 upstream.
Add the missing endpoint max-packet sanity check to probe() to avoid division by zero in ath10k_usb_hif_tx_sg() in case a malicious device has broken descriptors (or when doing descriptor fuzz testing).
Note that USB core will reject URBs submitted for endpoints with zero wMaxPacketSize but that drivers doing packet-size calculations still need to handle this (cf. commit 2548288b4fb0 ("USB: Fix: Don't skip endpoint descriptors with maxpacket=0")).
--- drivers/net/wireless/ath/ath6kl/usb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath6kl/usb.c +5 -0
@@ -340,6 +340,11 @@ static int ath6kl_usb_setup_pipe_resourcle16_to_cpu (endpoint->wMaxPacketSize), endpoint->bInterval); } + +/* Ignore broken descriptors. */ +if (usb_endpoint_maxp (endpoint) ==0 ) +continue ; + urbcount =0 ; pipe_num =
Greg Kroah-Hartman
maintainerPATCH 122/849 mt76: mt7615: fix skb use-after-free on mac reset
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
commit b5cd1fd6043bbb7c5810067b5f93f3016bfd8a6f upstream.
When clearing all existing pending tx slots, mt76_tx_complete_skb needs to be used to free the skbs, to ensure that they are cleared from the status list as well.
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 45 ++++++++++++------------ 1 file changed, 23 insertions(+), 22 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +23 -22
@@ -1494,32 +1494,41 @@ out: }static void -mt7615_mac_tx_free_token (struct mt7615_dev *dev,u16 token) +mt7615_txwi_free (struct mt7615_dev *dev,struct mt76_txwi_cache *txwi) {struct mt76_dev *mdev = &dev->mt76; -struct mt76_txwi_cache *txwi;__le32 *txwi_data;u32 val;u8 wcid; -trace_mac_tx_free (dev, token); - txwi =mt76_token_put (mdev, token); -if (!txwi) -return ; +mt7615_txp_skb_unmap (mdev, txwi); +if (!txwi->skb) + goto out; txwi_data = (__le32 *)mt76_get_txwi_ptr (mdev, txwi); val =le32_to_cpu (txwi_data[1 ]); wcid =FIELD_GET (MT_TXD1_WLAN_IDX , val); +mt76_tx_complete_skb (mdev, wcid, txwi->skb); -mt7615_txp_skb_unmap (mdev, txwi); -if (txwi->skb) { -mt76_tx_complete_skb (mdev, wcid, txwi->skb); - txwi->skb =NULL ; - } - +out: + txwi->skb =NULL ;mt76_put_txwi (mdev, txwi); } +static void +mt7615_mac_tx_free_token (struct mt7615_dev *dev,u16 token) +{ +struct mt76_dev *mdev = &dev->mt76; +struct mt76_txwi_cache *txwi; + +trace_mac_tx_free (dev, token); + txwi =mt76_token_put (mdev, token); +if (!txwi) +return ; + +mt7615_txwi_free (dev, txwi); +} +static void mt7615_mac_tx_free (struct mt7615_dev *dev,struct sk_buff *skb) {struct mt7615_tx_free *free = (struct mt7615_tx_free *)skb->data;
@@ -2026,16 +2035,8 @@ void mt7615_tx_token_put(struct mt7615_dint id;spin_lock_bh (&dev->mt76.token_lock); -idr_for_each_entry (&dev->mt76.token, txwi, id) { -mt7615_txp_skb_unmap (&dev->mt76, txwi); -if (txwi->skb) { -struct ieee80211_hw *hw; - - hw =mt76_tx_status_get_hw (&dev->mt76, txwi->skb); -ieee80211_free_txskb (hw, txwi->skb); - } -mt76_put_txwi (&dev->mt76, txwi); - } +idr_for_each_entry (&dev->mt76.token, txwi, id) +mt7615_txwi_free (dev, txwi);spin_unlock_bh (&dev->mt76.token_lock);idr_destroy (&dev->mt76.token); }
Greg Kroah-Hartman
maintainerPATCH 103/849 KVM: PPC: Tick accounting should defer vtime accounting til after IRQ handling
In reply to Greg Kroah-HartmanFrom: Laurent Vivier <[email protected]>
commit 235cee162459d96153d63651ce7ff51752528c96 upstream.
Commit 112665286d08 ("KVM: PPC: Book3S HV: Context tracking exit guest context before enabling irqs") moved guest_exit() into the interrupt protected area to avoid wrong context warning (or worse). The problem is that tick-based time accounting has not yet been updated at this point (because it depends on the timer interrupt firing), so the guest time gets incorrectly accounted to system time.
To fix the problem, follow the x86 fix in commit 160457140187 ("Defer vtime accounting 'til after IRQ handling"), and allow host IRQs to run before accounting the guest exit time.
In the case vtime accounting is enabled, this is not required because TB is used directly for accounting.
Before this patch, with CONFIG_TICK_CPU_ACCOUNTING=y in the host and a guest running a kernel compile, the 'guest' fields of /proc/stat are stuck at zero. With the patch they can be observed increasing roughly as expected.
--- arch/powerpc/kvm/book3s_hv.c | 30 ++++++++++++++++++++++++++++-- arch/powerpc/kvm/booke.c | 16 +++++++++++++++- 2 files changed, 43 insertions(+), 3 deletions(-)
arch/powerpc/kvm/book3s_hv.c +28 -2
@@ -3687,7 +3687,20 @@ static noinline void kvmppc_run_core(strkvmppc_set_host_core (pcpu); -guest_exit_irqoff (); +context_tracking_guest_exit (); +if (!vtime_accounting_enabled_this_cpu ()) { +local_irq_enable (); +/* +* Service IRQs here before vtime_account_guest_exit() so any +* ticks that occurred while running the guest are accounted to +* the guest. If vtime accounting is enabled, accounting uses +* TB rather than ticks, so it can be done without enabling +* interrupts here, which has the problem that it accounts +* interrupt processing overhead to the host. +*/ +local_irq_disable (); + } +vtime_account_guest_exit ();local_irq_enable ();
@@ -4462,7 +4475,20 @@ int kvmhv_run_single_vcpu(struct kvm_vcpkvmppc_set_host_core (pcpu); -guest_exit_irqoff (); +context_tracking_guest_exit (); +if (!vtime_accounting_enabled_this_cpu ()) { +local_irq_enable (); +/* +* Service IRQs here before vtime_account_guest_exit() so any +* ticks that occurred while running the guest are accounted to +* the guest. If vtime accounting is enabled, accounting uses +* TB rather than ticks, so it can be done without enabling +* interrupts here, which has the problem that it accounts +* interrupt processing overhead to the host. +*/ +local_irq_disable (); + } +vtime_account_guest_exit ();local_irq_enable ();
arch/powerpc/kvm/booke.c +15 -1
@@ -1047,7 +1047,21 @@ int kvmppc_handle_exit(struct kvm_vcpu * }trace_kvm_exit (exit_nr, vcpu); -guest_exit_irqoff (); + +context_tracking_guest_exit (); +if (!vtime_accounting_enabled_this_cpu ()) { +local_irq_enable (); +/* +* Service IRQs here before vtime_account_guest_exit() so any +* ticks that occurred while running the guest are accounted to +* the guest. If vtime accounting is enabled, accounting uses +* TB rather than ticks, so it can be done without enabling +* interrupts here, which has the problem that it accounts +* interrupt processing overhead to the host. +*/ +local_irq_disable (); + } +vtime_account_guest_exit ();local_irq_enable ();
Greg Kroah-Hartman
maintainerPATCH 121/849 platform/surface: aggregator_registry: Add support for Surface Laptop Studio
In reply to Greg Kroah-HartmanFrom: Maximilian Luz <[email protected]>
commit 4f042e40199ce8bac6bc2b853e81744ee4ea759c upstream.
Add support for the Surface Laptop Studio.
In contrast to previous Surface Laptop models, this one has its HID devices attached to target ID 1 (instead of 2). It also has a couple more of them, including a new notifier for when the pen is stashed / taken out of its place, a "Sys Control" device, and two other unidentified HID devices with unknown usages.
Battery and performance profile interfaces remain the same.
--- drivers/platform/surface/surface_aggregator_registry.c | 54 +++++++++++++++++ 1 file changed, 54 insertions(+)
drivers/platform/surface/surface_aggregator_registry.c +54 -0
@@ -77,6 +77,42 @@ static const struct software_node ssam_n .parent = &ssam_node_root, }; +/* HID keyboard (TID1). */ +static const struct software_node ssam_node_hid_tid1_keyboard = { + .name ="ssam:01:15:01:01:00" , + .parent = &ssam_node_root, +}; + +/* HID pen stash (TID1; pen taken / stashed away evens). */ +static const struct software_node ssam_node_hid_tid1_penstash = { + .name ="ssam:01:15:01:02:00" , + .parent = &ssam_node_root, +}; + +/* HID touchpad (TID1). */ +static const struct software_node ssam_node_hid_tid1_touchpad = { + .name ="ssam:01:15:01:03:00" , + .parent = &ssam_node_root, +}; + +/* HID device instance 6 (TID1, unknown HID device). */ +static const struct software_node ssam_node_hid_tid1_iid6 = { + .name ="ssam:01:15:01:06:00" , + .parent = &ssam_node_root, +}; + +/* HID device instance 7 (TID1, unknown HID device). */ +static const struct software_node ssam_node_hid_tid1_iid7 = { + .name ="ssam:01:15:01:07:00" , + .parent = &ssam_node_root, +}; + +/* HID system controls (TID1). */ +static const struct software_node ssam_node_hid_tid1_sysctrl = { + .name ="ssam:01:15:01:08:00" , + .parent = &ssam_node_root, +}; +/* HID keyboard. */ static const struct software_node ssam_node_hid_main_keyboard = { .name ="ssam:01:15:02:01:00" ,
@@ -159,6 +195,21 @@ static const struct software_node *ssam_ NULL, }; +/* Devices for Surface Laptop Studio. */ +static const struct software_node *ssam_node_group_sls[] = { + &ssam_node_root, + &ssam_node_bat_ac, + &ssam_node_bat_main, + &ssam_node_tmp_pprof, + &ssam_node_hid_tid1_keyboard, + &ssam_node_hid_tid1_penstash, + &ssam_node_hid_tid1_touchpad, + &ssam_node_hid_tid1_iid6, + &ssam_node_hid_tid1_iid7, + &ssam_node_hid_tid1_sysctrl, +NULL , +}; +/* Devices for Surface Laptop Go. */ static const struct software_node *ssam_node_group_slg1[] = { &ssam_node_root,
@@ -507,6 +558,9 @@ static const struct acpi_device_id ssam_/* Surface Laptop Go 1 */ { "MSHW0118", (unsigned long)ssam_node_group_slg1 }, +/* Surface Laptop Studio */ + { "MSHW0123", (unsigned long)ssam_node_group_sls }, + { }, };MODULE_DEVICE_TABLE (acpi, ssam_platform_hub_match);
Greg Kroah-Hartman
maintainerPATCH 66/849 mISDN: Fix return values of the probe function
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit e211210098cb7490db2183d725f5c0f10463a704 ]
During the process of driver probing, the probe function should return < 0 for failure, otherwise, the kernel will treat value > 0 as success.
--- drivers/isdn/hardware/mISDN/hfcpci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/isdn/hardware/mISDN/hfcpci.c +4 -4
@@ -1994,14 +1994,14 @@ setup_hw(struct hfc_pci *hc)pci_set_master (hc->pdev);if (!hc->irq) {printk (KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n" ); -return 1 ; +return -EINVAL ; } hc->hw.pci_io = (char __iomem *)(unsigned long )hc->pdev->resource[1 ].start;if (!hc->hw.pci_io) {printk (KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n" ); -return 1 ; +return -ENOMEM ; }/* Allocate memory for FIFOS */ /* the memory needs to be on a 32k boundary within the first 4G */
@@ -2012,7 +2012,7 @@ setup_hw(struct hfc_pci *hc)if (!buffer) {printk (KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n" ); -return 1 ; +return -ENOMEM ; } hc->hw.fifos = buffer;pci_write_config_dword (hc->pdev,0x80 , hc->hw.dmahandle);
@@ -2022,7 +2022,7 @@ setup_hw(struct hfc_pci *hc) "HFC-PCI: Error in ioremap for PCI!\n");dma_free_coherent (&hc->pdev->dev,0x8000 , hc->hw.fifos, hc->hw.dmahandle); -return 1 ; +return -ENOMEM ; } printk(KERN_INFO
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 102/849 powerpc/kvm: Fix kvm_use_magic_page
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
commit 0c8eb2884a42d992c7726539328b7d3568f22143 upstream.
When switching from __get_user to fault_in_pages_readable, commit 9f9eae5ce717 broke kvm_use_magic_page: like __get_user, fault_in_pages_readable returns 0 on success.
--- arch/powerpc/kernel/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/kvm.c +1 -1
@@ -669,7 +669,7 @@ static void __init kvm_use_magic_page(voon_each_cpu (kvm_map_magic_page, &features,1 );/* Quick self-test to see if the mapping works */ -if (!fault_in_pages_readable ((const char *)KVM_MAGIC_PAGE ,sizeof (u32))) { +if (fault_in_pages_readable ((const char *)KVM_MAGIC_PAGE ,sizeof (u32))) { kvm_patching_worked = false;return ; }
Greg Kroah-Hartman
maintainerPATCH 111/849 EDAC/sb_edac: Fix top-of-high-memory value for Broadwell/Haswell
In reply to Greg Kroah-HartmanFrom: Eric Badger <[email protected]>
commit 537bddd069c743759addf422d0b8f028ff0f8dbc upstream.
The computation of TOHM is off by one bit. This missed bit results in too low a value for TOHM, which can cause errors in regular memory to incorrectly report:
EDAC MC0: 1 CE Error at MMIOH area, on addr 0x000000207fffa680 on any memory
--- drivers/edac/sb_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/sb_edac.c +1 -1
@@ -1052,7 +1052,7 @@ static u64 haswell_get_tohm(struct sbridpci_read_config_dword (pvt->info.pci_vtd,HASWELL_TOHM_1 , ®); rc = ((reg <<6 ) | rc) <<26 ; -return rc |0x1ffffff ; +return rc |0x3ffffff ; }static u64 knl_get_tolm (struct sbridge_pvt *pvt)
Greg Kroah-Hartman
maintainerPATCH 75/849 spi: altera: Change to dynamic allocation of spi id
In reply to Greg Kroah-HartmanFrom: Russ Weight <[email protected]>
[ Upstream commit f09f6dfef8ce7b70a240cf83811e2b1909c3e47b ]
The spi-altera driver has two flavors: platform and dfl. I'm seeing a case where I have both device types in the same machine, and they are conflicting on the SPI ID:
... kernel: couldn't get idr
... kernel: WARNING: CPU: 28 PID: 912 at drivers/spi/spi.c:2920 spi_register_controller.cold+0x84/0xc0a
Both the platform and dfl drivers use the parent's driver ID as the SPI ID. In the error case, the parent devices are dfl_dev.4 and subdev_spi_altera.4.auto. When the second spi-master is created, the failure occurs because the SPI ID of 4 has already been allocated.
Change the ID allocation to dynamic (by initializing bus_num to -1) to avoid duplicate SPI IDs.
--- drivers/spi/spi-altera-dfl.c | 2 +- drivers/spi/spi-altera-platform.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-altera-dfl.c +1 -1
@@ -140,7 +140,7 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl_dev)if (!master)return -ENOMEM ; - master->bus_num = dfl_dev->id; + master->bus_num =-1 ; hw =spi_master_get_devdata (master);
drivers/spi/spi-altera-platform.c +1 -1
@@ -48,7 +48,7 @@ static int altera_spi_probe(struct platform_device *pdev)return err;/* setup the master state. */ - master->bus_num = pdev->id; + master->bus_num =-1 ;if (pdata) {if (pdata->num_chipselect >ALTERA_SPI_MAX_CS ) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 73/849 reset: socfpga: add empty driver allowing consumers to probe
In reply to Greg Kroah-HartmanFrom: Paweł Anikiel <[email protected]>
[ Upstream commit 3ad60b4b3570937f3278509fe6797a5093ce53f8 ]
The early reset driver doesn't ever probe, which causes consuming devices to be unable to probe. Add an empty driver to set this device as available, allowing consumers to probe.
--- drivers/reset/reset-socfpga.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/reset/reset-socfpga.c +26 -0
@@ -92,3 +92,29 @@ void __init socfpga_reset_init(void)for_each_matching_node (np, socfpga_early_reset_dt_ids)a10_reset_init (np); } + +/* +* The early driver is problematic, because it doesn't register +* itself as a driver. This causes certain device links to prevent +* consumer devices from probing. The hacky solution is to register +* an empty driver, whose only job is to attach itself to the reset +* manager and call probe. +*/ +static const struct of_device_id socfpga_reset_dt_ids[] = { + { .compatible ="altr,rst-mgr" , }, + {/* sentinel */ }, +}; + +static int reset_simple_probe (struct platform_device *pdev) +{ +return 0 ; +} + +static struct platform_driver reset_socfpga_driver = { + .probe = reset_simple_probe, + .driver = { + .name ="socfpga-reset" , + .of_match_table = socfpga_reset_dt_ids, + }, +}; +builtin_platform_driver (reset_socfpga_driver);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 100/849 btrfs: call btrfs_check_rw_degradable only if there is a missing device
In reply to Greg Kroah-HartmanFrom: Anand Jain <[email protected]>
commit 5c78a5e7aa835c4f08a7c90fe02d19f95a776f29 upstream.
In open_ctree() in btrfs_check_rw_degradable() [1], we check each block group individually if at least the minimum number of devices is available for that profile. If all the devices are available, then we don't have to check degradable.
[1]open_ctree()
::
3559 if (!sb_rdonly(sb) && !btrfs_check_rw_degradable(fs_info, NULL)) {
Also before calling btrfs_check_rw_degradable() in open_ctee() at the line number shown below [2] we call btrfs_read_chunk_tree() and down to add_missing_dev() to record number of missing devices.
[2]open_ctree()
::
3454 ret = btrfs_read_chunk_tree(fs_info);
btrfs_read_chunk_tree()
read_one_chunk() / read_one_dev()
add_missing_dev()
So, check if there is any missing device before btrfs_check_rw_degradable() in open_ctree().
Also, with this the mount command could save ~16ms.[3] in the most common case, that is no device is missing.
[3]
1) * 16934.96 us | btrfs_check_rw_degradable [btrfs]();
--- fs/btrfs/disk-io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/disk-io.c +2 -1
@@ -3551,7 +3551,8 @@ int __cold open_ctree(struct super_block goto fail_sysfs; } -if (!sb_rdonly (sb) && !btrfs_check_rw_degradable (fs_info,NULL )) { +if (!sb_rdonly (sb) && fs_info->fs_devices->missing_devices && + !btrfs_check_rw_degradable (fs_info,NULL )) {btrfs_warn (fs_info,"writable mount is not allowed due to too many missing devices" ); goto fail_sysfs;
Greg Kroah-Hartman
maintainerPATCH 96/849 net/smc: Correct spelling mistake to TCPF_SYN_RECV
In reply to Greg Kroah-HartmanFrom: Wen Gu <[email protected]>
[ Upstream commit f3a3a0fe0b644582fa5d83dd94b398f99fc57914 ]
There should use TCPF_SYN_RECV instead of TCP_SYN_RECV.
--- net/smc/af_smc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/af_smc.c +1 -1
@@ -1057,7 +1057,7 @@ static void smc_connect_work(struct work_struct *work)if (smc->clcsock->sk->sk_err) { smc->sk.sk_err = smc->clcsock->sk->sk_err; }else if ((1 << smc->clcsock->sk->sk_state) & - (TCPF_SYN_SENT |TCP_SYN_RECV )) { + (TCPF_SYN_SENT |TCPF_SYN_RECV )) { rc =sk_stream_wait_connect (smc->clcsock->sk, &timeo); if ((rc == -EPIPE) && ((1 << smc->clcsock->sk->sk_state) &
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 69/849 sfc: Dont use netif_info before net_device setup
In reply to Greg Kroah-HartmanFrom: Erik Ekman <[email protected]>
[ Upstream commit bf6abf345dfa77786aca554bc58c64bd428ecb1d ]
Use pci_info instead to avoid unnamed/uninitialized noise:
[197088.688729] sfc 0000:01:00.0: Solarflare NIC detected [197088.690333] sfc 0000:01:00.0: Part Number : SFN5122F [197088.729061] sfc 0000:01:00.0 (unnamed net_device) (uninitialized): no SR-IOV VFs probed [197088.729071] sfc 0000:01:00.0 (unnamed net_device) (uninitialized): no PTP support
Inspired by fa44821a4ddd ("sfc: don't use netif_info et al before net_device is registered") from Heiner Kallweit.
--- drivers/net/ethernet/sfc/ptp.c | 4 ++-- drivers/net/ethernet/sfc/siena_sriov.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/sfc/ptp.c +2 -2
@@ -648,7 +648,7 @@ static int efx_ptp_get_attributes(struct efx_nic *efx) }else if (rc == -EINVAL ) { fmt =MC_CMD_PTP_OUT_GET_ATTRIBUTES_SECONDS_NANOSECONDS ; }else if (rc == -EPERM ) { -netif_info (efx, probe, efx->net_dev,"no PTP support\n" ); +pci_info (efx->pci_dev,"no PTP support\n" );return rc; }else { efx_mcdi_display_error(efx, MC_CMD_PTP, sizeof(inbuf),
@@ -824,7 +824,7 @@ static int efx_ptp_disable(struct efx_nic *efx)* should only have been called during probe. */ if (rc == -ENOSYS || rc == -EPERM ) -netif_info (efx, probe, efx->net_dev,"no PTP support\n" ); +pci_info (efx->pci_dev,"no PTP support\n" );else if (rc) efx_mcdi_display_error(efx, MC_CMD_PTP, MC_CMD_PTP_IN_DISABLE_LEN,
drivers/net/ethernet/sfc/siena_sriov.c +1 -1
@@ -1057,7 +1057,7 @@ void efx_siena_sriov_probe(struct efx_nic *efx)return ;if (efx_siena_sriov_cmd (efx, false, &efx->vi_scale, &count)) { -netif_info (efx, probe, efx->net_dev,"no SR-IOV VFs probed\n" ); +pci_info (efx->pci_dev,"no SR-IOV VFs probed\n" );return ; }if (count >0 && count > max_vfs)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 109/849 regulator: s5m8767: do not use reset value as DVS voltage if GPIO DVS is disabled
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit b16bef60a9112b1e6daf3afd16484eb06e7ce792 upstream.
The driver and its bindings, before commit 04f9f068a619 ("regulator:
s5m8767: Modify parsing method of the voltage table of buck2/3/4") were requiring to provide at least one safe/default voltage for DVS registers if DVS GPIO is not being enabled.
IOW, if s5m8767,pmic-buck2-uses-gpio-dvs is missing, the s5m8767,pmic-buck2-dvs-voltage should still be present and contain one voltage.
This requirement was coming from driver behavior matching this condition (none of DVS GPIO is enabled): it was always initializing the DVS selector pins to 0 and keeping the DVS enable setting at reset value (enabled). Therefore if none of DVS GPIO is enabled in devicetree, driver was configuring the first DVS voltage for buck[234].
Mentioned commit 04f9f068a619 ("regulator: s5m8767: Modify parsing method of the voltage table of buck2/3/4") broke it because DVS voltage won't be parsed from devicetree if DVS GPIO is not enabled. After the change, driver will configure bucks to use the register reset value as voltage which might have unpleasant effects.
Fix this by relaxing the bindings constrain: if DVS GPIO is not enabled in devicetree (therefore DVS voltage is also not parsed), explicitly disable it.
Message-Id: <[email protected]>
--- Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt | 21 +++------- drivers/regulator/s5m8767.c | 21 ++++------ 2 files changed, 17 insertions(+), 25 deletions(-)
Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt +8 -13
@@ -13,6 +13,14 @@ common regulator binding documented in: Required properties of the main device node (the parent!): + - s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used + for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines. + + [1] If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional + property is specified, then all the eight voltage values for the + 's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified. + +Optional properties of the main device node (the parent!): - s5m8767,pmic-buck2-dvs-voltage: A set of 8 voltage values in micro-volt (uV) units for buck2 when changing voltage using gpio dvs. Refer to [1] below for additional information.
@@ -25,19 +33,6 @@ Required properties of the main device n units for buck4 when changing voltage using gpio dvs. Refer to [1] below for additional information. - - s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used - for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines. - - [1] If none of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional - property is specified, the 's5m8767,pmic-buck[2/3/4]-dvs-voltage' - property should specify atleast one voltage level (which would be a - safe operating voltage). - - If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional - property is specified, then all the eight voltage values for the - 's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified. - -Optional properties of the main device node (the parent!): - s5m8767,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs. - s5m8767,pmic-buck3-uses-gpio-dvs: 'buck3' can be controlled by gpio dvs. - s5m8767,pmic-buck4-uses-gpio-dvs: 'buck4' can be controlled by gpio dvs.
drivers/regulator/s5m8767.c +9 -12
@@ -850,18 +850,15 @@ static int s5m8767_pmic_probe(struct pla/* DS4 GPIO */ gpio_direction_output (pdata->buck_ds[2 ],0x0 ); -if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs || - pdata->buck4_gpiodvs) { -regmap_update_bits (s5m8767->iodev->regmap_pmic, -S5M8767_REG_BUCK2CTRL ,1 <<1 , - (pdata->buck2_gpiodvs) ? (1 <<1 ) : (0 <<1 )); -regmap_update_bits (s5m8767->iodev->regmap_pmic, -S5M8767_REG_BUCK3CTRL ,1 <<1 , - (pdata->buck3_gpiodvs) ? (1 <<1 ) : (0 <<1 )); -regmap_update_bits (s5m8767->iodev->regmap_pmic, -S5M8767_REG_BUCK4CTRL ,1 <<1 , - (pdata->buck4_gpiodvs) ? (1 <<1 ) : (0 <<1 )); - } +regmap_update_bits (s5m8767->iodev->regmap_pmic, +S5M8767_REG_BUCK2CTRL ,1 <<1 , + (pdata->buck2_gpiodvs) ? (1 <<1 ) : (0 <<1 )); +regmap_update_bits (s5m8767->iodev->regmap_pmic, +S5M8767_REG_BUCK3CTRL ,1 <<1 , + (pdata->buck3_gpiodvs) ? (1 <<1 ) : (0 <<1 )); +regmap_update_bits (s5m8767->iodev->regmap_pmic, +S5M8767_REG_BUCK4CTRL ,1 <<1 , + (pdata->buck4_gpiodvs) ? (1 <<1 ) : (0 <<1 ));/* Initialize GPIO DVS registers */ for (i =0 ; i <8 ; i++) {
Greg Kroah-Hartman
maintainerPATCH 110/849 regulator: dt-bindings: samsung,s5m8767: correct s5m8767,pmic-buck-default-dvs-idx property
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit a7fda04bc9b6ad9da8e19c9e6e3b1dab773d068a upstream.
The driver was always parsing "s5m8767,pmic-buck-default-dvs-idx", not "s5m8767,pmic-buck234-default-dvs-idx".
Message-Id: <[email protected]>
--- Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt +1 -1
@@ -39,7 +39,7 @@ Optional properties of the main device n Additional properties required if either of the optional properties are used: - - s5m8767,pmic-buck234-default-dvs-idx: Default voltage setting selected from + - s5m8767,pmic-buck-default-dvs-idx: Default voltage setting selected from the possible 8 options selectable by the dvs gpios. The value of this property should be between 0 and 7. If not specified or if out of range, the default value of this property is set to 0.
Greg Kroah-Hartman
maintainerPATCH 153/849 iio: core: check return value when calling dev_set_name()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
commit fe6f45f6ba22d625a8500cbad0237c60dd3117ee upstream.
I got a null-ptr-deref report when doing fault injection test:
BUG: kernel NULL pointer dereference, address: 0000000000000000 RIP: 0010:strlen+0x0/0x20 Call Trace: start_creating+0x199/0x2f0 debugfs_create_dir+0x25/0x430 __iio_device_register+0x4da/0x1b40 [industrialio] __devm_iio_device_register+0x22/0x80 [industrialio] max1027_probe+0x639/0x860 [max1027] spi_probe+0x183/0x210 really_probe+0x285/0xc30
If dev_set_name() fails, the dev_name() is null, check the return value of dev_set_name() to avoid the null-ptr-deref.
--- drivers/iio/industrialio-core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/iio/industrialio-core.c +7 -1
@@ -1662,7 +1662,13 @@ struct iio_dev *iio_device_alloc(structkfree (iio_dev_opaque);return NULL ; } -dev_set_name (&indio_dev->dev,"iio:device%d" , iio_dev_opaque->id); + +if (dev_set_name (&indio_dev->dev,"iio:device%d" , iio_dev_opaque->id)) { +ida_simple_remove (&iio_ida, iio_dev_opaque->id); +kfree (iio_dev_opaque); +return NULL ; + } +INIT_LIST_HEAD (&iio_dev_opaque->buffer_list);INIT_LIST_HEAD (&iio_dev_opaque->ioctl_handlers);
Greg Kroah-Hartman
maintainerPATCH 152/849 iio: core: fix double free in iio_device_unregister_sysfs()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
commit 19833c40d0415d6fe4340b5b9c46239abbf718f6 upstream.
I got the double free report:
BUG: KASAN: double-free or invalid-free in kfree+0xce/0x390 iio_device_unregister_sysfs+0x108/0x13b [industrialio] iio_dev_release+0x9e/0x10e [industrialio] device_release+0xa5/0x240
If __iio_device_register() fails, iio_dev_opaque->groups will be freed in error path in iio_device_unregister_sysfs(), then iio_dev_release() will call iio_device_unregister_sysfs() again, it causes double free. Set iio_dev_opaque->groups to NULL when it's freed to fix this double free.
Not this is a local work around for a more general mess around life time management that will get cleaned up and should make this handling unnecesarry.
--- drivers/iio/industrialio-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/industrialio-core.c +1 -0
@@ -1597,6 +1597,7 @@ static void iio_device_unregister_sysfs(kfree (iio_dev_opaque->chan_attr_group.attrs); iio_dev_opaque->chan_attr_group.attrs =NULL ;kfree (iio_dev_opaque->groups); + iio_dev_opaque->groups =NULL ; }static void iio_dev_release (struct device *device)
Greg Kroah-Hartman
maintainerPATCH 154/849 KVM: arm64: Extract ESR_ELx.EC only
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
commit 8bb084119f1acc2ec55ea085a97231e3ddb30782 upstream.
Since ARMv8.0 the upper 32 bits of ESR_ELx have been RES0, and recently some of the upper bits gained a meaning and can be non-zero. For example, when FEAT_LS64 is implemented, ESR_ELx[36:32] contain ISS2, which for an ST64BV or ST64BV0 can be non-zero. This can be seen in ARM DDI 0487G.b, page D13-3145, section D13.2.37.
Generally, we must not rely on RES0 bit remaining zero in future, and when extracting ESR_ELx.EC we must mask out all other bits.
All C code uses the ESR_ELx_EC() macro, which masks out the irrelevant bits, and therefore no alterations are required to C code to avoid consuming irrelevant bits.
In a couple of places the KVM assembly extracts ESR_ELx.EC using LSR on an X register, and so could in theory consume previously RES0 bits. In both cases this is for comparison with EC values ESR_ELx_EC_HVC32 and ESR_ELx_EC_HVC64, for which the upper bits of ESR_ELx must currently be zero, but this could change in future.
This patch adjusts the KVM vectors to use UBFX rather than LSR to extract ESR_ELx.EC, ensuring these are robust to future additions to ESR_ELx.
--- arch/arm64/include/asm/esr.h | 1 + arch/arm64/kvm/hyp/hyp-entry.S | 2 +- arch/arm64/kvm/hyp/nvhe/host.S | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)
arch/arm64/include/asm/esr.h +1 -0
@@ -68,6 +68,7 @@#define ESR_ELx_EC_MAX (0x3F)#define ESR_ELx_EC_SHIFT (26) +#define ESR_ELx_EC_WIDTH (6)#define ESR_ELx_EC_MASK (UL(0x3F) << ESR_ELx_EC_SHIFT)#define ESR_ELx_EC (esr) (((esr) & ESR_ELx_EC_MASK) >> ESR_ELx_EC_SHIFT)
arch/arm64/kvm/hyp/hyp-entry.S +1 -1
@@ -44,7 +44,7 @@ el1_sync: // Guest trapped into EL2 mrs x0, esr_el2 - lsr x0, x0, #ESR_ELx_EC_SHIFT + ubfx x0, x0, #ESR_ELx_EC_SHIFT, #ESR_ELx_EC_WIDTH cmp x0, #ESR_ELx_EC_HVC64 ccmp x0, #ESR_ELx_EC_HVC32, #4, ne b.ne el1_trap
arch/arm64/kvm/hyp/nvhe/host.S +1 -1
@@ -115,7 +115,7 @@ SYM_FUNC_END(__hyp_do_panic) .L__vect_start\@: stp x0, x1, [sp, #-16]! mrs x0, esr_el2 - lsr x0, x0, #ESR_ELx_EC_SHIFT + ubfx x0, x0, #ESR_ELx_EC_SHIFT, #ESR_ELx_EC_WIDTH cmp x0, #ESR_ELx_EC_HVC64 b.ne __host_exit
Greg Kroah-Hartman
maintainerPATCH 156/849 KVM: x86: Add helper to consolidate core logic of SET_CPUID{2} flows
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit 8b44b174f6aca815fc84c2038e4523ef8e32fabb upstream.
Move the core logic of SET_CPUID and SET_CPUID2 to a common helper, the only difference between the two ioctls() is the format of the userspace struct. A future fix will add yet more code to the core logic.
No functional change intended.
Message-Id: <[email protected]>
--- arch/x86/kvm/cpuid.c | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-)
arch/x86/kvm/cpuid.c +24 -23
@@ -232,6 +232,25 @@ u64 kvm_vcpu_reserved_gpa_bits_raw(strucreturn rsvd_bits (cpuid_maxphyaddr (vcpu),63 ); } +static int kvm_set_cpuid (struct kvm_vcpu *vcpu,struct kvm_cpuid_entry2 *e2, +int nent) +{ +int r; + + r =kvm_check_cpuid (e2, nent); +if (r) +return r; + +kvfree (vcpu->arch.cpuid_entries); + vcpu->arch.cpuid_entries = e2; + vcpu->arch.cpuid_nent = nent; + +kvm_update_cpuid_runtime (vcpu); +kvm_vcpu_after_set_cpuid (vcpu); + +return 0 ; +} +/* when an old userspace process fills a new kernel module */ int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid *cpuid,
@@ -268,18 +287,9 @@ int kvm_vcpu_ioctl_set_cpuid(struct kvm_ e2[i].padding[2 ] =0 ; } - r =kvm_check_cpuid (e2, cpuid->nent); -if (r) { + r =kvm_set_cpuid (vcpu, e2, cpuid->nent); +if (r)kvfree (e2); - goto out_free_cpuid; - } - -kvfree (vcpu->arch.cpuid_entries); - vcpu->arch.cpuid_entries = e2; - vcpu->arch.cpuid_nent = cpuid->nent; - -kvm_update_cpuid_runtime (vcpu); -kvm_vcpu_after_set_cpuid (vcpu); out_free_cpuid:kvfree (e);
@@ -303,20 +313,11 @@ int kvm_vcpu_ioctl_set_cpuid2(struct kvmreturn PTR_ERR (e2); } - r =kvm_check_cpuid (e2, cpuid->nent); -if (r) { + r =kvm_set_cpuid (vcpu, e2, cpuid->nent); +if (r)kvfree (e2); -return r; - } -kvfree (vcpu->arch.cpuid_entries); - vcpu->arch.cpuid_entries = e2; - vcpu->arch.cpuid_nent = cpuid->nent; - -kvm_update_cpuid_runtime (vcpu); -kvm_vcpu_after_set_cpuid (vcpu); - -return 0 ; +return r; } int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
Greg Kroah-Hartman
maintainerPATCH 159/849 can: j1939: j1939_tp_cmd_recv(): ignore abort message in the BAM transport
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
commit c0f49d98006f2db3333b917caac65bce2af9865c upstream.
This patch prevents BAM transport from being closed by receiving abort message, as specified in SAE-J1939-82 2015 (A.3.3 Row 4).
--- net/can/j1939/transport.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/can/j1939/transport.c +6 -0
@@ -2065,6 +2065,12 @@ static void j1939_tp_cmd_recv(struct j19break ;case J1939_ETP_CMD_ABORT :/* && J1939_TP_CMD_ABORT */ +if (j1939_cb_is_broadcast (skcb)) { +netdev_err_once (priv->ndev,"%s: abort to broadcast (%02x), ignoring!\n" , + __func__, skcb->addr.sa); +return ; + } +if (j1939_tp_im_transmitter (skcb))j1939_xtp_rx_abort (priv, skb, true);
Greg Kroah-Hartman
maintainerPATCH 155/849 KVM: x86: Fix recording of guest steal time / preempted status
In reply to Greg Kroah-HartmanFrom: David Woodhouse <[email protected]>
commit 7e2175ebd695f17860c5bd4ad7616cce12ed4591 upstream.
In commit b043138246a4 ("x86/KVM: Make sure KVM_VCPU_FLUSH_TLB flag is not missed") we switched to using a gfn_to_pfn_cache for accessing the guest steal time structure in order to allow for an atomic xchg of the preempted field. This has a couple of problems.
Firstly, kvm_map_gfn() doesn't work at all for IOMEM pages when the atomic flag is set, which it is in kvm_steal_time_set_preempted(). So a guest vCPU using an IOMEM page for its steal time would never have its preempted field set.
Secondly, the gfn_to_pfn_cache is not invalidated in all cases where it should have been. There are two stages to the GFN->PFN conversion; first the GFN is converted to a userspace HVA, and then that HVA is looked up in the process page tables to find the underlying host PFN. Correct invalidation of the latter would require being hooked up to the MMU notifiers, but that doesn't happen---so it just keeps mapping and unmapping the *wrong* PFN after the userspace page tables change.
In the !IOMEM case at least the stale page *is* pinned all the time it's cached, so it won't be freed and reused by anyone else while still receiving the steal time updates. The map/unmap dance only takes care of the KVM administrivia such as marking the page dirty.
Until the gfn_to_pfn cache handles the remapping automatically by integrating with the MMU notifiers, we might as well not get a kernel mapping of it, and use the perfectly serviceable userspace HVA that we already have. We just need to implement the atomic xchg on the userspace address with appropriate exception handling, which is fairly trivial.
Message-Id: <[email protected]> [I didn't entirely agree with David's assessment of the
usefulness of the gfn_to_pfn cache, and integrated the outcome of the discussion in the above commit message. - Paolo]
--- arch/x86/include/asm/kvm_host.h | 2 arch/x86/kvm/x86.c | 105 ++++++++++++++++++++++++++++------------ 2 files changed, 76 insertions(+), 31 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -1
@@ -745,7 +745,7 @@ struct kvm_vcpu_arch {u8 preempted;u64 msr_val;u64 last_steal; -struct gfn_to_pfn_cache cache; +struct gfn_to_hva_cache cache; } st;u64 l1_tsc_offset;
arch/x86/kvm/x86.c +75 -30
165 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 158/849 KVM: nVMX: Handle dynamic MSR intercept toggling
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit 67f4b9969c305be515e47f809ecacfd86bd20a9c upstream.
Always check vmcs01's MSR bitmap when merging L0 and L1 bitmaps for L2, and always update the relevant bits in vmcs02. This fixes two distinct, but intertwined bugs related to dynamic MSR bitmap modifications.
The first issue is that KVM fails to enable MSR interception in vmcs02 for the FS/GS base MSRs if L1 first runs L2 with interception disabled, and later enables interception.
The second issue is that KVM fails to honor userspace MSR filtering when preparing vmcs02.
Fix both issues simultaneous as fixing only one of the issues (doesn't matter which) would create a mess that no one should have to bisect. Fixing only the first bug would exacerbate the MSR filtering issue as userspace would see inconsistent behavior depending on the whims of L1. Fixing only the second bug (MSR filtering) effectively requires fixing the first, as the nVMX code only knows how to transition vmcs02's bitmap from 1->0.
Move the various accessor/mutators that are currently buried in vmx.c into vmx.h so that they can be shared by the nested code.
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/nested.c | 103 ++++++++++++++++++++-------------------------- arch/x86/kvm/vmx/vmx.c | 55 ------------------------ arch/x86/kvm/vmx/vmx.h | 63 ++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 110 deletions(-)
arch/x86/kvm/vmx/nested.c +46 -57
@@ -524,29 +524,6 @@ static int nested_vmx_check_tpr_shadow_c }/* -* Check if MSR is intercepted for L01 MSR bitmap. -*/ -static bool msr_write_intercepted_l01 (struct kvm_vcpu *vcpu,u32 msr) -{ -unsigned long *msr_bitmap; -int f =sizeof (unsigned long ); - -if (!cpu_has_vmx_msr_bitmap ()) -return true; - - msr_bitmap =to_vmx (vcpu)->vmcs01.msr_bitmap; - -if (msr <=0x1fff ) { -return !!test_bit (msr, msr_bitmap +0x800 / f); - }else if ((msr >=0xc0000000 ) && (msr <=0xc0001fff )) { - msr &=0x1fff ; -return !!test_bit (msr, msr_bitmap +0xc00 / f); - } - -return true; -} - -/* * If a msr is allowed by L0, we should check whether it is allowed by L1. * The corresponding bit will be cleared unless both of L0 and L1 allow it. */
@@ -599,6 +576,34 @@ static inline void enable_x2apic_msr_int } } +#define BUILD_NVMX_MSR_INTERCEPT_HELPER (rw) \ +static inline \ +void nested_vmx_set_msr_##rw##_intercept(struct vcpu_vmx *vmx, \ + unsigned long *msr_bitmap_l1, \ + unsigned long *msr_bitmap_l0, u32 msr) \ +{ \ + if (vmx_test_msr_bitmap_##rw(vmx->vmcs01.msr_bitmap, msr) || \ + vmx_test_msr_bitmap_##rw(msr_bitmap_l1, msr)) \ + vmx_set_msr_bitmap_##rw(msr_bitmap_l0, msr); \ + else \ + vmx_clear_msr_bitmap_##rw(msr_bitmap_l0, msr); \ +} +BUILD_NVMX_MSR_INTERCEPT_HELPER(read) +BUILD_NVMX_MSR_INTERCEPT_HELPER(write) + +static inline void nested_vmx_set_intercept_for_msr(struct vcpu_vmx *vmx, + unsigned long *msr_bitmap_l1, + unsigned long *msr_bitmap_l0, + u32 msr, int types) +{ + if (types & MSR_TYPE_R) + nested_vmx_set_msr_read_intercept(vmx, msr_bitmap_l1, + msr_bitmap_l0, msr); + if (types & MSR_TYPE_W) + nested_vmx_set_msr_write_intercept(vmx, msr_bitmap_l1, + msr_bitmap_l0, msr); +} +/* * Merge L0's and L1's MSR bitmap, return false to indicate that * we do not use the hardware.
@@ -606,10 +611,11 @@ static inline void enable_x2apic_msr_intstatic inline bool nested_vmx_prepare_msr_bitmap (struct kvm_vcpu *vcpu,struct vmcs12 *vmcs12) { +struct vcpu_vmx *vmx =to_vmx (vcpu);int msr;unsigned long *msr_bitmap_l1; -unsigned long *msr_bitmap_l0 =to_vmx (vcpu)->nested.vmcs02.msr_bitmap; -struct kvm_host_map *map = &to_vmx (vcpu)->nested.msr_bitmap_map; +unsigned long *msr_bitmap_l0 = vmx->nested.vmcs02.msr_bitmap; +struct kvm_host_map *map = &vmx->nested.msr_bitmap_map;/* Nothing to do if the MSR bitmap is not in use. */ if (!cpu_has_vmx_msr_bitmap() ||
@@ -660,44 +666,27 @@ static inline bool nested_vmx_prepare_ms } } -/* KVM unconditionally exposes the FS/GS base MSRs to L1. */ +/* +* Always check vmcs01's bitmap to honor userspace MSR filters and any +* other runtime changes to vmcs01's bitmap, e.g. dynamic pass-through. +*/ #ifdef CONFIG_X86_64 -nested_vmx_disable_intercept_for_msr (msr_bitmap_l1, msr_bitmap_l0, -MSR_FS_BASE ,MSR_TYPE_RW ); +nested_vmx_set_intercept_for_msr (vmx, msr_bitmap_l1, msr_bitmap_l0, +MSR_FS_BASE ,MSR_TYPE_RW ); -nested_vmx_disable_intercept_for_msr (msr_bitmap_l1, msr_bitmap_l0, -MSR_GS_BASE ,MSR_TYPE_RW ); +nested_vmx_set_intercept_for_msr (vmx, msr_bitmap_l1, msr_bitmap_l0, +MSR_GS_BASE ,MSR_TYPE_RW ); -nested_vmx_disable_intercept_for_msr (msr_bitmap_l1, msr_bitmap_l0, -MSR_KERNEL_GS_BASE ,MSR_TYPE_RW ); +nested_vmx_set_intercept_for_msr (vmx, msr_bitmap_l1, msr_bitmap_l0, +MSR_KERNEL_GS_BASE ,MSR_TYPE_RW );#endif +nested_vmx_set_intercept_for_msr (vmx, msr_bitmap_l1, msr_bitmap_l0, +MSR_IA32_SPEC_CTRL ,MSR_TYPE_RW ); -/* -* Checking the L0->L1 bitmap is trying to verify two things: -* -* 1. L0 gave a permission to L1 to actually passthrough the MSR. This -* ensures that we do not accidentally generate an L02 MSR bitmap -* from the L12 MSR bitmap that is too permissive. -* 2. That L1 or L2s have actually used the MSR. This avoids -* unnecessarily merging of the bitmap if the MSR is unused. This -* works properly because we only update the L01 MSR bitmap lazily. -* So even if L0 should pass L1 these MSRs, the L01 bitmap is only -* updated to reflect this when L1 (or its L2s) actually write to -* the MSR. -*/ -if (!msr_write_intercepted_l01 (vcpu,MSR_IA32_SPEC_CTRL )) -nested_vmx_disable_intercept_for_msr ( - msr_bitmap_l1, msr_bitmap_l0, -MSR_IA32_SPEC_CTRL , -MSR_TYPE_R |MSR_TYPE_W ); - -if (!msr_write_intercepted_l01 (vcpu,MSR_IA32_PRED_CMD )) -nested_vmx_disable_intercept_for_msr ( - msr_bitmap_l1, msr_bitmap_l0, -MSR_IA32_PRED_CMD , -MSR_TYPE_W ); +nested_vmx_set_intercept_for_msr (vmx, msr_bitmap_l1, msr_bitmap_l0, +MSR_IA32_PRED_CMD ,MSR_TYPE_W ); -kvm_vcpu_unmap (vcpu, &to_vmx (vcpu)->nested.msr_bitmap_map, false); +kvm_vcpu_unmap (vcpu, &vmx->nested.msr_bitmap_map, false);return true; }
arch/x86/kvm/vmx/vmx.c +2 -53
70 lines not on this page · raw message
arch/x86/kvm/vmx/vmx.h +63 -0
69 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 157/849 KVM: nVMX: Query current VMCS when determining if MSR bitmaps are in use
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit 7dfbc624eb5726367900c8d86deff50836240361 upstream.
Check the current VMCS controls to determine if an MSR write will be intercepted due to MSR bitmaps being disabled. In the nested VMX case, KVM will disable MSR bitmaps in vmcs02 if they're disabled in vmcs12 or if KVM can't map L1's bitmaps for whatever reason.
Note, the bad behavior is relatively benign in the current code base as KVM sets all bits in vmcs02's MSR bitmap by default, clears bits if and only if L0 KVM also disables interception of an MSR, and only uses the buggy helper for MSR_IA32_SPEC_CTRL. Because KVM explicitly tests WRMSR before disabling interception of MSR_IA32_SPEC_CTRL, the flawed check will only result in KVM reading MSR_IA32_SPEC_CTRL from hardware when it isn't strictly necessary.
Tag the fix for stable in case a future fix wants to use msr_write_intercepted(), in which case a buggy implementation in older kernels could prove subtly problematic.
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/vmx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kvm/vmx/vmx.c +4 -4
@@ -770,15 +770,15 @@ void vmx_update_exception_bitmap(struct/* * Check if MSR is intercepted for currently loaded MSR bitmap. */ -static bool msr_write_intercepted (struct kvm_vcpu *vcpu,u32 msr) +static bool msr_write_intercepted (struct vcpu_vmx *vmx,u32 msr) {unsigned long *msr_bitmap;int f =sizeof (unsigned long ); -if (!cpu_has_vmx_msr_bitmap ()) +if (!(exec_controls_get (vmx) &CPU_BASED_USE_MSR_BITMAPS ))return true; - msr_bitmap =to_vmx (vcpu)->loaded_vmcs->msr_bitmap; + msr_bitmap = vmx->loaded_vmcs->msr_bitmap;if (msr <=0x1fff ) {return !!test_bit (msr, msr_bitmap +0x800 / f);
@@ -6685,7 +6685,7 @@ static fastpath_t vmx_vcpu_run(struct kv* If the L02 MSR bitmap does not intercept the MSR, then we need to * save it. */ -if (unlikely (!msr_write_intercepted (vcpu,MSR_IA32_SPEC_CTRL ))) +if (unlikely (!msr_write_intercepted (vmx,MSR_IA32_SPEC_CTRL ))) vmx->spec_ctrl =native_read_msr (MSR_IA32_SPEC_CTRL );x86_spec_ctrl_restore_host (vmx->spec_ctrl,0 );
Greg Kroah-Hartman
maintainerPATCH 139/849 perf/x86/intel/uncore: Fix Intel ICX IIO event constraints
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
commit f42e8a603c88f72bf047a710b9fc1d3579f31e71 upstream.
According to the latest uncore document, both NUM_OUTSTANDING_REQ_OF_CPU (0x88) event and COMP_BUF_OCCUPANCY(0xd5) event also have constraints. Add them into the event constraints table.
--- arch/x86/events/intel/uncore_snbep.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/events/intel/uncore_snbep.c +2 -0
@@ -5051,8 +5051,10 @@ static struct event_constraint icx_uncorUNCORE_EVENT_CONSTRAINT (0x02 ,0x3 ),UNCORE_EVENT_CONSTRAINT (0x03 ,0x3 ),UNCORE_EVENT_CONSTRAINT (0x83 ,0x3 ), +UNCORE_EVENT_CONSTRAINT (0x88 ,0xc ),UNCORE_EVENT_CONSTRAINT (0xc0 ,0xc ),UNCORE_EVENT_CONSTRAINT (0xc5 ,0xc ), +UNCORE_EVENT_CONSTRAINT (0xd5 ,0xc ), EVENT_CONSTRAINT_END };
Greg Kroah-Hartman
maintainerPATCH 150/849 power: supply: max17042_battery: Prevent int underflow in set_soc_threshold
In reply to Greg Kroah-HartmanFrom: Sebastian Krzyszkowiak <[email protected]>
commit e660dbb68c6b3f7b9eb8b9775846a44f9798b719 upstream.
max17042_set_soc_threshold gets called with offset set to 1, which means that minimum threshold value would underflow once SOC got down to 0, causing invalid alerts from the gauge.
--- drivers/power/supply/max17042_battery.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/supply/max17042_battery.c +2 -1
@@ -861,7 +861,8 @@ static void max17042_set_soc_threshold(sregmap_read (map, MAX17042_RepSOC, &soc); soc >>=8 ; soc_tr = (soc + off) <<8 ; - soc_tr |= (soc - off); +if (off < soc) + soc_tr |= soc - off;regmap_write (map, MAX17042_SALRT_Th, soc_tr); }
Greg Kroah-Hartman
maintainerPATCH 151/849 power: supply: max17042_battery: use VFSOC for capacity when no rsns
In reply to Greg Kroah-HartmanFrom: Henrik Grimler <[email protected]>
commit 223a3b82834f036a62aa831f67cbf1f1d644c6e2 upstream.
On Galaxy S3 (i9300/i9305), which has the max17047 fuel gauge and no current sense resistor (rsns), the RepSOC register does not provide an accurate state of charge value. The reported value is wrong, and does not change over time. VFSOC however, which uses the voltage fuel gauge to determine the state of charge, always shows an accurate value.
For devices without current sense, VFSOC is already used for the soc-alert (0x0003 is written to MiscCFG register), so with this change the source of the alert and the PROP_CAPACITY value match.
--- drivers/power/supply/max17042_battery.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/power/supply/max17042_battery.c +4 -1
@@ -317,7 +317,10 @@ static int max17042_get_property(struct val->intval = data *625 /8 ;break ;case POWER_SUPPLY_PROP_CAPACITY : - ret =regmap_read (map, MAX17042_RepSOC, &data); +if (chip->pdata->enable_current_sense) + ret =regmap_read (map, MAX17042_RepSOC, &data); +else + ret =regmap_read (map,MAX17042_VFSOC , &data);if (ret <0 )return ret;
Greg Kroah-Hartman
maintainerPATCH 149/849 mtd: rawnand: socrates: Keep the driver compatible with on-die ECC engines
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit b4ebddd6540d78a7f977b3fea0261bd575c6ffe2 upstream.
Following the introduction of the generic ECC engine infrastructure, it was necessary to reorganize the code and move the ECC configuration in the ->attach_chip() hook. Failing to do that properly lead to a first series of fixes supposed to stabilize the situation. Unfortunately, this only fixed the use of software ECC engines, preventing any other kind of engine to be used, including on-die ones.
It is now time to (finally) fix the situation by ensuring that we still provide a default (eg. software ECC) but will still support different ECC engines such as on-die ECC engines if properly described in the device tree.
There are no changes needed on the core side in order to do this, but we just need to leverage the logic there which allows:
1- a subsystem default (set to Host engines in the raw NAND world) 2- a driver specific default (here set to software ECC engines) 3- any type of engine requested by the user (ie. described in the DT)
As the raw NAND subsystem has not yet been fully converted to the ECC engine infrastructure, in order to provide a default ECC engine for this driver we need to set chip->ecc.engine_type *before* calling nand_scan(). During the initialization step, the core will consider this entry as the default engine for this driver. This value may of course be overloaded by the user if the usual DT properties are provided.
--- drivers/mtd/nand/raw/socrates_nand.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/socrates_nand.c +9 -3
@@ -119,9 +119,8 @@ static int socrates_nand_device_ready(ststatic int socrates_attach_chip (struct nand_chip *chip) { - chip->ecc.engine_type =NAND_ECC_ENGINE_TYPE_SOFT ; - -if (chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_SOFT && + chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) chip->ecc.algo =NAND_ECC_ALGO_HAMMING ;return 0 ;
@@ -175,6 +174,13 @@ static int socrates_nand_probe(struct pl/* TODO: I have no idea what real delay is. */ nand_chip->legacy.chip_delay =20 ;/* 20us command delay time */ +/* +* This driver assumes that the default ECC engine should be TYPE_SOFT. +* Set ->engine_type before registering the NAND devices in order to +* provide a driver specific default value. +*/ + nand_chip->ecc.engine_type =NAND_ECC_ENGINE_TYPE_SOFT ; +dev_set_drvdata (&ofdev->dev, host); res =nand_scan (nand_chip,1 );
Greg Kroah-Hartman
maintainerPATCH 162/849 powerpc/85xx: Fix oops when mpc85xx_smp_guts_ids node cannot be found
In reply to Greg Kroah-HartmanFrom: Xiaoming Ni <[email protected]>
commit 3c2172c1c47b4079c29f0e6637d764a99355ebcd upstream.
When the field described in mpc85xx_smp_guts_ids[] is not configured in dtb, the mpc85xx_setup_pmc() does not assign a value to the "guts" variable. As a result, the oops is triggered when mpc85xx_freeze_time_base() is executed.
--- arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c +1 -2
@@ -94,9 +94,8 @@ int __init mpc85xx_setup_pmc(void)pr_err ("Could not map guts node address\n" );return -ENOMEM ; } + qoriq_pm_ops = &mpc85xx_pm_ops; } - qoriq_pm_ops = &mpc85xx_pm_ops; -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 160/849 can: j1939: j1939_can_recv(): ignore messages with invalid source address
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
commit a79305e156db3d24fcd8eb649cdb3c3b2350e5c2 upstream.
According to SAE-J1939-82 2015 (A.3.6 Row 2), a receiver should never send TP.CM_CTS to the global address, so we can add a check in j1939_can_recv() to drop messages with invalid source address.
--- net/can/j1939/main.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/can/j1939/main.c +7 -0
@@ -75,6 +75,13 @@ static void j1939_can_recv(struct sk_buf skcb->addr.pgn = (cf->can_id >>8 ) &J1939_PGN_MAX ;/* set default message type */ skcb->addr.type =J1939_TP ; + +if (!j1939_address_is_valid (skcb->addr.sa)) { +netdev_err_once (priv->ndev,"%s: sa is broadcast address, ignoring!\n" , + __func__); + goto done; + } +if (j1939_pgn_is_pdu1 (skcb->addr.pgn)) {/* Type 1: with destination address */ skcb->addr.da = skcb->addr.pgn;
Greg Kroah-Hartman
maintainerPATCH 163/849 ring-buffer: Protect ring_buffer_reset() from reentrancy
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
commit 51d157946666382e779f94c39891e8e9a020da78 upstream.
The resetting of the entire ring buffer use to simply go through and reset each individual CPU buffer that had its own protection and synchronization. But this was very slow, due to performing a synchronization for each CPU. The code was reshuffled to do one disabling of all CPU buffers, followed by a single RCU synchronization, and then the resetting of each of the CPU buffers. But unfortunately, the mutex that prevented multiple occurrences of resetting the buffer was not moved to the upper function, and there is nothing to protect from it.
Take the ring buffer mutex around the global reset.
--- kernel/trace/ring_buffer.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/trace/ring_buffer.c +5 -0
@@ -5233,6 +5233,9 @@ void ring_buffer_reset(struct trace_buffstruct ring_buffer_per_cpu *cpu_buffer;int cpu; +/* prevent another thread from changing buffer sizes */ +mutex_lock (&buffer->mutex); +for_each_buffer_cpu (buffer, cpu) { cpu_buffer = buffer->buffers[cpu];
@@ -5251,6 +5254,8 @@ void ring_buffer_reset(struct trace_buffatomic_dec (&cpu_buffer->record_disabled);atomic_dec (&cpu_buffer->resize_disabled); } + +mutex_unlock (&buffer->mutex); }EXPORT_SYMBOL_GPL (ring_buffer_reset);
Greg Kroah-Hartman
maintainerPATCH 166/849 xen/balloon: add late_initcall_sync() for initial ballooning done
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit 40fdea0284bb20814399da0484a658a96c735d90 upstream.
When running as PVH or HVM guest with actual memory < max memory the hypervisor is using "populate on demand" in order to allow the guest to balloon down from its maximum memory size. For this to work correctly the guest must not touch more memory pages than its target memory size as otherwise the PoD cache will be exhausted and the guest is crashed as a result of that.
In extreme cases ballooning down might not be finished today before the init process is started, which can consume lots of memory.
In order to avoid random boot crashes in such cases, add a late init call to wait for ballooning down having finished for PVH/HVM guests.
Warn on console if initial ballooning fails, panic() after stalling for more than 3 minutes per default. Add a module parameter for changing this timeout.
[boris: replaced pr_info() with pr_notice()]
--- Documentation/admin-guide/kernel-parameters.txt | 7 + drivers/xen/balloon.c | 86 +++++++++++++++++------- 2 files changed, 70 insertions(+), 23 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +7 -0
@@ -6311,6 +6311,13 @@ improve timer resolution at the expense of processing more timer interrupts. + xen.balloon_boot_timeout= [XEN] + The time (in seconds) to wait before giving up to boot + in case initial ballooning fails to free enough memory. + Applies only when running as HVM or PVH guest and + started with less memory configured than allowed at + max. Default is 180. + xen.event_eoi_delay= [XEN] How long to delay EOI handling in case of event storms (jiffies). Default is 10.
drivers/xen/balloon.c +63 -23
173 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 140/849 RDMA/qedr: Fix NULL deref for query_qp on the GSI QP
In reply to Greg Kroah-HartmanFrom: Alok Prasad <[email protected]>
commit 4f960393a0ee9a39469ceb7c8077ae8db665cc12 upstream.
This patch fixes a crash caused by querying the QP via netlink, and corrects the state of GSI qp. GSI qp's have a NULL qed_qp.
The call trace is generated by:
$ rdma res show
BUG: kernel NULL pointer dereference, address: 0000000000000034 Hardware name: Dell Inc. PowerEdge R720/0M1GCR, BIOS 1.2.6 05/10/2012 RIP: 0010:qed_rdma_query_qp+0x33/0x1a0 [qed] RSP: 0018:ffffba560a08f580 EFLAGS: 00010206 RAX: 0000000200000000 RBX: ffffba560a08f5b8 RCX: 0000000000000000 RDX: ffffba560a08f5b8 RSI: 0000000000000000 RDI: ffff9807ee458090 RBP: ffffba560a08f5a0 R08: 0000000000000000 R09: ffff9807890e7048 R10: ffffba560a08f658 R11: 0000000000000000 R12: 0000000000000000 R13: ffff9807ee458090 R14: ffff9807f0afb000 R15: ffffba560a08f7ec FS: 00007fbbf8bfe740(0000) GS:ffff980aafa00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000034 CR3: 00000001720ba001 CR4: 00000000000606f0 Call Trace: qedr_query_qp+0x82/0x360 [qedr] ib_query_qp+0x34/0x40 [ib_core] ? ib_query_qp+0x34/0x40 [ib_core] fill_res_qp_entry_query.isra.26+0x47/0x1d0 [ib_core] ? __nla_put+0x20/0x30 ? nla_put+0x33/0x40 fill_res_qp_entry+0xe3/0x120 [ib_core] res_get_common_dumpit+0x3f8/0x5d0 [ib_core] ? fill_res_cm_id_entry+0x1f0/0x1f0 [ib_core] nldev_res_get_qp_dumpit+0x1a/0x20 [ib_core] netlink_dump+0x156/0x2f0 __netlink_dump_start+0x1ab/0x260 rdma_nl_rcv+0x1de/0x330 [ib_core] ? nldev_res_get_cm_id_dumpit+0x20/0x20 [ib_core] netlink_unicast+0x1b8/0x270 netlink_sendmsg+0x33e/0x470 sock_sendmsg+0x63/0x70 __sys_sendto+0x13f/0x180 ? setup_sgl.isra.12+0x70/0xc0 __x64_sys_sendto+0x28/0x30 do_syscall_64+0x3a/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xae
--- drivers/infiniband/hw/qedr/verbs.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/infiniband/hw/qedr/verbs.c +9 -6
@@ -2758,15 +2758,18 @@ int qedr_query_qp(struct ib_qp *ibqp,int rc =0 ;memset (¶ms,0 ,sizeof (params)); - - rc = dev->ops->rdma_query_qp (dev->rdma_ctx, qp->qed_qp, ¶ms); -if (rc) - goto err; -memset (qp_attr,0 ,sizeof (*qp_attr));memset (qp_init_attr,0 ,sizeof (*qp_init_attr)); - qp_attr->qp_state =qedr_get_ibqp_state (params.state); +if (qp->qp_type !=IB_QPT_GSI ) { + rc = dev->ops->rdma_query_qp (dev->rdma_ctx, qp->qed_qp, ¶ms); +if (rc) + goto err; + qp_attr->qp_state =qedr_get_ibqp_state (params.state); + }else { + qp_attr->qp_state =qedr_get_ibqp_state (QED_ROCE_QP_STATE_RTS ); + } + qp_attr->cur_qp_state =qedr_get_ibqp_state (params.state); qp_attr->path_mtu =ib_mtu_int_to_enum (params.mtu); qp_attr->path_mig_state =IB_MIG_MIGRATED ;
Greg Kroah-Hartman
maintainerPATCH 164/849 serial: core: Fix initializing and restoring termios speed
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 027b57170bf8bb6999a28e4a5f3d78bf1db0f90c upstream.
Since commit edc6afc54968 ("tty: switch to ktermios and new framework") termios speed is no longer stored only in c_cflag member but also in new additional c_ispeed and c_ospeed members. If BOTHER flag is set in c_cflag then termios speed is stored only in these new members.
Therefore to correctly restore termios speed it is required to store also ispeed and ospeed members, not only cflag member.
In case only cflag member with BOTHER flag is restored then functions tty_termios_baud_rate() and tty_termios_input_baud_rate() returns baudrate stored in c_ospeed / c_ispeed member, which is zero as it was not restored too. If reported baudrate is invalid (e.g. zero) then serial core functions report fallback baudrate value 9600. So it means that in this case original baudrate is lost and kernel changes it to value 9600.
Simple reproducer of this issue is to boot kernel with following command line argument: "console=ttyXXX,86400" (where ttyXXX is the device name). For speed 86400 there is no Bnnn constant and therefore kernel has to represent this speed via BOTHER c_cflag. Which means that speed is stored only in c_ospeed and c_ispeed members, not in c_cflag anymore.
If bootloader correctly configures serial device to speed 86400 then kernel prints boot log to early console at speed speed 86400 without any issue. But after kernel starts initializing real console device ttyXXX then speed is changed to fallback value 9600 because information about speed was lost.
This patch fixes above issue by storing and restoring also ispeed and ospeed members, which are required for BOTHER flag.
--- drivers/tty/serial/serial_core.c | 16 ++++++++++++++-- include/linux/console.h | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/tty/serial/serial_core.c +14 -2
@@ -222,7 +222,11 @@ static int uart_port_startup(struct tty_if (retval ==0 ) {if (uart_console (uport) && uport->cons->cflag) { tty->termios.c_cflag = uport->cons->cflag; + tty->termios.c_ispeed = uport->cons->ispeed; + tty->termios.c_ospeed = uport->cons->ospeed; uport->cons->cflag =0 ; + uport->cons->ispeed =0 ; + uport->cons->ospeed =0 ; }/* * Initialise the hardware port settings.
@@ -290,8 +294,11 @@ static void uart_shutdown(struct tty_str/* * Turn off DTR and RTS early. */ -if (uport &&uart_console (uport) && tty) +if (uport &&uart_console (uport) && tty) { uport->cons->cflag = tty->termios.c_cflag; + uport->cons->ispeed = tty->termios.c_ispeed; + uport->cons->ospeed = tty->termios.c_ospeed; + }if (!tty ||C_HUPCL (tty))uart_port_dtr_rts (uport,0 );
@@ -2094,8 +2101,11 @@ uart_set_options(struct uart_port *port,* Allow the setting of the UART parameters with a NULL console * too: */ -if (co) +if (co) { co->cflag = termios.c_cflag; + co->ispeed = termios.c_ispeed; + co->ospeed = termios.c_ospeed; + }return 0 ; }
@@ -2229,6 +2239,8 @@ int uart_resume_port(struct uart_driver*/ memset (&termios,0 ,sizeof (struct ktermios )); termios.c_cflag = uport->cons->cflag; + termios.c_ispeed = uport->cons->ispeed; + termios.c_ospeed = uport->cons->ospeed;/* * If that's unset, use the tty termios setting.
include/linux/console.h +2 -0
@@ -149,6 +149,8 @@ struct console {short flags;short index;int cflag; +uint ispeed; +uint ospeed;void *data;struct console *next; };
Greg Kroah-Hartman
maintainerPATCH 169/849 PCI: cadence: Add cdns_plat_pcie_probe() missing return
In reply to Greg Kroah-HartmanFrom: Li Chen <[email protected]>
commit 27cd7e3c9bb1ae13bc16f08138edd6e4df3cd211 upstream.
When cdns_plat_pcie_probe() succeeds, return success instead of falling into the error handling code.
--- drivers/pci/controller/cadence/pcie-cadence-plat.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/cadence/pcie-cadence-plat.c +2 -0
@@ -127,6 +127,8 @@ static int cdns_plat_pcie_probe(struct p goto err_init; } +return 0 ; + err_init: err_get_sync:pm_runtime_put_sync (dev);
Greg Kroah-Hartman
maintainerPATCH 172/849 PCI: aardvark: Fix checking for link up via LTSSM state
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 661c399a651c11aaf83c45cbfe0b4a1fb7bc3179 upstream.
Current implementation of advk_pcie_link_up() is wrong as it marks also link disabled or hot reset states as link up.
Fix it by marking link up only to those states which are defined in PCIe Base specification 3.0, Table 4-14: Link Status Mapped to the LTSSM.
To simplify implementation, Define macros for every LTSSM state which aardvark hardware can return in CFG_REG register.
Fix also checking for link training according to the same Table 4-14. Define a new function advk_pcie_link_training() for this purpose.
--- drivers/pci/controller/pci-aardvark.c | 76 +++++++++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 6 deletions(-)
drivers/pci/controller/pci-aardvark.c +70 -6
@@ -164,8 +164,50 @@#define CFG_REG (LMI_BASE_ADDR + 0x0)#define LTSSM_SHIFT 24#define LTSSM_MASK 0x3f -#define LTSSM_L0 0x10#define RC_BAR_CONFIG 0x300 + +/* LTSSM values in CFG_REG */ +enum { +LTSSM_DETECT_QUIET =0x0 , +LTSSM_DETECT_ACTIVE =0x1 , +LTSSM_POLLING_ACTIVE =0x2 , +LTSSM_POLLING_COMPLIANCE =0x3 , +LTSSM_POLLING_CONFIGURATION =0x4 , +LTSSM_CONFIG_LINKWIDTH_START =0x5 , +LTSSM_CONFIG_LINKWIDTH_ACCEPT =0x6 , +LTSSM_CONFIG_LANENUM_ACCEPT =0x7 , +LTSSM_CONFIG_LANENUM_WAIT =0x8 , +LTSSM_CONFIG_COMPLETE =0x9 , +LTSSM_CONFIG_IDLE =0xa , +LTSSM_RECOVERY_RCVR_LOCK =0xb , +LTSSM_RECOVERY_SPEED =0xc , +LTSSM_RECOVERY_RCVR_CFG =0xd , +LTSSM_RECOVERY_IDLE =0xe , +LTSSM_L0 =0x10 , +LTSSM_RX_L0S_ENTRY =0x11 , +LTSSM_RX_L0S_IDLE =0x12 , +LTSSM_RX_L0S_FTS =0x13 , +LTSSM_TX_L0S_ENTRY =0x14 , +LTSSM_TX_L0S_IDLE =0x15 , +LTSSM_TX_L0S_FTS =0x16 , +LTSSM_L1_ENTRY =0x17 , +LTSSM_L1_IDLE =0x18 , +LTSSM_L2_IDLE =0x19 , +LTSSM_L2_TRANSMIT_WAKE =0x1a , +LTSSM_DISABLED =0x20 , +LTSSM_LOOPBACK_ENTRY_MASTER =0x21 , +LTSSM_LOOPBACK_ACTIVE_MASTER =0x22 , +LTSSM_LOOPBACK_EXIT_MASTER =0x23 , +LTSSM_LOOPBACK_ENTRY_SLAVE =0x24 , +LTSSM_LOOPBACK_ACTIVE_SLAVE =0x25 , +LTSSM_LOOPBACK_EXIT_SLAVE =0x26 , +LTSSM_HOT_RESET =0x27 , +LTSSM_RECOVERY_EQUALIZATION_PHASE0 =0x28 , +LTSSM_RECOVERY_EQUALIZATION_PHASE1 =0x29 , +LTSSM_RECOVERY_EQUALIZATION_PHASE2 =0x2a , +LTSSM_RECOVERY_EQUALIZATION_PHASE3 =0x2b , +}; +#define VENDOR_ID_REG (LMI_BASE_ADDR + 0x44)/* PCIe core controller registers */
@@ -262,13 +304,35 @@ static inline u16 advk_read16(struct advreturn advk_readl (pcie, (reg & ~0x3 )) >> ((reg &0x3 ) *8 ); } -static int advk_pcie_link_up (struct advk_pcie *pcie) +static u8 advk_pcie_ltssm_state (struct advk_pcie *pcie) { -u32 val, ltssm_state; +u32 val; +u8 ltssm_state; val =advk_readl (pcie,CFG_REG ); ltssm_state = (val >>LTSSM_SHIFT ) <SSM_MASK ; -return ltssm_state >=LTSSM_L0 ; +return ltssm_state; +} + +static inline bool advk_pcie_link_up (struct advk_pcie *pcie) +{ +/* check if LTSSM is in normal operation - some L* state */ +u8 ltssm_state =advk_pcie_ltssm_state (pcie); +return ltssm_state >=LTSSM_L0 && ltssm_state <LTSSM_DISABLED ; +} + +static inline bool advk_pcie_link_training (struct advk_pcie *pcie) +{ +/* +* According to PCIe Base specification 3.0, Table 4-14: Link +* Status Mapped to the LTSSM is Link Training mapped to LTSSM +* Configuration and Recovery states. +*/ +u8 ltssm_state =advk_pcie_ltssm_state (pcie); +return ((ltssm_state >=LTSSM_CONFIG_LINKWIDTH_START && + ltssm_state <LTSSM_L0 ) || + (ltssm_state >=LTSSM_RECOVERY_EQUALIZATION_PHASE0 && + ltssm_state <=LTSSM_RECOVERY_EQUALIZATION_PHASE3 )); }static int advk_pcie_wait_for_link (struct advk_pcie *pcie)
@@ -291,7 +355,7 @@ static void advk_pcie_wait_for_retrain(ssize_t retries;for (retries =0 ; retries <RETRAIN_WAIT_MAX_RETRIES ; ++retries) { -if (!advk_pcie_link_up (pcie)) +if (advk_pcie_link_training (pcie))break ;udelay (RETRAIN_WAIT_USLEEP_US ); }
@@ -738,7 +802,7 @@ advk_pci_bridge_emul_pcie_conf_read(stru/* u32 contains both PCI_EXP_LNKCTL and PCI_EXP_LNKSTA */ u32 val =advk_readl (pcie,PCIE_CORE_PCIEXP_CAP + reg) & ~(PCI_EXP_LNKSTA_LT <<16 ); -if (!advk_pcie_link_up (pcie)) +if (advk_pcie_link_training (pcie)) val |= (PCI_EXP_LNKSTA_LT <<16 ); *value = val;return PCI_BRIDGE_EMUL_HANDLED ;
Greg Kroah-Hartman
maintainerPATCH 145/849 signal/mips: Update (_save|_restore)_fp_context to fail with -EFAULT
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
commit 95bf9d646c3c3f95cb0be7e703b371db8da5be68 upstream.
When an instruction to save or restore a register from the stack fails in _save_fp_context or _restore_fp_context return with -EFAULT. This change was made to r2300_fpu.S[1] but it looks like it got lost with the introduction of EX2[2]. This is also what the other implementation of _save_fp_context and _restore_fp_context in r4k_fpu.S does, and what is needed for the callers to be able to handle the error.
Furthermore calling do_exit(SIGSEGV) from bad_stack is wrong because it does not terminate the entire process it just terminates a single thread.
As the changed code was the only caller of arch/mips/kernel/syscall.c:bad_stack remove the problematic and now unused helper function.
Cc: Thomas Bogendoerfer <[email protected]>
Cc: Maciej Rozycki <[email protected]>
Cc: [email protected]
[1] 35938a00ba86 ("MIPS: Fix ISA I FP sigcontext access violation handling")
[2] f92722dc4545 ("MIPS: Correct MIPS I FP sigcontext layout")
--- arch/mips/kernel/r2300_fpu.S | 4 ++-- arch/mips/kernel/syscall.c | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-)
arch/mips/kernel/r2300_fpu.S +2 -2
@@ -29,8 +29,8 @@ #define EX2(a,b) \ 9: a,##b; \ .section __ex_table,"a"; \ - PTR 9b,bad_stack; \ - PTR 9b+4,bad_stack; \ + PTR 9b,fault; \ + PTR 9b+4,fault; \ .previous .set mips1
arch/mips/kernel/syscall.c +0 -9
@@ -240,12 +240,3 @@ SYSCALL_DEFINE3(cachectl, char *, addr, {return -ENOSYS ; } - -/* -* If we ever come here the user sp is bad. Zap the process right away. -* Due to the bad stack signaling wouldn't work. -*/ -asmlinkage void bad_stack(void) -{ -do_exit (SIGSEGV ); -}
Greg Kroah-Hartman
maintainerPATCH 171/849 PCI: aardvark: Do not clear status bits of masked interrupts
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit a7ca6d7fa3c02c032db5440ff392d96c04684c21 upstream.
The PCIE_ISR1_REG says which interrupts are currently set / active, including those which are masked.
The driver currently reads this register and looks if some unmasked interrupts are active, and if not, it clears status bits of _all_ interrupts, including the masked ones.
This is incorrect, since, for example, some drivers may poll these bits.
Remove this clearing, and also remove this early return statement completely, since it does not change functionality in any way.
--- drivers/pci/controller/pci-aardvark.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/pci/controller/pci-aardvark.c +0 -6
@@ -1286,12 +1286,6 @@ static void advk_pcie_handle_int(struct isr1_mask =advk_readl (pcie,PCIE_ISR1_MASK_REG ); isr1_status = isr1_val & ((~isr1_mask) &PCIE_ISR1_ALL_MASK ); -if (!isr0_status && !isr1_status) { -advk_writel (pcie, isr0_val,PCIE_ISR0_REG ); -advk_writel (pcie, isr1_val,PCIE_ISR1_REG ); -return ; - } -/* Process MSI interrupts */ if (isr0_status &PCIE_ISR0_MSI_INT_PENDING )advk_pcie_handle_msi (pcie);
Greg Kroah-Hartman
maintainerPATCH 170/849 cxl/pci: Fix NULL vs ERR_PTR confusion
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
commit ca76a3a8052b71c0334d5c094859cfa340c290a8 upstream.
cxl_pci_map_regblock() may return an ERR_PTR(), but cxl_pci_setup_regs() is only prepared for NULL as the error case. Pick the minimal fix for -stable backport purposes and just have cxl_pci_map_regblock() return NULL for errors.
--- drivers/cxl/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/pci.c +1 -1
@@ -970,7 +970,7 @@ static void __iomem *cxl_mem_map_regblocif (pci_resource_len (pdev, bar) < offset) {dev_err (dev,"BAR%d: %pr: too small (offset: %#llx)\n" , bar, &pdev->resource[bar], (unsigned long long )offset); -return IOMEM_ERR_PTR (-ENXIO ); +return NULL ; } addr =pci_iomap (pdev, bar,0 );
Greg Kroah-Hartman
maintainerPATCH 141/849 ASoC: tegra: Set default card name for Trimslice
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
commit 824edd866a13db7dbb0d8e26d2142f10271b6460 upstream.
The default card name for Trimslice device should be "tegra-trimslice". It got lost by accident during unification of machine sound drivers, fix it.
--- sound/soc/tegra/tegra_asoc_machine.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/tegra/tegra_asoc_machine.c +1 -0
@@ -686,6 +686,7 @@ static struct snd_soc_dai_link tegra_tlv };static struct snd_soc_card snd_soc_tegra_trimslice = { + .name ="tegra-trimslice" , .components ="codec:tlv320aic23" , .dai_link = &tegra_tlv320aic23_dai, .num_links =1 ,
Greg Kroah-Hartman
maintainerPATCH 146/849 soc: samsung: exynos-pmu: Fix compilation when nothing selects CONFIG_MFD_CORE
In reply to Greg Kroah-HartmanFrom: David Virag <[email protected]>
commit e37ef6dcdb1f4738b01cec7fb7be46af07816af9 upstream.
Commit 93618e344a5e ("soc: samsung: exynos-pmu: instantiate clkout driver as MFD") adds a "devm_mfd_add_devices" call in the exynos-pmu driver which depends on CONFIG_MFD_CORE. If no driver selects that config, the build will fail if CONFIG_EXYNOS_PMU is enabled with the following error:
drivers/soc/samsung/exynos-pmu.c:137: undefined reference to `devm_mfd_add_devices'
Fix this by making CONFIG_EXYNOS_PMU select CONFIG_MFD_CORE.
--- drivers/soc/samsung/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/soc/samsung/Kconfig +1 -0
@@ -25,6 +25,7 @@ config EXYNOS_PMU bool "Exynos PMU controller driver" if COMPILE_TEST depends on ARCH_EXYNOS || ((ARM || ARM64) && COMPILE_TEST) select EXYNOS_PMU_ARM_DRIVERS if ARM && ARCH_EXYNOS + select MFD_CORE # There is no need to enable these drivers for ARMv8 config EXYNOS_PMU_ARM_DRIVERS
Greg Kroah-Hartman
maintainerPATCH 143/849 signal: Remove the bogus sigkill_pending in ptrace_stop
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
commit 7d613f9f72ec8f90ddefcae038fdae5adb8404b3 upstream.
The existence of sigkill_pending is a little silly as it is functionally a duplicate of fatal_signal_pending that is used in exactly one place.
Checking for pending fatal signals and returning early in ptrace_stop is actively harmful. It casues the ptrace_stop called by ptrace_signal to return early before setting current->exit_code. Later when ptrace_signal reads the signal number from current->exit_code is undefined, making it unpredictable what will happen.
Instead rely on the fact that schedule will not sleep if there is a pending signal that can awaken a task.
Removing the explict sigkill_pending test fixes fixes ptrace_signal when ptrace_stop does not stop because current->exit_code is always set to to signr.
--- kernel/signal.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
kernel/signal.c +4 -14
@@ -2109,15 +2109,6 @@ static inline bool may_ptrace_stop(void)return true; } -/* -* Return non-zero if there is a SIGKILL that should be waking us up. -* Called with the siglock held. -*/ -static bool sigkill_pending (struct task_struct *tsk) -{ -return sigismember (&tsk->pending.signal,SIGKILL ) || -sigismember (&tsk->signal->shared_pending.signal,SIGKILL ); -}/* * This must be called with current->sighand->siglock held.
@@ -2144,17 +2135,16 @@ static void ptrace_stop(int exit_code, i* calling arch_ptrace_stop, so we must release it now. * To preserve proper semantics, we must do this before * any signal bookkeeping like checking group_stop_count. -* Meanwhile, a SIGKILL could come in before we retake the -* siglock. That must prevent us from sleeping in TASK_TRACED. -* So after regaining the lock, we must check for SIGKILL. */ spin_unlock_irq (¤t->sighand->siglock);arch_ptrace_stop (exit_code, info);spin_lock_irq (¤t->sighand->siglock); -if (sigkill_pending (current)) -return ; } +/* +* schedule() will not sleep if there is a pending signal that +* can awaken the task. +*/ set_special_state (TASK_TRACED );/*
Greg Kroah-Hartman
maintainerPATCH 144/849 memory: renesas-rpc-if: Correct QSPI data transfer in Manual mode
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
commit fff53a551db50f5edecaa0b29a64056ab8d2bbca upstream.
This patch fixes 2 problems:
[1] The output warning logs and data loss when performing mount/umount then remount the device with jffs2 format.
[2] The access width of SMWDR[0:1]/SMRDR[0:1] register is wrong.
This is the sample warning logs when performing mount/umount then remount the device with jffs2 format:
jffs2: jffs2_scan_inode_node(): CRC failed on node at 0x031c51d4:
Read 0x00034e00, calculated 0xadb272a7
The reason for issue [1] is that the writing data seems to get messed up.
Data is only completed when the number of bytes is divisible by 4. If you only have 3 bytes of data left to write, 1 garbage byte is inserted after the end of the write stream.
If you only have 2 bytes of data left to write, 2 bytes of '00' are added into the write stream.
If you only have 1 byte of data left to write, 2 bytes of '00' are added into the write stream. 1 garbage byte is inserted after the end of the write stream.
To solve problem [1], data must be written continuously in serial and the write stream ends when data is out.
Following HW manual 62.2.15, access to SMWDR0 register should be in the same size as the transfer size specified in the SPIDE[3:0] bits in the manual mode enable setting register (SMENR). Be sure to access from address 0.
So, in 16-bit transfer (SPIDE[3:0]=b'1100), SMWDR0 should be accessed by 16-bit width.
Similar to SMWDR1, SMDDR0/1 registers.
In current code, SMWDR0 register is accessed by regmap_write() that only set up to do 32-bit width.
To solve problem [2], data must be written 16-bit or 8-bit when transferring 1-byte or 2-byte.
--- drivers/memory/renesas-rpc-if.c | 113 +++++++++++++++++++++++++++------------- include/memory/renesas-rpc-if.h | 1 2 files changed, 79 insertions(+), 35 deletions(-)
drivers/memory/renesas-rpc-if.c +78 -35
@@ -160,10 +160,62 @@ static const struct regmap_access_table .n_yes_ranges = ARRAY_SIZE(rpcif_volatile_ranges), }; + +/* +* Custom accessor functions to ensure SMRDR0 and SMWDR0 are always accessed +* with proper width. Requires SMENR_SPIDE to be correctly set before! +*/ +static int rpcif_reg_read (void *context,unsigned int reg,unsigned int *val) +{ +struct rpcif *rpc = context; + +if (reg ==RPCIF_SMRDR0 || reg ==RPCIF_SMWDR0 ) { +u32 spide =readl (rpc->base +RPCIF_SMENR ) &RPCIF_SMENR_SPIDE (0xF ); + +if (spide ==0x8 ) { + *val =readb (rpc->base + reg); +return 0 ; + }else if (spide ==0xC ) { + *val =readw (rpc->base + reg); +return 0 ; + }else if (spide !=0xF ) { +return -EILSEQ ; + } + } + + *val =readl (rpc->base + reg); +return 0 ; + +} + +static int rpcif_reg_write (void *context,unsigned int reg,unsigned int val) +{ +struct rpcif *rpc = context; + +if (reg ==RPCIF_SMRDR0 || reg ==RPCIF_SMWDR0 ) { +u32 spide =readl (rpc->base +RPCIF_SMENR ) &RPCIF_SMENR_SPIDE (0xF ); + +if (spide ==0x8 ) { +writeb (val, rpc->base + reg); +return 0 ; + }else if (spide ==0xC ) { +writew (val, rpc->base + reg); +return 0 ; + }else if (spide !=0xF ) { +return -EILSEQ ; + } + } + +writel (val, rpc->base + reg); +return 0 ; +} +static const struct regmap_config rpcif_regmap_config = { .reg_bits =32 , .val_bits =32 , .reg_stride =4 , + .reg_read = rpcif_reg_read, + .reg_write = rpcif_reg_write, .fast_io = true, .max_register =RPCIF_PHYINT , .volatile_table = &rpcif_volatile_table,
@@ -173,17 +225,15 @@ int rpcif_sw_init(struct rpcif *rpc, str {struct platform_device *pdev =to_platform_device (dev);struct resource *res; -void __iomem *base; rpc->dev = dev; res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"regs" ); - base =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (base)) -return PTR_ERR (base); + rpc->base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (rpc->base)) +return PTR_ERR (rpc->base); - rpc->regmap =devm_regmap_init_mmio (&pdev->dev, base, - &rpcif_regmap_config); + rpc->regmap =devm_regmap_init (&pdev->dev,NULL , rpc, &rpcif_regmap_config);if (IS_ERR (rpc->regmap)) { dev_err(&pdev->dev, "failed to init regmap for rpcif, error %ld\n",
@@ -354,20 +404,16 @@ void rpcif_prepare(struct rpcif *rpc, co nbytes = op->data.nbytes; rpc->xferlen = nbytes; - rpc->enable |=RPCIF_SMENR_SPIDE (rpcif_bits_set (rpc, nbytes)) | -RPCIF_SMENR_SPIDB (rpcif_bit_size (op->data.buswidth)); + rpc->enable |=RPCIF_SMENR_SPIDB (rpcif_bit_size (op->data.buswidth)); } }EXPORT_SYMBOL (rpcif_prepare);int rpcif_manual_xfer (struct rpcif *rpc) { -u32 smenr, smcr, pos =0 , max =4 ; +u32 smenr, smcr, pos =0 , max = rpc->bus_size ==2 ?8 :4 ;int ret =0 ; -if (rpc->bus_size ==2 ) - max =8 ; -pm_runtime_get_sync (rpc->dev); regmap_update_bits(rpc->regmap, RPCIF_PHYCNT,
@@ -378,37 +424,36 @@ int rpcif_manual_xfer(struct rpcif *rpc)regmap_write (rpc->regmap,RPCIF_SMOPR , rpc->option);regmap_write (rpc->regmap,RPCIF_SMDMCR , rpc->dummy);regmap_write (rpc->regmap,RPCIF_SMDRENR , rpc->ddr); +regmap_write (rpc->regmap,RPCIF_SMADR , rpc->smadr); smenr = rpc->enable;switch (rpc->dir) {case RPCIF_DATA_OUT :while (pos < rpc->xferlen) { -u32 nbytes = rpc->xferlen - pos; -u32 data[2 ]; +u32 bytes_left = rpc->xferlen - pos; +u32 nbytes, data[2 ]; smcr = rpc->smcr |RPCIF_SMCR_SPIE ; -if (nbytes > max) { - nbytes = max; + +/* nbytes may only be 1, 2, 4, or 8 */ + nbytes = bytes_left >= max ? max : (1 <<ilog2 (bytes_left)); +if (bytes_left > nbytes) smcr |=RPCIF_SMCR_SSLKP ; - } + + smenr |=RPCIF_SMENR_SPIDE (rpcif_bits_set (rpc, nbytes)); +regmap_write (rpc->regmap,RPCIF_SMENR , smenr);memcpy (data, rpc->buffer + pos, nbytes); -if (nbytes >4 ) { +if (nbytes ==8 ) {regmap_write (rpc->regmap,RPCIF_SMWDR1 , data[0 ]);regmap_write (rpc->regmap,RPCIF_SMWDR0 , data[1 ]); - }else if (nbytes >2 ) { + }else {regmap_write (rpc->regmap,RPCIF_SMWDR0 , data[0 ]); - }else { -regmap_write (rpc->regmap,RPCIF_SMWDR0 , - data[0 ] <<16 ); } -regmap_write (rpc->regmap,RPCIF_SMADR , - rpc->smadr + pos); -regmap_write (rpc->regmap,RPCIF_SMENR , smenr);regmap_write (rpc->regmap,RPCIF_SMCR , smcr); ret =wait_msg_xfer_end (rpc);if (ret)
@@ -448,14 +493,16 @@ int rpcif_manual_xfer(struct rpcif *rpc)break ; }while (pos < rpc->xferlen) { -u32 nbytes = rpc->xferlen - pos; -u32 data[2 ]; +u32 bytes_left = rpc->xferlen - pos; +u32 nbytes, data[2 ]; -if (nbytes > max) - nbytes = max; +/* nbytes may only be 1, 2, 4, or 8 */ + nbytes = bytes_left >= max ? max : (1 <<ilog2 (bytes_left));regmap_write (rpc->regmap,RPCIF_SMADR , rpc->smadr + pos); + smenr &= ~RPCIF_SMENR_SPIDE (0xF ); + smenr |=RPCIF_SMENR_SPIDE (rpcif_bits_set (rpc, nbytes));regmap_write (rpc->regmap,RPCIF_SMENR , smenr);regmap_write (rpc->regmap,RPCIF_SMCR , rpc->smcr |RPCIF_SMCR_SPIE );
@@ -463,18 +510,14 @@ int rpcif_manual_xfer(struct rpcif *rpc)if (ret) goto err_out; -if (nbytes >4 ) { +if (nbytes ==8 ) {regmap_read (rpc->regmap,RPCIF_SMRDR1 , &data[0 ]);regmap_read (rpc->regmap,RPCIF_SMRDR0 , &data[1 ]); - }else if (nbytes >2 ) { -regmap_read (rpc->regmap,RPCIF_SMRDR0 , - &data[0 ]); - }else { + }else {regmap_read (rpc->regmap,RPCIF_SMRDR0 , &data[0 ]); - data[0 ] >>=16 ; }memcpy (rpc->buffer + pos, data, nbytes);
include/memory/renesas-rpc-if.h +1 -0
@@ -59,6 +59,7 @@ struct rpcif_op {struct rpcif {struct device *dev; +void __iomem *base;void __iomem *dirmap;struct regmap *regmap;struct reset_control *rstc;
Greg Kroah-Hartman
maintainerPATCH 142/849 ASoC: tegra: Restore AC97 support
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
commit de8fc2b0a3f9930f3cbe801d40758bb1d80b0ad8 upstream.
The device-tree of AC97 codecs need to be parsed differently from I2S codecs, plus codec device may need to be created. This was missed by the patch that unified machine drivers into a single driver, fix it. It should restore audio on Toradex Colibri board.
--- sound/soc/tegra/tegra_asoc_machine.c | 63 ++++++++++++++++++++++++++++------- sound/soc/tegra/tegra_asoc_machine.h | 1 2 files changed, 52 insertions(+), 12 deletions(-)
sound/soc/tegra/tegra_asoc_machine.c +51 -12
@@ -341,9 +341,34 @@ tegra_machine_parse_phandle(struct devicreturn np; } +static void tegra_machine_unregister_codec (void *pdev) +{ +platform_device_unregister (pdev); +} + +static int tegra_machine_register_codec (struct device *dev,const char *name) +{ +struct platform_device *pdev; +int err; + +if (!name) +return 0 ; + + pdev =platform_device_register_simple (name,-1 ,NULL ,0 ); +if (IS_ERR (pdev)) +return PTR_ERR (pdev); + + err =devm_add_action_or_reset (dev, tegra_machine_unregister_codec, + pdev); +if (err) +return err; + +return 0 ; +} +int tegra_asoc_machine_probe (struct platform_device *pdev) { -struct device_node *np_codec, *np_i2s; +struct device_node *np_codec, *np_i2s, *np_ac97;const struct tegra_asoc_data *asoc;struct device *dev = &pdev->dev;struct tegra_machine *machine;
@@ -404,17 +429,30 @@ int tegra_asoc_machine_probe(struct platreturn err; } - np_codec =tegra_machine_parse_phandle (dev,"nvidia,audio-codec" ); -if (IS_ERR (np_codec)) -return PTR_ERR (np_codec); - - np_i2s =tegra_machine_parse_phandle (dev,"nvidia,i2s-controller" ); -if (IS_ERR (np_i2s)) -return PTR_ERR (np_i2s); - - card->dai_link->cpus->of_node = np_i2s; - card->dai_link->codecs->of_node = np_codec; - card->dai_link->platforms->of_node = np_i2s; +if (asoc->set_ac97) { + err =tegra_machine_register_codec (dev, asoc->codec_dev_name); +if (err) +return err; + + np_ac97 =tegra_machine_parse_phandle (dev,"nvidia,ac97-controller" ); +if (IS_ERR (np_ac97)) +return PTR_ERR (np_ac97); + + card->dai_link->cpus->of_node = np_ac97; + card->dai_link->platforms->of_node = np_ac97; + }else { + np_codec =tegra_machine_parse_phandle (dev,"nvidia,audio-codec" ); +if (IS_ERR (np_codec)) +return PTR_ERR (np_codec); + + np_i2s =tegra_machine_parse_phandle (dev,"nvidia,i2s-controller" ); +if (IS_ERR (np_i2s)) +return PTR_ERR (np_i2s); + + card->dai_link->cpus->of_node = np_i2s; + card->dai_link->codecs->of_node = np_codec; + card->dai_link->platforms->of_node = np_i2s; + }if (asoc->add_common_controls) { card->controls = tegra_machine_controls;
@@ -589,6 +627,7 @@ static struct snd_soc_card snd_soc_tegrastatic const struct tegra_asoc_data tegra_wm9712_data = { .card = &snd_soc_tegra_wm9712, .add_common_dapm_widgets = true, + .codec_dev_name ="wm9712-codec" , .set_ac97 = true, };
sound/soc/tegra/tegra_asoc_machine.h +1 -0
@@ -13,6 +13,7 @@ struct snd_soc_pcm_runtime;struct tegra_asoc_data {unsigned int (*mclk_rate)(unsigned int srate); +const char *codec_dev_name;struct snd_soc_card *card;unsigned int mclk_id;bool hp_jack_gpio_active_low;
Greg Kroah-Hartman
maintainerPATCH 174/849 PCI: aardvark: Fix reporting Data Link Layer Link Active
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 2b650b7ff20eb7ea8ef9031d20fb657286ab90cc upstream.
Add support for reporting PCI_EXP_LNKSTA_DLLLA bit in Link Control register on emulated bridge via current LTSSM state. Also correctly indicate DLLLA capability via PCI_EXP_LNKCAP_DLLLARC bit in Link Control Capability register.
--- drivers/pci/controller/pci-aardvark.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +28 -1
@@ -321,6 +321,20 @@ static inline bool advk_pcie_link_up(strreturn ltssm_state >=LTSSM_L0 && ltssm_state <LTSSM_DISABLED ; } +static inline bool advk_pcie_link_active (struct advk_pcie *pcie) +{ +/* +* According to PCIe Base specification 3.0, Table 4-14: Link +* Status Mapped to the LTSSM, and 4.2.6.3.6 Configuration.Idle +* is Link Up mapped to LTSSM Configuration.Idle, Recovery, L0, +* L0s, L1 and L2 states. And according to 3.2.1. Data Link +* Control and Management State Machine Rules is DL Up status +* reported in DL Active state. +*/ +u8 ltssm_state =advk_pcie_ltssm_state (pcie); +return ltssm_state >=LTSSM_CONFIG_IDLE && ltssm_state <LTSSM_DISABLED ; +} +static inline bool advk_pcie_link_training (struct advk_pcie *pcie) {/*
@@ -798,12 +812,26 @@ advk_pci_bridge_emul_pcie_conf_read(strureturn PCI_BRIDGE_EMUL_HANDLED ; } +case PCI_EXP_LNKCAP : { +u32 val =advk_readl (pcie,PCIE_CORE_PCIEXP_CAP + reg); +/* +* PCI_EXP_LNKCAP_DLLLARC bit is hardwired in aardvark HW to 0. +* But support for PCI_EXP_LNKSTA_DLLLA is emulated via ltssm +* state so explicitly enable PCI_EXP_LNKCAP_DLLLARC flag. +*/ + val |=PCI_EXP_LNKCAP_DLLLARC ; + *value = val; +return PCI_BRIDGE_EMUL_HANDLED ; + } +case PCI_EXP_LNKCTL : {/* u32 contains both PCI_EXP_LNKCTL and PCI_EXP_LNKSTA */ u32 val =advk_readl (pcie,PCIE_CORE_PCIEXP_CAP + reg) & ~(PCI_EXP_LNKSTA_LT <<16 );if (advk_pcie_link_training (pcie)) val |= (PCI_EXP_LNKSTA_LT <<16 ); +if (advk_pcie_link_active (pcie)) + val |= (PCI_EXP_LNKSTA_DLLLA <<16 ); *value = val;return PCI_BRIDGE_EMUL_HANDLED ; }
@@ -811,7 +839,6 @@ advk_pci_bridge_emul_pcie_conf_read(strucase PCI_CAP_LIST_ID :case PCI_EXP_DEVCAP :case PCI_EXP_DEVCTL : -case PCI_EXP_LNKCAP : *value =advk_readl (pcie,PCIE_CORE_PCIEXP_CAP + reg);return PCI_BRIDGE_EMUL_HANDLED ;default :
Greg Kroah-Hartman
maintainerPATCH 183/849 quota: correct error number in free_dqentry()
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
commit d0e36a62bd4c60c09acc40e06ba4831a4d0bc75b upstream.
Fix the error path in free_dqentry(), pass out the error number if the block to free is not correct.
--- fs/quota/quota_tree.c | 1 + 1 file changed, 1 insertion(+)
fs/quota/quota_tree.c +1 -0
@@ -414,6 +414,7 @@ static int free_dqentry(struct qtree_memquota_error (dquot->dq_sb,"Quota structure has offset to " "other block (%u) than it should (%u)" , blk, (uint)(dquot->dq_off >> info->dqi_blocksize_bits)); + ret = -EIO ; goto out_buf; } ret =read_blk (info, blk, buf);
Greg Kroah-Hartman
maintainerPATCH 137/849 perf/x86/intel/uncore: Support extra IMC channel on Ice Lake server
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
commit 496a18f09374ad89b3ab4366019bc3975db90234 upstream.
There are three channels on a Ice Lake server, but only two channels will ever be active. Current perf only enables two channels.
Support the extra IMC channel, which may be activated on some Ice Lake machines. For a non-activated channel, the SW can still access it. The write will be ignored by the HW. 0 is always returned for the reading.
--- arch/x86/events/intel/uncore_snbep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/events/intel/uncore_snbep.c +2 -2
@@ -451,7 +451,7 @@#define ICX_M3UPI_PCI_PMON_BOX_CTL 0xa0/* ICX IMC */ -#define ICX_NUMBER_IMC_CHN 2 +#define ICX_NUMBER_IMC_CHN 3#define ICX_IMC_MEM_STRIDE 0x4DEFINE_UNCORE_FORMAT_ATTR (event, event,"config:0-7" );
@@ -5437,7 +5437,7 @@ static struct intel_uncore_ops icx_uncorstatic struct intel_uncore_type icx_uncore_imc = { .name ="imc" , .num_counters =4 , - .num_boxes =8 , + .num_boxes =12 , .perf_ctr_bits =48 , .fixed_ctr_bits =48 , .fixed_ctr =SNR_IMC_MMIO_PMON_FIXED_CTR ,
Greg Kroah-Hartman
maintainerPATCH 186/849 pinctrl: core: fix possible memory leak in pinctrl_enable()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
commit c7892ae13e461ed20154321eb792e07ebe38f5b3 upstream.
I got memory leak as follows when doing fault injection test:
unreferenced object 0xffff888020a7a680 (size 64):
comm "i2c-mcp23018-41", pid 23090, jiffies 4295160544 (age 8.680s) hex dump (first 32 bytes):
00 48 d3 1e 80 88 ff ff 00 1a 56 c1 ff ff ff ff .H........V.....
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<0000000083c79b35>] kmem_cache_alloc_trace+0x16d/0x360
[<0000000051803c95>] pinctrl_init_controller+0x6ed/0xb70
[<0000000064346707>] pinctrl_register+0x27/0x80
[<0000000029b0e186>] devm_pinctrl_register+0x5b/0xe0
[<00000000391f5a3e>] mcp23s08_probe_one+0x968/0x118a [pinctrl_mcp23s08]
[<000000006112c039>] mcp230xx_probe+0x266/0x560 [pinctrl_mcp23s08_i2c]If pinctrl_claim_hogs() fails, the 'pindesc' allocated in pinctrl_register_one_pin() need be freed.
--- drivers/pinctrl/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/core.c +2 -0
@@ -2100,6 +2100,8 @@ int pinctrl_enable(struct pinctrl_dev *pif (error) {dev_err (pctldev->dev,"could not claim hogs: %i\n" , error); +pinctrl_free_pindescs (pctldev, pctldev->desc->pins, + pctldev->desc->npins);mutex_destroy (&pctldev->mutex);kfree (pctldev);
Greg Kroah-Hartman
maintainerPATCH 196/849 iio: ad5770r: make devicetree property reading consistent
In reply to Greg Kroah-HartmanFrom: Nuno Sá <[email protected]>
commit 26df977a909f818b7d346b3990735513e7e0bf93 upstream.
The bindings file for this driver is defining the property as 'reg' but the driver was reading it with the 'num' name. The bindings actually had the 'num' property when added in
commit ea52c21268e6 ("dt-bindings: iio: dac: Add docs for AD5770R DAC") and then changed it to 'reg' in
commit 2cf3818f18b2 ("dt-bindings: iio: dac: AD5570R fix bindings errors"). However, both these commits landed in v5.7 so the assumption is that either 'num' is not being used or if it is, the validations were not done.
Anyways, if someone comes back yelling about this, we might just support both of the properties in the future. Not ideal, but that's life...
--- drivers/iio/dac/ad5770r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5770r.c +1 -1
@@ -522,7 +522,7 @@ static int ad5770r_channel_config(structreturn -EINVAL ;device_for_each_child_node (&st->spi->dev, child) { - ret =fwnode_property_read_u32 (child,"num" , &num); + ret =fwnode_property_read_u32 (child,"reg" , &num);if (ret) goto err_child_out;if (num >=AD5770R_MAX_CHANNELS ) {
Greg Kroah-Hartman
maintainerPATCH 194/849 drivers: iio: dac: ad5766: Fix dt property name
In reply to Greg Kroah-HartmanFrom: Mihail Chindris <[email protected]>
commit d9de0fbdeb0103a204055efb69cb5cc8f5f12a6a upstream.
In the documentation the name for the property is output-range-microvolts which is a standard name, therefore this name must be used.
--- drivers/iio/dac/ad5766.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/dac/ad5766.c +3 -3
@@ -503,13 +503,13 @@ static int ad5766_get_output_range(strucint i, ret, min, max, tmp[2 ]; ret =device_property_read_u32_array (&st->spi->dev, -"output-range-voltage" , +"output-range-microvolts" , tmp,2 );if (ret)return ret; - min = tmp[0 ] /1000 ; - max = tmp[1 ] /1000 ; + min = tmp[0 ] /1000000 ; + max = tmp[1 ] /1000000 ;for (i =0 ; i <ARRAY_SIZE (ad5766_span_tbl); i++) {if (ad5766_span_tbl[i].min != min || ad5766_span_tbl[i].max != max)
Greg Kroah-Hartman
maintainerPATCH 195/849 iio: dac: ad5446: Fix ad5622_write() return value
In reply to Greg Kroah-HartmanFrom: Pekka Korpinen <[email protected]>
commit 558df982d4ead9cac628153d0d7b60feae05ddc8 upstream.
On success i2c_master_send() returns the number of bytes written. The call from iio_write_channel_info(), however, expects the return value to be zero on success.
This bug causes incorrect consumption of the sysfs buffer in iio_write_channel_info(). When writing more than two characters to out_voltage0_raw, the ad5446 write handler is called multiple times causing unexpected behavior.
--- drivers/iio/dac/ad5446.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/iio/dac/ad5446.c +8 -1
@@ -531,8 +531,15 @@ static int ad5622_write(struct ad5446_st {struct i2c_client *client =to_i2c_client (st->dev);__be16 data =cpu_to_be16 (val); +int ret; -return i2c_master_send (client, (char *)&data,sizeof (data)); + ret =i2c_master_send (client, (char *)&data,sizeof (data)); +if (ret <0 ) +return ret; +if (ret !=sizeof (data)) +return -EIO ; + +return 0 ; }/*
Greg Kroah-Hartman
maintainerPATCH 197/849 Documentation:devicetree:bindings:iio:dac: Fix val
In reply to Greg Kroah-HartmanFrom: Mihail Chindris <[email protected]>
commit 8fc4f038fa832ec3543907fdcbe1334e1b0a8950 upstream.
A correct value for output-range-microvolts is -5 to 5 Volts not -5 to 5 milivolts
--- Documentation/devicetree/bindings/iio/dac/adi,ad5766.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/iio/dac/adi,ad5766.yaml +1 -1
@@ -54,7 +54,7 @@ examples: ad5766@0 { compatible = "adi,ad5766"; - output-range-microvolts = <(-5000) 5000>; + output-range-microvolts = <(-5000000) 5000000>; reg = <0>; spi-cpol; spi-max-frequency = <1000000>;
Greg Kroah-Hartman
maintainerPATCH 199/849 serial: 8250: fix racy uartclk update
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 211cde4f5817dc88ef7f8f2fa286e57fbf14c8ee upstream.
Commit 868f3ee6e452 ("serial: 8250: Add 8250 port clock update method") added a hack to support SoCs where the UART reference clock can change behind the back of the driver but failed to add the proper locking.
First, make sure to take a reference to the tty struct to avoid dereferencing a NULL pointer if the clock change races with a hangup.
Second, the termios semaphore must be held during the update to prevent a racing termios change.
--- drivers/tty/serial/8250/8250_port.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/tty/serial/8250/8250_port.c +17 -4
@@ -2696,21 +2696,32 @@ static unsigned int serial8250_get_baud_void serial8250_update_uartclk (struct uart_port *port,unsigned int uartclk) {struct uart_8250_port *up =up_to_u8250p (port); +struct tty_port *tport = &port->state->port;unsigned int baud, quot, frac =0 ;struct ktermios *termios; +struct tty_struct *tty;unsigned long flags; -mutex_lock (&port->state->port.mutex); + tty =tty_port_tty_get (tport); +if (!tty) { +mutex_lock (&tport->mutex); + port->uartclk = uartclk; +mutex_unlock (&tport->mutex); +return ; + } + +down_write (&tty->termios_rwsem); +mutex_lock (&tport->mutex);if (port->uartclk == uartclk) goto out_lock; port->uartclk = uartclk; -if (!tty_port_initialized (&port->state->port)) +if (!tty_port_initialized (tport)) goto out_lock; - termios = &port->state->port.tty->termios; + termios = &tty->termios; baud =serial8250_get_baud_rate (port, termios,NULL ); quot =serial8250_get_divisor (port, baud, &frac);
@@ -2727,7 +2738,9 @@ void serial8250_update_uartclk(struct uaserial8250_rpm_put (up); out_lock: -mutex_unlock (&port->state->port.mutex); +mutex_unlock (&tport->mutex); +up_write (&tty->termios_rwsem); +tty_kref_put (tty); }EXPORT_SYMBOL_GPL (serial8250_update_uartclk);
Greg Kroah-Hartman
maintainerPATCH 202/849 USB: chipidea: fix interrupt deadlock
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 9aaa81c3366e8393a62374e3a1c67c69edc07b8a upstream.
Chipidea core was calling the interrupt handler from non-IRQ context with interrupts enabled, something which can lead to a deadlock if there's an actual interrupt trying to take a lock that's already held (e.g. the controller lock in udc_irq()).
Add a wrapper that can be used to fake interrupts instead of calling the handler directly.
--- drivers/usb/chipidea/core.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/usb/chipidea/core.c +16 -7
@@ -514,7 +514,7 @@ int hw_device_reset(struct ci_hdrc *ci)return 0 ; } -static irqreturn_t ci_irq (int irq,void *data) +static irqreturn_t ci_irq_handler (int irq,void *data) {struct ci_hdrc *ci = data;irqreturn_t ret =IRQ_NONE ;
@@ -567,6 +567,15 @@ static irqreturn_t ci_irq(int irq, voidreturn ret; } +static void ci_irq (struct ci_hdrc *ci) +{ +unsigned long flags; + +local_irq_save (flags); +ci_irq_handler (ci->irq, ci); +local_irq_restore (flags); +} +static int ci_cable_notifier (struct notifier_block *nb,unsigned long event,void *ptr) {
@@ -576,7 +585,7 @@ static int ci_cable_notifier(struct noti cbl->connected = event; cbl->changed = true; -ci_irq (ci->irq, ci); +ci_irq (ci);return NOTIFY_DONE ; }
@@ -617,7 +626,7 @@ static int ci_usb_role_switch_set(structif (cable) { cable->changed = true; cable->connected = false; -ci_irq (ci->irq, ci); +ci_irq (ci);spin_unlock_irqrestore (&ci->lock, flags);if (ci->wq && role !=USB_ROLE_NONE )flush_workqueue (ci->wq);
@@ -635,7 +644,7 @@ static int ci_usb_role_switch_set(structif (cable) { cable->changed = true; cable->connected = true; -ci_irq (ci->irq, ci); +ci_irq (ci); }spin_unlock_irqrestore (&ci->lock, flags);pm_runtime_put_sync (ci->dev);
@@ -1174,7 +1183,7 @@ static int ci_hdrc_probe(struct platform } } - ret =devm_request_irq (dev, ci->irq, ci_irq,IRQF_SHARED , + ret =devm_request_irq (dev, ci->irq, ci_irq_handler,IRQF_SHARED , ci->platdata->name, ci);if (ret) goto stop;
@@ -1295,11 +1304,11 @@ static void ci_extcon_wakeup_int(structif (!IS_ERR (cable_id->edev) && ci->is_otg && (otgsc &OTGSC_IDIE ) && (otgsc &OTGSC_IDIS )) -ci_irq (ci->irq, ci); +ci_irq (ci);if (!IS_ERR (cable_vbus->edev) && ci->is_otg && (otgsc &OTGSC_BSVIE ) && (otgsc &OTGSC_BSVIS )) -ci_irq (ci->irq, ci); +ci_irq (ci); }static int ci_controller_resume (struct device *dev)
Greg Kroah-Hartman
maintainerPATCH 179/849 PCI: aardvark: Fix support for PCI_BRIDGE_CTL_BUS_RESET on emulated bridge
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit bc4fac42e5f8460af09c0a7f2f1915be09e20c71 upstream.
Aardvark supports PCIe Hot Reset via PCIE_CORE_CTRL1_REG.
Use it for implementing PCI_BRIDGE_CTL_BUS_RESET bit of PCI_BRIDGE_CONTROL register on emulated bridge.
With this, the function pci_reset_secondary_bus() starts working and can reset connected PCIe card. Custom userspace script [1] which uses setpci can trigger PCIe Hot Reset and reset the card manually.
[1] https://alexforencich.com/wiki/en/pcie/hot-reset-linux
--- drivers/pci/controller/pci-aardvark.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/pci/controller/pci-aardvark.c +27 -0
@@ -793,6 +793,22 @@ advk_pci_bridge_emul_base_conf_read(stru *value =advk_readl (pcie,PCIE_CORE_CMD_STATUS_REG );return PCI_BRIDGE_EMUL_HANDLED ; +case PCI_INTERRUPT_LINE : { +/* +* From the whole 32bit register we support reading from HW only +* one bit: PCI_BRIDGE_CTL_BUS_RESET. +* Other bits are retrieved only from emulated config buffer. +*/ +__le32 *cfgspace = (__le32 *)&bridge->conf; +u32 val =le32_to_cpu (cfgspace[PCI_INTERRUPT_LINE /4 ]); +if (advk_readl (pcie,PCIE_CORE_CTRL1_REG ) &HOT_RESET_GEN ) + val |=PCI_BRIDGE_CTL_BUS_RESET <<16 ; +else + val &= ~(PCI_BRIDGE_CTL_BUS_RESET <<16 ); + *value = val; +return PCI_BRIDGE_EMUL_HANDLED ; + } +default :return PCI_BRIDGE_EMUL_NOT_HANDLED ; }
@@ -809,6 +825,17 @@ advk_pci_bridge_emul_base_conf_write(stradvk_writel (pcie, new,PCIE_CORE_CMD_STATUS_REG );break ; +case PCI_INTERRUPT_LINE : +if (mask & (PCI_BRIDGE_CTL_BUS_RESET <<16 )) { +u32 val =advk_readl (pcie,PCIE_CORE_CTRL1_REG ); +if (new & (PCI_BRIDGE_CTL_BUS_RESET <<16 )) + val |=HOT_RESET_GEN ; +else + val &= ~HOT_RESET_GEN ; +advk_writel (pcie, val,PCIE_CORE_CTRL1_REG ); + } +break ; +default :break ; }
Greg Kroah-Hartman
maintainerPATCH 209/849 Bluetooth: sco: Fix lock_sock() blockage by memcpy_from_msg()
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 99c23da0eed4fd20cae8243f2b51e10e66aa0951 ]
The sco_send_frame() also takes lock_sock() during memcpy_from_msg() call that may be endlessly blocked by a task with userfaultd technique, and this will result in a hung task watchdog trigger.
Just like the similar fix for hci_sock_sendmsg() in commit 92c685dc5de0 ("Bluetooth: reorganize functions..."), this patch moves the memcpy_from_msg() out of lock_sock() for addressing the hang.
This should be the last piece for fixing CVE-2021-3640 after a few already queued fixes.
--- net/bluetooth/sco.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
net/bluetooth/sco.c +16 -8
@@ -281,7 +281,8 @@ static int sco_connect(struct hci_dev *hdev, struct sock *sk)return err; } -static int sco_send_frame (struct sock *sk,struct msghdr *msg,int len) +static int sco_send_frame (struct sock *sk,void *buf,int len, +unsigned int msg_flags) {struct sco_conn *conn =sco_pi (sk)->conn;struct sk_buff *skb;
@@ -293,15 +294,11 @@ static int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)BT_DBG ("sk %p len %d" , sk, len); - skb =bt_skb_send_alloc (sk, len, msg->msg_flags &MSG_DONTWAIT , &err); + skb =bt_skb_send_alloc (sk, len, msg_flags &MSG_DONTWAIT , &err);if (!skb)return err; -if (memcpy_from_msg (skb_put (skb, len), msg, len)) { -kfree_skb (skb); -return -EFAULT ; - } - +memcpy (skb_put (skb, len), buf, len);hci_send_sco (conn->hcon, skb);return len;
@@ -726,6 +723,7 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) {struct sock *sk = sock->sk; +void *buf;int err;BT_DBG ("sock %p, sk %p" , sock, sk);
@@ -737,14 +735,24 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg,if (msg->msg_flags &MSG_OOB )return -EOPNOTSUPP ; + buf =kmalloc (len,GFP_KERNEL ); +if (!buf) +return -ENOMEM ; + +if (memcpy_from_msg (buf, msg, len)) { +kfree (buf); +return -EFAULT ; + } +lock_sock (sk);if (sk->sk_state ==BT_CONNECTED ) - err =sco_send_frame (sk, msg, len); + err =sco_send_frame (sk, buf, len, msg->msg_flags);else err = -ENOTCONN ;release_sock (sk); +kfree (buf);return err; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 220/849 smackfs: Fix use-after-free in netlbl_catmap_walk()
In reply to Greg Kroah-HartmanFrom: Pawan Gupta <[email protected]>
[ Upstream commit 0817534ff9ea809fac1322c5c8c574be8483ea57 ]
Syzkaller reported use-after-free bug as described in [1]. The bug is triggered when smk_set_cipso() tries to free stale category bitmaps while there are concurrent reader(s) using the same bitmaps.
Wait for RCU grace period to finish before freeing the category bitmaps in smk_set_cipso(). This makes sure that there are no more readers using the stale bitmaps and freeing them should be safe.
[1] https://lore.kernel.org/netdev/[email protected]/
--- security/smack/smackfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
security/smack/smackfs.c +4 -1
@@ -831,6 +831,7 @@ static int smk_open_cipso(struct inode *inode, struct file *file)static ssize_t smk_set_cipso (struct file *file,const char __user *buf,size_t count,loff_t *ppos,int format) { +struct netlbl_lsm_catmap *old_cat;struct smack_known *skp;struct netlbl_lsm_secattr ncats;char mapcatset[SMK_CIPSOLEN ];
@@ -920,9 +921,11 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, rc =smk_netlbl_mls (maplevel, mapcatset, &ncats,SMK_CIPSOLEN );if (rc >=0 ) { -netlbl_catmap_free (skp->smk_netlabel.attr.mls.cat); + old_cat = skp->smk_netlabel.attr.mls.cat; skp->smk_netlabel.attr.mls.cat = ncats.attr.mls.cat; skp->smk_netlabel.attr.mls.lvl = ncats.attr.mls.lvl; +synchronize_rcu (); +netlbl_catmap_free (old_cat); rc = count;/* * This mapping may have been cached, so clear the cache.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 181/849 PCI: aardvark: Fix support for PCI_ROM_ADDRESS1 on emulated bridge
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 239edf686c14a9ff926dec2f350289ed7adfefe2 upstream.
This register is exported at address offset 0x30.
--- drivers/pci/controller/pci-aardvark.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/pci/controller/pci-aardvark.c +9 -0
@@ -32,6 +32,7 @@#define PCIE_CORE_DEV_ID_REG 0x0#define PCIE_CORE_CMD_STATUS_REG 0x4#define PCIE_CORE_DEV_REV_REG 0x8 +#define PCIE_CORE_EXP_ROM_BAR_REG 0x30#define PCIE_CORE_PCIEXP_CAP 0xc0#define PCIE_CORE_ERR_CAPCTL_REG 0x118#define PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX BIT(5)
@@ -813,6 +814,10 @@ advk_pci_bridge_emul_base_conf_read(stru *value =advk_readl (pcie,PCIE_CORE_CMD_STATUS_REG );return PCI_BRIDGE_EMUL_HANDLED ; +case PCI_ROM_ADDRESS1 : + *value =advk_readl (pcie,PCIE_CORE_EXP_ROM_BAR_REG ); +return PCI_BRIDGE_EMUL_HANDLED ; +case PCI_INTERRUPT_LINE : {/* * From the whole 32bit register we support reading from HW only
@@ -845,6 +850,10 @@ advk_pci_bridge_emul_base_conf_write(stradvk_writel (pcie, new,PCIE_CORE_CMD_STATUS_REG );break ; +case PCI_ROM_ADDRESS1 : +advk_writel (pcie, new,PCIE_CORE_EXP_ROM_BAR_REG ); +break ; +case PCI_INTERRUPT_LINE :if (mask & (PCI_BRIDGE_CTL_BUS_RESET <<16 )) {u32 val =advk_readl (pcie,PCIE_CORE_CTRL1_REG );
Greg Kroah-Hartman
maintainerPATCH 206/849 drm: panel-orientation-quirks: Update the Lenovo Ideapad D330 quirk (v2)
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 820a2ab23d5eab4ccfb82581eda8ad4acf18458f ]
2 improvements to the Lenovo Ideapad D330 panel-orientation quirks:
1. Some versions of the Lenovo Ideapad D330 have a DMI_PRODUCT_NAME of "81H3" and others have "81MD". Testing has shown that the "81MD" also has a 90 degree mounted panel. Drop the DMI_PRODUCT_NAME from the existing quirk so that the existing quirk matches both variants.
2. Some of the Lenovo Ideapad D330 models have a HD (800x1280) screen instead of a FHD (1200x1920) screen (both are mounted right-side-up) add a second Lenovo Ideapad D330 quirk for the HD version.
Changes in v2:
- Add a new quirk for Lenovo Ideapad D330 models with a HD screen instead of a FHD screen
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_panel_orientation_quirks.c +7 -2
@@ -223,10 +223,15 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), }, .driver_data = (void *)&lcd800x1280_rightside_up, - }, { /* Lenovo Ideapad D330 */ + }, { /* Lenovo Ideapad D330-10IGM (HD) */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), + }, + .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* Lenovo Ideapad D330-10IGM (FHD) */ .matches = {DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), -DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"81H3" ), DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), }, .driver_data = (void *)&lcd1200x1920_rightside_up,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 176/849 PCI: aardvark: Fix return value of MSI domain .alloc() method
In reply to Greg Kroah-HartmanFrom: Marek Behún <[email protected]>
commit e4313be1599d397625c14fb7826996813622decf upstream.
MSI domain callback .alloc() (implemented by advk_msi_irq_domain_alloc() function) should return zero on success, since non-zero value indicates failure.
When the driver was converted to generic MSI API in commit f21a8b1b6837 ("PCI: aardvark: Move to MSI handling using generic MSI support"), it was converted so that it returns hwirq number.
Fix this.
--- drivers/pci/controller/pci-aardvark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +1 -1
@@ -1180,7 +1180,7 @@ static int advk_msi_irq_domain_alloc(str domain->host_data, handle_simple_irq, NULL, NULL); -return hwirq; +return 0 ; } static void advk_msi_irq_domain_free(struct irq_domain *domain,
Greg Kroah-Hartman
maintainerPATCH 234/849 ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit 441b3b5911f8ead7f2fe2336587b340a33044d58 ]
When wlan interface is up, 11d scan is sent to the firmware, and the firmware needs to spend couple of seconds to complete the 11d scan. If immediately a normal scan from user space arrives to ath11k, then the normal scan request is also sent to the firmware, but the scan started event will be reported to ath11k until the 11d scan complete. When timed out for the scan started in ath11k, ath11k stops the normal scan and the firmware reports WMI_SCAN_EVENT_DEQUEUED to ath11k for the normal scan. ath11k has no handler for the event and then timed out for the scan completed in ath11k_scan_stop(), and ath11k prints the following error message.
[ 1491.604750] ath11k_pci 0000:02:00.0: failed to receive scan abort comple: timed out [ 1491.604756] ath11k_pci 0000:02:00.0: failed to stop scan: -110 [ 1491.604758] ath11k_pci 0000:02:00.0: failed to start hw scan: -110
Add a handler for WMI_SCAN_EVENT_DEQUEUED and then complete the scan to get rid of the above error message.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/wmi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath11k/wmi.c +2 -0
@@ -6313,6 +6313,8 @@ static void ath11k_scan_event(struct ath11k_base *ab, struct sk_buff *skb)ath11k_wmi_event_scan_start_failed (ar);break ;case WMI_SCAN_EVENT_DEQUEUED : +__ath11k_mac_scan_finish (ar); +break ;case WMI_SCAN_EVENT_PREEMPTED :case WMI_SCAN_EVENT_RESTARTED :case WMI_SCAN_EVENT_FOREIGN_CHAN_EXIT :
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 229/849 drm/amdgpu: Fix MMIO access page fault
In reply to Greg Kroah-HartmanFrom: Andrey Grodzovsky <[email protected]>
[ Upstream commit c03509cbc01559549700e14c4a6239f2572ab4ba ]
Add more guards to MMIO access post device
unbind/unplug
--- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 8 ++++++-- drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 17 +++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +6 -2
@@ -22,6 +22,7 @@*/ #include <linux/firmware.h> +#include <drm/drm_drv.h> #include "amdgpu.h" #include "amdgpu_vcn.h"
@@ -192,11 +193,14 @@ static int vcn_v2_0_sw_init(void *handle)*/ static int vcn_v2_0_sw_fini (void *handle) { -int r; +int r, idx;struct amdgpu_device *adev = (struct amdgpu_device *)handle;volatile struct amdgpu_fw_shared *fw_shared = adev->vcn.inst->fw_shared_cpu_addr; - fw_shared->present_flag_0 =0 ; +if (drm_dev_enter (&adev->ddev, &idx)) { + fw_shared->present_flag_0 =0 ; +drm_dev_exit (idx); + }amdgpu_virt_free_mm_table (adev);
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +11 -6
@@ -22,6 +22,7 @@*/ #include <linux/firmware.h> +#include <drm/drm_drv.h> #include "amdgpu.h" #include "amdgpu_vcn.h"
@@ -233,17 +234,21 @@ static int vcn_v2_5_sw_init(void *handle)*/ static int vcn_v2_5_sw_fini (void *handle) { -int i, r; +int i, r, idx;struct amdgpu_device *adev = (struct amdgpu_device *)handle;volatile struct amdgpu_fw_shared *fw_shared; -for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { -if (adev->vcn.harvest_config & (1 << i)) -continue ; - fw_shared = adev->vcn.inst[i].fw_shared_cpu_addr; - fw_shared->present_flag_0 =0 ; +if (drm_dev_enter (&adev->ddev, &idx)) { +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) +continue ; + fw_shared = adev->vcn.inst[i].fw_shared_cpu_addr; + fw_shared->present_flag_0 =0 ; + } +drm_dev_exit (idx); } +if (amdgpu_sriov_vf (adev))amdgpu_virt_free_mm_table (adev);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 233/849 ath11k: Avoid reg rules update during firmware recovery
In reply to Greg Kroah-HartmanFrom: Sriram R <[email protected]>
[ Upstream commit 69a0fcf8a9f2273040d03e5ee77c9689c09e9d3a ]
During firmware recovery, the default reg rules which are received via WMI_REG_CHAN_LIST_CC_EVENT can overwrite the currently configured user regd.
See below snap for example,
root@OpenWrt:/# iw reg get | grep country country FR: DFS-ETSI country FR: DFS-ETSI country FR: DFS-ETSI country FR: DFS-ETSI
root@OpenWrt:/# echo assert > /sys/kernel/debug/ath11k/ipq8074\ hw2.0/simulate_f w_crash <snip> [ 5290.471696] ath11k c000000.wifi1: pdev 1 successfully recovered
root@OpenWrt:/# iw reg get | grep country country FR: DFS-ETSI country US: DFS-FCC country US: DFS-FCC country US: DFS-FCC
In the above, the user configured country 'FR' is overwritten when the rules of default country 'US' are received and updated during recovery. Hence avoid processing of these rules in general during firmware recovery as they have been already applied during driver registration or after last set user country is configured.
This scenario applies for both AP and STA devices basically because cfg80211 is not aware of the recovery and only the driver recovers, but changing or resetting of the reg domain during recovery is not needed so as to continue with the configured regdomain currently in use.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01460-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/wmi.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/wireless/ath/ath11k/wmi.c +11 -0
@@ -5793,6 +5793,17 @@ static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *sk pdev_idx = reg_info->phy_id; +/* Avoid default reg rule updates sent during FW recovery if +* it is already available +*/ +spin_lock (&ab->base_lock); +if (test_bit (ATH11K_FLAG_RECOVERY , &ab->dev_flags) && + ab->default_regd[pdev_idx]) { +spin_unlock (&ab->base_lock); + goto mem_free; + } +spin_unlock (&ab->base_lock); +if (pdev_idx >= ab->num_radios) {/* Process the event for phy0 only if single_pdev_only * is true. If pdev_idx is valid but not 0, discard the
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 227/849 spi: Check we have a spi_device_id for each DT compatible
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 5fa6863ba69265cb7e45567d12614790ff26bd56 ]
Currently for SPI devices we use the spi_device_id for module autoloading even on systems using device tree, meaning that listing a compatible string in the of_match_table isn't enough to have the module for a SPI driver autoloaded.
We attempted to fix this by generating OF based modaliases for devices instantiated from DT in 3ce6c9e2617e ("spi: add of_device_uevent_modalias support") but this meant we no longer reported spi_device_id based aliases which broke drivers such as spi-nor which don't list all the compatible strings they support directly for DT, and in at least that case it's not super practical to do so given the very large number of compatibles needed, much larger than the number spi_device_ids due to vendor strings. As a result fell back to using spi_device_id based modalises.
Try to close the gap by printing a warning when a SPI driver has a DT compatible that won't be matched as a SPI device ID with the goal of having drivers provide both. Given fallback compatibles this check is going to be excessive but it should be robust which is probably more important here.
--- drivers/spi/spi.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
drivers/spi/spi.c +41 -0
@@ -453,6 +453,47 @@ int __spi_register_driver(struct module *owner, struct spi_driver *sdrv) { sdrv->driver.owner = owner; sdrv->driver.bus = &spi_bus_type; + +/* +* For Really Good Reasons we use spi: modaliases not of: +* modaliases for DT so module autoloading won't work if we +* don't have a spi_device_id as well as a compatible string. +*/ +if (sdrv->driver.of_match_table) { +const struct of_device_id *of_id; + +for (of_id = sdrv->driver.of_match_table; of_id->compatible[0 ]; + of_id++) { +const char *of_name; + +/* Strip off any vendor prefix */ + of_name =strnchr (of_id->compatible, +sizeof (of_id->compatible),',' ); +if (of_name) + of_name++; +else + of_name = of_id->compatible; + +if (sdrv->id_table) { +const struct spi_device_id *spi_id; + +for (spi_id = sdrv->id_table; spi_id->name[0 ]; + spi_id++) +if (strcmp (spi_id->name, of_name) ==0 ) +break ; + +if (spi_id->name[0 ]) +continue ; + }else { +if (strcmp (sdrv->driver.name, of_name) ==0 ) +continue ; + } + +pr_warn ("SPI driver %s has no spi_device_id for %s\n" , + sdrv->driver.name, of_id->compatible); + } + } +return driver_register (&sdrv->driver); }EXPORT_SYMBOL_GPL (__spi_register_driver);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 237/849 octeontx2-pf: Enable promisc/allmulti match MCAM entries.
In reply to Greg Kroah-HartmanFrom: Rakesh Babu <[email protected]>
[ Upstream commit ffd2f89ad05cd620d822112a07b0c5669fa9e333 ]
Whenever the interface is brought up/down then set_rx_mode function is called by the stack which enables promisc/allmulti MCAM entries. But there are cases when driver brings interface down and then up such as while changing number of channels. In these cases promisc/allmulti MCAM entries are left disabled as set_rx_mode callback is not called. This patch enables these MCAM entries in all such cases.
--- .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 78 ++++++++++--------- 1 file changed, 43 insertions(+), 35 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +43 -35
@@ -1496,6 +1496,44 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)mutex_unlock (&mbox->lock); } +static void otx2_do_set_rx_mode (struct otx2_nic *pf) +{ +struct net_device *netdev = pf->netdev; +struct nix_rx_mode *req; +bool promisc = false; + +if (!(netdev->flags &IFF_UP )) +return ; + +if ((netdev->flags &IFF_PROMISC ) || + (netdev_uc_count (netdev) >OTX2_MAX_UNICAST_FLOWS )) { + promisc = true; + } + +/* Write unicast address to mcam entries or del from mcam */ +if (!promisc && netdev->priv_flags &IFF_UNICAST_FLT ) +__dev_uc_sync (netdev, otx2_add_macfilter, otx2_del_macfilter); + +mutex_lock (&pf->mbox.lock); + req =otx2_mbox_alloc_msg_nix_set_rx_mode (&pf->mbox); +if (!req) { +mutex_unlock (&pf->mbox.lock); +return ; + } + + req->mode =NIX_RX_MODE_UCAST ; + +if (promisc) + req->mode |=NIX_RX_MODE_PROMISC ; +if (netdev->flags & (IFF_ALLMULTI |IFF_MULTICAST )) + req->mode |=NIX_RX_MODE_ALLMULTI ; + + req->mode |=NIX_RX_MODE_USE_MCE ; + +otx2_sync_mbox_msg (&pf->mbox); +mutex_unlock (&pf->mbox.lock); +} +int otx2_open (struct net_device *netdev) {struct otx2_nic *pf =netdev_priv (netdev);
@@ -1657,6 +1695,8 @@ int otx2_open(struct net_device *netdev)if (err) goto err_tx_stop_queues; +otx2_do_set_rx_mode (pf); +return 0 ; err_tx_stop_queues:
@@ -1809,43 +1849,11 @@ static void otx2_set_rx_mode(struct net_device *netdev)queue_work (pf->otx2_wq, &pf->rx_mode_work); } -static void otx2_do_set_rx_mode (struct work_struct *work) +static void otx2_rx_mode_wrk_handler (struct work_struct *work) { struct otx2_nic *pf = container_of(work, struct otx2_nic, rx_mode_work); -struct net_device *netdev = pf->netdev; -struct nix_rx_mode *req; -bool promisc = false; - -if (!(netdev->flags &IFF_UP )) -return ; - -if ((netdev->flags &IFF_PROMISC ) || - (netdev_uc_count (netdev) >OTX2_MAX_UNICAST_FLOWS )) { - promisc = true; - } -/* Write unicast address to mcam entries or del from mcam */ -if (!promisc && netdev->priv_flags &IFF_UNICAST_FLT ) -__dev_uc_sync (netdev, otx2_add_macfilter, otx2_del_macfilter); - -mutex_lock (&pf->mbox.lock); - req =otx2_mbox_alloc_msg_nix_set_rx_mode (&pf->mbox); -if (!req) { -mutex_unlock (&pf->mbox.lock); -return ; - } - - req->mode =NIX_RX_MODE_UCAST ; - -if (promisc) - req->mode |=NIX_RX_MODE_PROMISC ; -if (netdev->flags & (IFF_ALLMULTI |IFF_MULTICAST )) - req->mode |=NIX_RX_MODE_ALLMULTI ; - - req->mode |=NIX_RX_MODE_USE_MCE ; - -otx2_sync_mbox_msg (&pf->mbox); -mutex_unlock (&pf->mbox.lock); +otx2_do_set_rx_mode (pf); } static int otx2_set_features(struct net_device *netdev,
@@ -2345,7 +2353,7 @@ static int otx2_wq_init(struct otx2_nic *pf)if (!pf->otx2_wq)return -ENOMEM ; -INIT_WORK (&pf->rx_mode_work, otx2_do_set_rx_mode); +INIT_WORK (&pf->rx_mode_work, otx2_rx_mode_wrk_handler);INIT_WORK (&pf->reset_task, otx2_reset_task);return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 211/849 drm/panel-orientation-quirks: add Valve Steam Deck
In reply to Greg Kroah-HartmanFrom: Simon Ser <[email protected]>
[ Upstream commit 9eeb7b4e40bfd69d8aaa920c7e9df751c9e11dce ]
Valve's Steam Deck has a 800x1280 LCD screen.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +7 -0
@@ -261,6 +261,13 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galaxy Book 10.6"), }, .driver_data = (void *)&lcd1280x1920_rightside_up, + }, { /* Valve Steam Deck */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Valve" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"Jupiter" ), + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "1"), + }, + .driver_data = (void *)&lcd800x1280_rightside_up, }, { /* VIOS LTH17 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 230/849 drm/amd/display: Fix null pointer dereference for encoders
In reply to Greg Kroah-HartmanFrom: Jimmy Kizito <[email protected]>
[ Upstream commit 60f39edd897ea134a4ddb789a6795681691c3183 ]
[Why]
Links which are dynamically assigned link encoders have their link encoder set to NULL.
[How]
Check that a pointer to a link_encoder object is non-NULL before using it.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
@@ -4681,7 +4681,7 @@ enum dc_status dp_set_fec_ready(struct dc_link *link, bool ready) link_enc->funcs->fec_set_ready (link_enc, true); link->fec_state = dc_link_fec_ready; }else { - link_enc->funcs->fec_set_ready (link->link_enc, false); + link_enc->funcs->fec_set_ready (link_enc, false); link->fec_state = dc_link_fec_not_ready;dm_error ("dpcd write failed to set fec_ready" ); }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
@@ -1522,7 +1522,7 @@ void dcn10_power_down_on_boot(struct dc *dc)for (i =0 ; i < dc->link_count; i++) {struct dc_link *link = dc->links[i]; -if (link->link_enc->funcs->is_dig_enabled && +if (link->link_enc && link->link_enc->funcs->is_dig_enabled && link->link_enc->funcs->is_dig_enabled (link->link_enc) && dc->hwss.power_down) { dc->hwss.power_down (dc);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 239/849 media: netup_unidvb: handle interrupt properly according to the firmware
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit dbb4cfea6efe979ed153bd59a6a527a90d3d0ab3 ]
The interrupt handling should be related to the firmware version. If the driver matches an old firmware, then the driver should not handle interrupt such as i2c or dma, otherwise it will cause some errors.
This log reveals it:
[ 27.708641] INFO: trying to register non-static key. [ 27.710851] The code is fine but needs lockdep annotation, or maybe [ 27.712010] you didn't initialize this object before use? [ 27.712396] turning off the locking correctness validator. [ 27.712787] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 5.12.4-g70e7f0549188-dirty #169 [ 27.713349] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 27.714149] Call Trace: [ 27.714329] <IRQ> [ 27.714480] dump_stack+0xba/0xf5 [ 27.714737] register_lock_class+0x873/0x8f0 [ 27.715052] ? __lock_acquire+0x323/0x1930 [ 27.715353] __lock_acquire+0x75/0x1930 [ 27.715636] lock_acquire+0x1dd/0x3e0 [ 27.715905] ? netup_i2c_interrupt+0x19/0x310 [ 27.716226] _raw_spin_lock_irqsave+0x4b/0x60 [ 27.716544] ? netup_i2c_interrupt+0x19/0x310 [ 27.716863] netup_i2c_interrupt+0x19/0x310 [ 27.717178] netup_unidvb_isr+0xd3/0x160 [ 27.717467] __handle_irq_event_percpu+0x53/0x3e0 [ 27.717808] handle_irq_event_percpu+0x35/0x90 [ 27.718129] handle_irq_event+0x39/0x60 [ 27.718409] handle_fasteoi_irq+0xc2/0x1d0 [ 27.718707] __common_interrupt+0x7f/0x150 [ 27.719008] common_interrupt+0xb4/0xd0 [ 27.719289] </IRQ> [ 27.719446] asm_common_interrupt+0x1e/0x40 [ 27.719747] RIP: 0010:native_safe_halt+0x17/0x20 [ 27.720084] Code: 07 0f 00 2d 8b ee 4c 00 f4 5d c3 0f 1f 84 00 00 00 00 00 8b 05 72 95 17 02 55 48 89 e5 85 c0 7e 07 0f 00 2d 6b ee 4c 00 fb f4 <5d> c3 cc cc cc cc cc cc cc 55 48 89 e5 e8 67 53 ff ff 8b 0d 29 f6 [ 27.721386] RSP: 0018:ffffc9000008fe90 EFLAGS: 00000246 [ 27.721758] RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000 [ 27.722262] RDX: 0000000000000000 RSI: ffffffff85f7c054 RDI: ffffffff85ded4e6 [ 27.722770] RBP: ffffc9000008fe90 R08: 0000000000000001 R09: 0000000000000001 [ 27.723277] R10: 0000000000000000 R11: 0000000000000001 R12: ffffffff86a75408 [ 27.723781] R13: 0000000000000000 R14: 0000000000000000 R15: ffff888100260000 [ 27.724289] default_idle+0x9/0x10 [ 27.724537] arch_cpu_idle+0xa/0x10 [ 27.724791] default_idle_call+0x6e/0x250 [ 27.725082] do_idle+0x1f0/0x2d0 [ 27.725326] cpu_startup_entry+0x18/0x20 [ 27.725613] start_secondary+0x11f/0x160 [ 27.725902] secondary_startup_64_no_verify+0xb0/0xbb [ 27.726272] BUG: kernel NULL pointer dereference, address: 0000000000000002 [ 27.726768] #PF: supervisor read access in kernel mode [ 27.727138] #PF: error_code(0x0000) - not-present page [ 27.727507] PGD 8000000118688067 P4D 8000000118688067 PUD 10feab067 PMD 0 [ 27.727999] Oops: 0000 [#1] PREEMPT SMP PTI [ 27.728302] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 5.12.4-g70e7f0549188-dirty #169 [ 27.728861] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 27.729660] RIP: 0010:netup_i2c_interrupt+0x23/0x310 [ 27.730019] Code: 0f 1f 80 00 00 00 00 55 48 89 e5 41 55 41 54 53 48 89 fb e8 af 6e 95 fd 48 89 df e8 e7 9f 1c 01 49 89 c5 48 8b 83 48 08 00 00 <66> 44 8b 60 02 44 89 e0 48 8b 93 48 08 00 00 83 e0 f8 66 89 42 02 [ 27.731339] RSP: 0018:ffffc90000118e90 EFLAGS: 00010046 [ 27.731716] RAX: 0000000000000000 RBX: ffff88810803c4d8 RCX: 0000000000000000 [ 27.732223] RDX: 0000000000000001 RSI: ffffffff85d37b94 RDI: ffff88810803c4d8 [ 27.732727] RBP: ffffc90000118ea8 R08: 0000000000000000 R09: 0000000000000001 [ 27.733239] R10: ffff88810803c4f0 R11: 61646e6f63657320 R12: 0000000000000000 [ 27.733745] R13: 0000000000000046 R14: ffff888101041000 R15: ffff8881081b2400 [ 27.734251] FS: 0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000 [ 27.734821] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 27.735228] CR2: 0000000000000002 CR3: 0000000108194000 CR4: 00000000000006e0 [ 27.735735] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 27.736241] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 27.736744] Call Trace: [ 27.736924] <IRQ> [ 27.737074] netup_unidvb_isr+0xd3/0x160 [ 27.737363] __handle_irq_event_percpu+0x53/0x3e0 [ 27.737706] handle_irq_event_percpu+0x35/0x90 [ 27.738028] handle_irq_event+0x39/0x60 [ 27.738306] handle_fasteoi_irq+0xc2/0x1d0 [ 27.738602] __common_interrupt+0x7f/0x150 [ 27.738899] common_interrupt+0xb4/0xd0 [ 27.739176] </IRQ> [ 27.739331] asm_common_interrupt+0x1e/0x40 [ 27.739633] RIP: 0010:native_safe_halt+0x17/0x20 [ 27.739967] Code: 07 0f 00 2d 8b ee 4c 00 f4 5d c3 0f 1f 84 00 00 00 00 00 8b 05 72 95 17 02 55 48 89 e5 85 c0 7e 07 0f 00 2d 6b ee 4c 00 fb f4 <5d> c3 cc cc cc cc cc cc cc 55 48 89 e5 e8 67 53 ff ff 8b 0d 29 f6 [ 27.741275] RSP: 0018:ffffc9000008fe90 EFLAGS: 00000246 [ 27.741647] RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000 [ 27.742148] RDX: 0000000000000000 RSI: ffffffff85f7c054 RDI: ffffffff85ded4e6 [ 27.742652] RBP: ffffc9000008fe90 R08: 0000000000000001 R09: 0000000000000001 [ 27.743154] R10: 0000000000000000 R11: 0000000000000001 R12: ffffffff86a75408 [ 27.743652] R13: 0000000000000000 R14: 0000000000000000 R15: ffff888100260000 [ 27.744157] default_idle+0x9/0x10 [ 27.744405] arch_cpu_idle+0xa/0x10 [ 27.744658] default_idle_call+0x6e/0x250 [ 27.744948] do_idle+0x1f0/0x2d0 [ 27.745190] cpu_startup_entry+0x18/0x20 [ 27.745475] start_secondary+0x11f/0x160 [ 27.745761] secondary_startup_64_no_verify+0xb0/0xbb [ 27.746123] Modules linked in: [ 27.746348] Dumping ftrace buffer: [ 27.746596] (ftrace buffer empty) [ 27.746852] CR2: 0000000000000002 [ 27.747094] ---[ end trace ebafd46f83ab946d ]--- [ 27.747424] RIP: 0010:netup_i2c_interrupt+0x23/0x310 [ 27.747778] Code: 0f 1f 80 00 00 00 00 55 48 89 e5 41 55 41 54 53 48 89 fb e8 af 6e 95 fd 48 89 df e8 e7 9f 1c 01 49 89 c5 48 8b 83 48 08 00 00 <66> 44 8b 60 02 44 89 e0 48 8b 93 48 08 00 00 83 e0 f8 66 89 42 02 [ 27.749082] RSP: 0018:ffffc90000118e90 EFLAGS: 00010046 [ 27.749461] RAX: 0000000000000000 RBX: ffff88810803c4d8 RCX: 0000000000000000 [ 27.749966] RDX: 0000000000000001 RSI: ffffffff85d37b94 RDI: ffff88810803c4d8 [ 27.750471] RBP: ffffc90000118ea8 R08: 0000000000000000 R09: 0000000000000001 [ 27.750976] R10: ffff88810803c4f0 R11: 61646e6f63657320 R12: 0000000000000000 [ 27.751480] R13: 0000000000000046 R14: ffff888101041000 R15: ffff8881081b2400 [ 27.751986] FS: 0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000 [ 27.752560] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 27.752970] CR2: 0000000000000002 CR3: 0000000108194000 CR4: 00000000000006e0 [ 27.753481] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 27.753984] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 27.754487] Kernel panic - not syncing: Fatal exception in interrupt [ 27.755033] Dumping ftrace buffer: [ 27.755279] (ftrace buffer empty) [ 27.755534] Kernel Offset: disabled [ 27.755785] Rebooting in 1 seconds..
--- .../pci/netup_unidvb/netup_unidvb_core.c | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c +16 -11
@@ -258,19 +258,24 @@ static irqreturn_t netup_unidvb_isr(int irq, void *dev_id)if ((reg40 &AVL_IRQ_ASSERTED ) !=0 ) {/* IRQ is being signaled */ reg_isr =readw (ndev->bmmio0 +REG_ISR ); -if (reg_isr &NETUP_UNIDVB_IRQ_I2C0 ) { - iret =netup_i2c_interrupt (&ndev->i2c[0 ]); - }else if (reg_isr &NETUP_UNIDVB_IRQ_I2C1 ) { - iret =netup_i2c_interrupt (&ndev->i2c[1 ]); - }else if (reg_isr &NETUP_UNIDVB_IRQ_SPI ) { +if (reg_isr &NETUP_UNIDVB_IRQ_SPI ) iret =netup_spi_interrupt (ndev->spi); - }else if (reg_isr &NETUP_UNIDVB_IRQ_DMA1 ) { - iret =netup_dma_interrupt (&ndev->dma[0 ]); - }else if (reg_isr &NETUP_UNIDVB_IRQ_DMA2 ) { - iret =netup_dma_interrupt (&ndev->dma[1 ]); - }else if (reg_isr &NETUP_UNIDVB_IRQ_CI ) { - iret =netup_ci_interrupt (ndev); +else if (!ndev->old_fw) { +if (reg_isr &NETUP_UNIDVB_IRQ_I2C0 ) { + iret =netup_i2c_interrupt (&ndev->i2c[0 ]); + }else if (reg_isr &NETUP_UNIDVB_IRQ_I2C1 ) { + iret =netup_i2c_interrupt (&ndev->i2c[1 ]); + }else if (reg_isr &NETUP_UNIDVB_IRQ_DMA1 ) { + iret =netup_dma_interrupt (&ndev->dma[0 ]); + }else if (reg_isr &NETUP_UNIDVB_IRQ_DMA2 ) { + iret =netup_dma_interrupt (&ndev->dma[1 ]); + }else if (reg_isr &NETUP_UNIDVB_IRQ_CI ) { + iret =netup_ci_interrupt (ndev); + }else { + goto err; + } }else { +err:dev_err (&pci_dev->dev,"%s(): unknown interrupt 0x%x\n" , __func__, reg_isr);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 238/849 media: mt9p031: Fix corrupted frame after restarting stream
In reply to Greg Kroah-HartmanFrom: Dirk Bender <[email protected]>
[ Upstream commit 0961ba6dd211a4a52d1dd4c2d59be60ac2dc08c7 ]
To prevent corrupted frames after starting and stopping the sensor its datasheet specifies a specific pause sequence to follow:
Stopping:
Set Pause_Restart Bit -> Set Restart Bit -> Set Chip_Enable Off
Restarting:
Set Chip_Enable On -> Clear Pause_Restart Bit
The Restart Bit is cleared automatically and must not be cleared manually as this would cause undefined behavior.
--- drivers/media/i2c/mt9p031.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/media/i2c/mt9p031.c +27 -1
@@ -78,7 +78,9 @@#define MT9P031_PIXEL_CLOCK_INVERT (1 << 15)#define MT9P031_PIXEL_CLOCK_SHIFT (n) ((n) << 8)#define MT9P031_PIXEL_CLOCK_DIVIDE (n) ((n) << 0) -#define MT9P031_FRAME_RESTART 0x0b +#define MT9P031_RESTART 0x0b +#define MT9P031_FRAME_PAUSE_RESTART (1 << 1) +#define MT9P031_FRAME_RESTART (1 << 0)#define MT9P031_SHUTTER_DELAY 0x0c#define MT9P031_RST 0x0d#define MT9P031_RST_ENABLE 1
@@ -444,9 +446,23 @@ static int mt9p031_set_params(struct mt9p031 *mt9p031)static int mt9p031_s_stream (struct v4l2_subdev *subdev,int enable) {struct mt9p031 *mt9p031 =to_mt9p031 (subdev); +struct i2c_client *client =v4l2_get_subdevdata (subdev); +int val;int ret;if (!enable) { +/* enable pause restart */ + val =MT9P031_FRAME_PAUSE_RESTART ; + ret =mt9p031_write (client,MT9P031_RESTART , val); +if (ret <0 ) +return ret; + +/* enable restart + keep pause restart set */ + val |=MT9P031_FRAME_RESTART ; + ret =mt9p031_write (client,MT9P031_RESTART , val); +if (ret <0 ) +return ret; +/* Stop sensor readout */ ret =mt9p031_set_output_control (mt9p031,MT9P031_OUTPUT_CONTROL_CEN ,0 );
@@ -466,6 +482,16 @@ static int mt9p031_s_stream(struct v4l2_subdev *subdev, int enable)if (ret <0 )return ret; +/* +* - clear pause restart +* - don't clear restart as clearing restart manually can cause +* undefined behavior +*/ + val =MT9P031_FRAME_RESTART ; + ret =mt9p031_write (client,MT9P031_RESTART , val); +if (ret <0 ) +return ret; +return mt9p031_pll_enable (mt9p031); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 180/849 PCI: aardvark: Set PCI Bridge Class Code to PCI Bridge
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 84e1b4045dc887b78bdc87d92927093dc3a465aa upstream.
Aardvark controller has something like config space of a Root Port available at offset 0x0 of internal registers - these registers are used for implementation of the emulated bridge.
The default value of Class Code of this bridge corresponds to a RAID Mass storage controller, though. (This is probably intended for when the controller is used as Endpoint.)
Change the Class Code to correspond to a PCI Bridge.
Add comment explaining this change.
--- drivers/pci/controller/pci-aardvark.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/pci/controller/pci-aardvark.c +20 -0
@@ -560,6 +560,26 @@ static void advk_pcie_setup_hw(struct ad reg = (PCI_VENDOR_ID_MARVELL <<16 ) |PCI_VENDOR_ID_MARVELL ;advk_writel (pcie, reg,VENDOR_ID_REG ); +/* +* Change Class Code of PCI Bridge device to PCI Bridge (0x600400), +* because the default value is Mass storage controller (0x010400). +* +* Note that this Aardvark PCI Bridge does not have compliant Type 1 +* Configuration Space and it even cannot be accessed via Aardvark's +* PCI config space access method. Something like config space is +* available in internal Aardvark registers starting at offset 0x0 +* and is reported as Type 0. In range 0x10 - 0x34 it has totally +* different registers. +* +* Therefore driver uses emulation of PCI Bridge which emulates +* access to configuration space via internal Aardvark registers or +* emulated configuration buffer. +*/ + reg =advk_readl (pcie,PCIE_CORE_DEV_REV_REG ); + reg &= ~0xffffff00 ; + reg |= (PCI_CLASS_BRIDGE_PCI <<8 ) <<8 ; +advk_writel (pcie, reg,PCIE_CORE_DEV_REV_REG ); +/* Disable Root Bridge I/O space, memory space and bus mastering */ reg =advk_readl (pcie,PCIE_CORE_CMD_STATUS_REG ); reg &= ~(PCI_COMMAND_IO |PCI_COMMAND_MEMORY |PCI_COMMAND_MASTER );
Greg Kroah-Hartman
maintainerPATCH 240/849 media: atomisp: Fix error handling in probe
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
[ Upstream commit e16f5e39acd6d10cc63ae39bc0a77188ed828f22 ]
There were several issues with handling errors in lm3554_probe():
- Probe did not set the error code when v4l2_ctrl_handler_init() failed.
- It intermixed gotos for handling errors of v4l2_ctrl_handler_init() and media_entity_pads_init().
- It did not set the error code for failures of v4l2_ctrl_new_custom().
- Probe did not free resources in case of failures of atomisp_register_i2c_module().
The patch fixes all these issues.
Found by Linux Driver Verification project (linuxtesting.org).
--- .../media/atomisp/i2c/atomisp-lm3554.c | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-)
drivers/staging/media/atomisp/i2c/atomisp-lm3554.c +24 -13
@@ -835,7 +835,6 @@ static int lm3554_probe(struct i2c_client *client)int err =0 ;struct lm3554 *flash;unsigned int i; -int ret; flash =kzalloc (sizeof (*flash),GFP_KERNEL );if (!flash)
@@ -844,7 +843,7 @@ static int lm3554_probe(struct i2c_client *client) flash->pdata =lm3554_platform_data_func (client);if (IS_ERR (flash->pdata)) { err =PTR_ERR (flash->pdata); - goto fail1; + goto free_flash; }v4l2_i2c_subdev_init (&flash->sd, client, &lm3554_ops);
@@ -852,12 +851,12 @@ static int lm3554_probe(struct i2c_client *client) flash->sd.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; flash->mode =ATOMISP_FLASH_MODE_OFF ; flash->timeout =LM3554_MAX_TIMEOUT /LM3554_TIMEOUT_STEPSIZE -1 ; - ret = + err =v4l2_ctrl_handler_init (&flash->ctrl_handler,ARRAY_SIZE (lm3554_controls)); -if (ret) { +if (err) {dev_err (&client->dev,"error initialize a ctrl_handler.\n" ); - goto fail3; + goto unregister_subdev; }for (i =0 ; i <ARRAY_SIZE (lm3554_controls); i++)
@@ -866,14 +865,15 @@ static int lm3554_probe(struct i2c_client *client)if (flash->ctrl_handler.error) {dev_err (&client->dev,"ctrl_handler error.\n" ); - goto fail3; + err = flash->ctrl_handler.error; + goto free_handler; } flash->sd.ctrl_handler = &flash->ctrl_handler; err =media_entity_pads_init (&flash->sd.entity,0 ,NULL );if (err) {dev_err (&client->dev,"error initialize a media entity.\n" ); - goto fail2; + goto free_handler; } flash->sd.entity.function =MEDIA_ENT_F_FLASH ;
@@ -884,16 +884,27 @@ static int lm3554_probe(struct i2c_client *client) err =lm3554_gpio_init (client);if (err) { -dev_err (&client->dev,"gpio request/direction_output fail" ); - goto fail3; +dev_err (&client->dev,"gpio request/direction_output fail.\n" ); + goto cleanup_media; + } + + err =atomisp_register_i2c_module (&flash->sd,NULL ,LED_FLASH ); +if (err) { +dev_err (&client->dev,"fail to register atomisp i2c module.\n" ); + goto uninit_gpio; } -return atomisp_register_i2c_module (&flash->sd,NULL ,LED_FLASH ); -fail3: + +return 0 ; + +uninit_gpio: +lm3554_gpio_uninit (client); +cleanup_media:media_entity_cleanup (&flash->sd.entity); +free_handler:v4l2_ctrl_handler_free (&flash->ctrl_handler); -fail2: +unregister_subdev:v4l2_device_unregister_subdev (&flash->sd); -fail1: +free_flash:kfree (flash);return err;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 228/849 fscrypt: allow 256-bit master keys with AES-256-XTS
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit 7f595d6a6cdc336834552069a2e0a4f6d4756ddf ]
fscrypt currently requires a 512-bit master key when AES-256-XTS is used, since AES-256-XTS keys are 512-bit and fscrypt requires that the master key be at least as long any key that will be derived from it.
However, this is overly strict because AES-256-XTS doesn't actually have a 512-bit security strength, but rather 256-bit. The fact that XTS takes twice the expected key size is a quirk of the XTS mode. It is sufficient to use 256 bits of entropy for AES-256-XTS, provided that it is first properly expanded into a 512-bit key, which HKDF-SHA512 does.
Therefore, relax the check of the master key size to use the security strength of the derived key rather than the size of the derived key (except for v1 encryption policies, which don't use HKDF).
Besides making things more flexible for userspace, this is needed in order for the use of a KDF which only takes a 256-bit key to be introduced into the fscrypt key hierarchy. This will happen with hardware-wrapped keys support, as all known hardware which supports that feature uses an SP800-108 KDF using AES-256-CMAC, so the wrapped keys are wrapped 256-bit AES keys. Moreover, there is interest in fscrypt supporting the same type of AES-256-CMAC based KDF in software as an alternative to HKDF-SHA512. There is no security problem with such features, so fix the key length check to work properly with them.
--- Documentation/filesystems/fscrypt.rst | 10 ++--- fs/crypto/fscrypt_private.h | 5 ++- fs/crypto/hkdf.c | 11 ++++-- fs/crypto/keysetup.c | 57 +++++++++++++++++++++------ 4 files changed, 61 insertions(+), 22 deletions(-)
Documentation/filesystems/fscrypt.rst +5 -5
@@ -176,11 +176,11 @@ Master Keys Each encrypted directory tree is protected by a *master key*. Master keys can be up to 64 bytes long, and must be at least as long as the -greater of the key length needed by the contents and filenames -encryption modes being used. For example, if AES-256-XTS is used for -contents encryption, the master key must be 64 bytes (512 bits). Note -that the XTS mode is defined to require a key twice as long as that -required by the underlying block cipher. +greater of the security strength of the contents and filenames +encryption modes being used. For example, if any AES-256 mode is +used, the master key must be at least 256 bits, i.e. 32 bytes. A +stricter requirement applies if the key is used by a v1 encryption +policy and AES-256-XTS is used; such keys must be 64 bytes. To "unlock" an encrypted directory tree, userspace must provide the appropriate master key. There can be any number of master keys, each
fs/crypto/fscrypt_private.h +3 -2
@@ -549,8 +549,9 @@ int __init fscrypt_init_keyring(void);struct fscrypt_mode {const char *friendly_name;const char *cipher_str; -int keysize; -int ivsize; +int keysize;/* key size in bytes */ +int security_strength;/* security strength in bytes */ +int ivsize;/* IV size in bytes */ int logged_impl_name;enum blk_crypto_mode_num blk_crypto_mode; };
fs/crypto/hkdf.c +8 -3
@@ -16,9 +16,14 @@/* * HKDF supports any unkeyed cryptographic hash algorithm, but fscrypt uses -* SHA-512 because it is reasonably secure and efficient; and since it produces -* a 64-byte digest, deriving an AES-256-XTS key preserves all 64 bytes of -* entropy from the master key and requires only one iteration of HKDF-Expand. +* SHA-512 because it is well-established, secure, and reasonably efficient. +* +* HKDF-SHA256 was also considered, as its 256-bit security strength would be +* sufficient here. A 512-bit security strength is "nice to have", though. +* Also, on 64-bit CPUs, SHA-512 is usually just as fast as SHA-256. In the +* common case of deriving an AES-256-XTS key (512 bits), that can result in +* HKDF-SHA512 being much faster than HKDF-SHA256, as the longer digest size of +* SHA-512 causes HKDF-Expand to only need to do one iteration rather than two. */ #define HKDF_HMAC_ALG "hmac(sha512)"#define HKDF_HASHLEN SHA512_DIGEST_SIZE
fs/crypto/keysetup.c +45 -12
99 lines not on this page · raw message
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 231/849 selftests: net: fib_nexthops: Wait before checking reported idle time
In reply to Greg Kroah-HartmanFrom: Petr Machata <[email protected]>
[ Upstream commit b69c99463d414cc263411462d52f25205657e9af ]
The purpose of this test is to verify that after a short activity passes, the reported time is reasonable: not zero (which could be reported by mistake), and not something outrageous (which would be indicative of an issue in used units).
However, the idle time is reported in units of clock_t, or hundredths of second. If the initial sequence of commands is very quick, it is possible that the idle time is reported as just flat-out zero. When this test was recently enabled in our nightly regression, we started seeing spurious failures for exactly this reason.
Therefore buffer the delay leading up to the test with a sleep, to make sure there is no legitimate way of reporting 0.
--- tools/testing/selftests/net/fib_nexthops.sh | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/fib_nexthops.sh +1 -0
@@ -2078,6 +2078,7 @@ basic_res() "id 101 index 0 nhid 2 id 101 index 1 nhid 2 id 101 index 2 nhid 1 id 101 index 3 nhid 1" log_test $? 0 "Dump all nexthop buckets in a group" + sleep 0.1 (( $($IP -j nexthop bucket list id 101 | jq '[.[] | select(.bucket.idle_time > 0 and .bucket.idle_time < 2)] | length') == 4 ))
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 232/849 leds: trigger: use RCU to protect the led_cdevs list
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 2a5a8fa8b23144d14567d6f8293dd6fbeecee393 ]
Even with the previous commit 27af8e2c90fb ("leds: trigger: fix potential deadlock with libata") to this file, we still get lockdep unhappy, and Boqun explained the report here:
https://lore.kernel.org/r/YNA+d1X4UkoQ7g8a@boqun-archlinux
Effectively, this means that the read_lock_irqsave() isn't enough here because another CPU might be trying to do a write lock, and thus block the readers.
This is all pretty messy, but it doesn't seem right that the LEDs framework imposes some locking requirements on users, in particular we'd have to make the spinlock in the iwlwifi driver always disable IRQs, even if we don't need that for any other reason, just to avoid this deadlock.
Since writes to the led_cdevs list are rare (and are done by userspace), just switch the list to RCU. This costs a synchronize_rcu() at removal time so we can ensure things are correct, but that seems like a small price to pay for getting lock-free iterations and no deadlocks (nor any locking requirements imposed on users.)
--- drivers/leds/led-triggers.c | 41 +++++++++++++++++++------------------ include/linux/leds.h | 2 +- 2 files changed, 22 insertions(+), 21 deletions(-)
drivers/leds/led-triggers.c +21 -20
@@ -157,7 +157,6 @@ EXPORT_SYMBOL_GPL(led_trigger_read);/* Caller must ensure led_cdev->trigger_lock held */ int led_trigger_set (struct led_classdev *led_cdev,struct led_trigger *trig) { -unsigned long flags;char *event =NULL ;char *envp[2 ];const char *name;
@@ -171,10 +170,13 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)/* Remove any existing trigger */ if (led_cdev->trigger) { -write_lock_irqsave (&led_cdev->trigger->leddev_list_lock, flags); -list_del (&led_cdev->trig_list); -write_unlock_irqrestore (&led_cdev->trigger->leddev_list_lock, - flags); +spin_lock (&led_cdev->trigger->leddev_list_lock); +list_del_rcu (&led_cdev->trig_list); +spin_unlock (&led_cdev->trigger->leddev_list_lock); + +/* ensure it's no longer visible on the led_cdevs list */ +synchronize_rcu (); +cancel_work_sync (&led_cdev->set_brightness_work);led_stop_software_blink (led_cdev);if (led_cdev->trigger->deactivate)
@@ -186,9 +188,9 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)led_set_brightness (led_cdev,LED_OFF ); }if (trig) { -write_lock_irqsave (&trig->leddev_list_lock, flags); -list_add_tail (&led_cdev->trig_list, &trig->led_cdevs); -write_unlock_irqrestore (&trig->leddev_list_lock, flags); +spin_lock (&trig->leddev_list_lock); +list_add_tail_rcu (&led_cdev->trig_list, &trig->led_cdevs); +spin_unlock (&trig->leddev_list_lock); led_cdev->trigger = trig;if (trig->activate)
@@ -223,9 +225,10 @@ err_add_groups: trig->deactivate (led_cdev); err_activate: -write_lock_irqsave (&led_cdev->trigger->leddev_list_lock, flags); -list_del (&led_cdev->trig_list); -write_unlock_irqrestore (&led_cdev->trigger->leddev_list_lock, flags); +spin_lock (&led_cdev->trigger->leddev_list_lock); +list_del_rcu (&led_cdev->trig_list); +spin_unlock (&led_cdev->trigger->leddev_list_lock); +synchronize_rcu (); led_cdev->trigger =NULL ; led_cdev->trigger_data =NULL ;led_set_brightness (led_cdev,LED_OFF );
@@ -285,7 +288,7 @@ int led_trigger_register(struct led_trigger *trig)struct led_classdev *led_cdev;struct led_trigger *_trig; -rwlock_init (&trig->leddev_list_lock); +spin_lock_init (&trig->leddev_list_lock);INIT_LIST_HEAD (&trig->led_cdevs);down_write (&triggers_list_lock);
@@ -378,15 +381,14 @@ void led_trigger_event(struct led_trigger *trig, enum led_brightness brightness) {struct led_classdev *led_cdev; -unsigned long flags;if (!trig)return ; -read_lock_irqsave (&trig->leddev_list_lock, flags); -list_for_each_entry (led_cdev, &trig->led_cdevs, trig_list) +rcu_read_lock (); +list_for_each_entry_rcu (led_cdev, &trig->led_cdevs, trig_list)led_set_brightness (led_cdev, brightness); -read_unlock_irqrestore (&trig->leddev_list_lock, flags); +rcu_read_unlock (); }EXPORT_SYMBOL_GPL (led_trigger_event);
@@ -397,20 +399,19 @@ static void led_trigger_blink_setup(struct led_trigger *trig, int invert) {struct led_classdev *led_cdev; -unsigned long flags;if (!trig)return ; -read_lock_irqsave (&trig->leddev_list_lock, flags); -list_for_each_entry (led_cdev, &trig->led_cdevs, trig_list) { +rcu_read_lock (); +list_for_each_entry_rcu (led_cdev, &trig->led_cdevs, trig_list) {if (oneshot)led_blink_set_oneshot (led_cdev, delay_on, delay_off, invert);else led_blink_set (led_cdev, delay_on, delay_off); } -read_unlock_irqrestore (&trig->leddev_list_lock, flags); +rcu_read_unlock (); } void led_trigger_blink(struct led_trigger *trig,
include/linux/leds.h +1 -1
@@ -354,7 +354,7 @@ struct led_trigger {struct led_hw_trigger_type *trigger_type;/* LEDs under control by this trigger (for simple triggers) */ -rwlock_t leddev_list_lock; +spinlock_t leddev_list_lock;struct list_head led_cdevs;/* Link to next registered trigger */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 210/849 Bluetooth: fix use-after-free error in lock_sock_nested()
In reply to Greg Kroah-HartmanFrom: Wang ShaoBo <[email protected]>
[ Upstream commit 1bff51ea59a9afb67d2dd78518ab0582a54a472c ]
use-after-free error in lock_sock_nested is reported:
[ 179.140137][ T3731] ===================================================== [ 179.142675][ T3731] BUG: KMSAN: use-after-free in lock_sock_nested+0x280/0x2c0 [ 179.145494][ T3731] CPU: 4 PID: 3731 Comm: kworker/4:2 Not tainted 5.12.0-rc6+ #54 [ 179.148432][ T3731] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 [ 179.151806][ T3731] Workqueue: events l2cap_chan_timeout [ 179.152730][ T3731] Call Trace: [ 179.153301][ T3731] dump_stack+0x24c/0x2e0 [ 179.154063][ T3731] kmsan_report+0xfb/0x1e0 [ 179.154855][ T3731] __msan_warning+0x5c/0xa0 [ 179.155579][ T3731] lock_sock_nested+0x280/0x2c0 [ 179.156436][ T3731] ? kmsan_get_metadata+0x116/0x180 [ 179.157257][ T3731] l2cap_sock_teardown_cb+0xb8/0x890 [ 179.158154][ T3731] ? __msan_metadata_ptr_for_load_8+0x10/0x20 [ 179.159141][ T3731] ? kmsan_get_metadata+0x116/0x180 [ 179.159994][ T3731] ? kmsan_get_shadow_origin_ptr+0x84/0xb0 [ 179.160959][ T3731] ? l2cap_sock_recv_cb+0x420/0x420 [ 179.161834][ T3731] l2cap_chan_del+0x3e1/0x1d50 [ 179.162608][ T3731] ? kmsan_get_metadata+0x116/0x180 [ 179.163435][ T3731] ? kmsan_get_shadow_origin_ptr+0x84/0xb0 [ 179.164406][ T3731] l2cap_chan_close+0xeea/0x1050 [ 179.165189][ T3731] ? kmsan_internal_unpoison_shadow+0x42/0x70 [ 179.166180][ T3731] l2cap_chan_timeout+0x1da/0x590 [ 179.167066][ T3731] ? __msan_metadata_ptr_for_load_8+0x10/0x20 [ 179.168023][ T3731] ? l2cap_chan_create+0x560/0x560 [ 179.168818][ T3731] process_one_work+0x121d/0x1ff0 [ 179.169598][ T3731] worker_thread+0x121b/0x2370 [ 179.170346][ T3731] kthread+0x4ef/0x610 [ 179.171010][ T3731] ? process_one_work+0x1ff0/0x1ff0 [ 179.171828][ T3731] ? kthread_blkcg+0x110/0x110 [ 179.172587][ T3731] ret_from_fork+0x1f/0x30 [ 179.173348][ T3731] [ 179.173752][ T3731] Uninit was created at: [ 179.174409][ T3731] kmsan_internal_poison_shadow+0x5c/0xf0 [ 179.175373][ T3731] kmsan_slab_free+0x76/0xc0 [ 179.176060][ T3731] kfree+0x3a5/0x1180 [ 179.176664][ T3731] __sk_destruct+0x8af/0xb80 [ 179.177375][ T3731] __sk_free+0x812/0x8c0 [ 179.178032][ T3731] sk_free+0x97/0x130 [ 179.178686][ T3731] l2cap_sock_release+0x3d5/0x4d0 [ 179.179457][ T3731] sock_close+0x150/0x450 [ 179.180117][ T3731] __fput+0x6bd/0xf00 [ 179.180787][ T3731] ____fput+0x37/0x40 [ 179.181481][ T3731] task_work_run+0x140/0x280 [ 179.182219][ T3731] do_exit+0xe51/0x3e60 [ 179.182930][ T3731] do_group_exit+0x20e/0x450 [ 179.183656][ T3731] get_signal+0x2dfb/0x38f0 [ 179.184344][ T3731] arch_do_signal_or_restart+0xaa/0xe10 [ 179.185266][ T3731] exit_to_user_mode_prepare+0x2d2/0x560 [ 179.186136][ T3731] syscall_exit_to_user_mode+0x35/0x60 [ 179.186984][ T3731] do_syscall_64+0xc5/0x140 [ 179.187681][ T3731] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 179.188604][ T3731] =====================================================
In our case, there are two Thread A and B:
Context: Thread A: Context: Thread B:
l2cap_chan_timeout() __se_sys_shutdown()
l2cap_chan_close() l2cap_sock_shutdown()
l2cap_chan_del() l2cap_chan_close()
l2cap_sock_teardown_cb() l2cap_sock_teardown_cb()
Once l2cap_sock_teardown_cb() excuted, this sock will be marked as SOCK_ZAPPED, and can be treated as killable in l2cap_sock_kill() if sock_orphan() has excuted, at this time we close sock through sock_close() which end to call l2cap_sock_kill() like Thread C:
Context: Thread C:
sock_close()
l2cap_sock_release()
sock_orphan()
l2cap_sock_kill() #free sock if refcnt is 1
If C completed, Once A or B reaches l2cap_sock_teardown_cb() again, use-after-free happened.
We should set chan->data to NULL if sock is destructed, for telling teardown operation is not allowed in l2cap_sock_teardown_cb(), and also we should avoid killing an already killed socket in l2cap_sock_close_cb().
--- net/bluetooth/l2cap_sock.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_sock.c +9 -1
@@ -1508,6 +1508,9 @@ static void l2cap_sock_close_cb(struct l2cap_chan *chan) {struct sock *sk = chan->data; +if (!sk) +return ; +l2cap_sock_kill (sk); }
@@ -1516,6 +1519,9 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err)struct sock *sk = chan->data;struct sock *parent; +if (!sk) +return ; +BT_DBG ("chan %p state %s" , chan,state_to_string (chan->state));/* This callback can be called both for server (BT_LISTEN)
@@ -1707,8 +1713,10 @@ static void l2cap_sock_destruct(struct sock *sk) {BT_DBG ("sk %p" , sk); -if (l2cap_pi (sk)->chan) +if (l2cap_pi (sk)->chan) { +l2cap_pi (sk)->chan->data =NULL ;l2cap_chan_put (l2cap_pi (sk)->chan); + }if (l2cap_pi (sk)->rx_busy_skb) {kfree_skb (l2cap_pi (sk)->rx_busy_skb);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 223/849 x86/mm/64: Improve stack overflow warnings
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 44b979fa302cab91bdd2cc982823e5c13202cd4e ]
Current code has an explicit check for hitting the task stack guard; but overflowing any of the other stacks will get you a non-descript general #DF warning.
Improve matters by using get_stack_info_noinstr() to detetrmine if and which stack guard page got hit, enabling a better stack warning.
In specific, Michael Wang reported what turned out to be an NMI exception stack overflow, which is now clearly reported as such:
[] BUG: NMI stack guard page was hit at 0000000085fd977b (stack is 000000003a55b09e..00000000d8cce1a5)
--- arch/x86/include/asm/irq_stack.h | 37 +++++++++++++++++++++---------- arch/x86/include/asm/stacktrace.h | 10 +++++++++ arch/x86/include/asm/traps.h | 6 ++--- arch/x86/kernel/dumpstack_64.c | 6 +++++ arch/x86/kernel/traps.c | 25 +++++++++++---------- arch/x86/mm/fault.c | 20 ++++++++--------- 6 files changed, 67 insertions(+), 37 deletions(-)
arch/x86/include/asm/irq_stack.h +25 -12
@@ -77,11 +77,11 @@* Function calls can clobber anything except the callee-saved * registers. Tell the compiler. */ -#define call_on_irqstack(func, asm_call, argconstr...) \ +#define call_on_stack(stack, func, asm_call, argconstr...) \ { \ register void *tos asm("r11"); \ \ - tos = ((void *)__this_cpu_read(hardirq_stack_ptr)); \ + tos = ((void *)(stack)); \ \ asm_inline volatile( \ "movq %%rsp, (%[tos]) \n" \
@@ -98,6 +98,25 @@ ); \ } +#define ASM_CALL_ARG0 \ + "call %P[__func] \n" + +#define ASM_CALL_ARG1 \ + "movq %[arg1], %%rdi \n" \ + ASM_CALL_ARG0 + +#define ASM_CALL_ARG2 \ + "movq %[arg2], %%rsi \n" \ + ASM_CALL_ARG1 + +#define ASM_CALL_ARG3 \ + "movq %[arg3], %%rdx \n" \ + ASM_CALL_ARG2 + +#define call_on_irqstack(func, asm_call, argconstr...) \ + call_on_stack(__this_cpu_read(hardirq_stack_ptr), \ + func, asm_call, argconstr) +/* Macros to assert type correctness for run_*_on_irqstack macros */ #define assert_function_type (func, proto) \ static_assert(__builtin_types_compatible_p(typeof(&func), proto))
@@ -147,8 +166,7 @@*/ #define ASM_CALL_SYSVEC \ "call irq_enter_rcu \n" \ - "movq %[arg1], %%rdi \n" \ - "call %P[__func] \n" \ + ASM_CALL_ARG1 \ "call irq_exit_rcu \n"#define SYSVEC_CONSTRAINTS , [arg1] "r" (regs)
@@ -168,12 +186,10 @@*/ #define ASM_CALL_IRQ \ "call irq_enter_rcu \n" \ - "movq %[arg1], %%rdi \n" \ - "movl %[arg2], %%esi \n" \ - "call %P[__func] \n" \ + ASM_CALL_ARG2 \ "call irq_exit_rcu \n" -#define IRQ_CONSTRAINTS , [arg1] "r" (regs), [arg2] "r" (vector) +#define IRQ_CONSTRAINTS , [arg1] "r" (regs), [arg2] "r" ((unsigned long)vector)#define run_irq_on_irqstack_cond (func, regs, vector) \ { \
@@ -185,9 +201,6 @@ IRQ_CONSTRAINTS, regs, vector); \ } -#define ASM_CALL_SOFTIRQ \ - "call %P[__func] \n" -/* * Macro to invoke __do_softirq on the irq stack. This is only called from * task context when bottom halves are about to be reenabled and soft
@@ -197,7 +210,7 @@#define do_softirq_own_stack () \ { \ __this_cpu_write(hardirq_stack_inuse, true); \ - call_on_irqstack(__do_softirq, ASM_CALL_SOFTIRQ); \ + call_on_irqstack(__do_softirq, ASM_CALL_ARG0); \ __this_cpu_write(hardirq_stack_inuse, false); \ }
arch/x86/include/asm/stacktrace.h +10 -0
@@ -38,6 +38,16 @@ int get_stack_info(unsigned long *stack, struct task_struct *task,bool get_stack_info_noinstr (unsigned long *stack,struct task_struct *task,struct stack_info *info); +static __always_inline +bool get_stack_guard_info(unsigned long *stack, struct stack_info *info) +{ +/* make sure it's not in the stack proper */ +if (get_stack_info_noinstr (stack, current, info)) +return false; +/* but if it is in the page below it, we hit a guard */ +return get_stack_info_noinstr ((void *)stack +PAGE_SIZE , current, info); +} +const char *stack_type_name (enum stack_type type);static inline bool on_stack (struct stack_info *info,void *addr,size_t len)
arch/x86/include/asm/traps.h +3 -3
@@ -40,9 +40,9 @@ void math_emulate(struct math_emu_info *);bool fault_in_kernel_space (unsigned long address);#ifdef CONFIG_VMAP_STACK -void __noreturn handle_stack_overflow (const char *message, -struct pt_regs *regs, -unsigned long fault_address); +void __noreturn handle_stack_overflow (struct pt_regs *regs, +unsigned long fault_address, +struct stack_info *info);#endif #endif /* _ASM_X86_TRAPS_H */
arch/x86/kernel/dumpstack_64.c +6 -0
@@ -32,9 +32,15 @@ const char *stack_type_name(enum stack_type type) {BUILD_BUG_ON (N_EXCEPTION_STACKS !=6 ); +if (type ==STACK_TYPE_TASK ) +return "TASK" ; +if (type ==STACK_TYPE_IRQ )return "IRQ" ; +if (type ==STACK_TYPE_SOFTIRQ ) +return "SOFTIRQ" ; +if (type ==STACK_TYPE_ENTRY ) {/* * On 64-bit, we have a generic entry stack that we
arch/x86/kernel/traps.c +13 -12
@@ -313,17 +313,19 @@ out: }#ifdef CONFIG_VMAP_STACK -__visible void __noreturn handle_stack_overflow(const char *message, -struct pt_regs *regs, -unsigned long fault_address) +__visible void __noreturn handle_stack_overflow(struct pt_regs *regs, +unsigned long fault_address, +struct stack_info *info) { -printk (KERN_EMERG "BUG: stack guard page was hit at %p (stack is %p..%p)\n" , - (void *)fault_address, current->stack, - (char *)current->stack +THREAD_SIZE -1 ); -die (message, regs,0 ); +const char *name =stack_type_name (info->type); + +printk (KERN_EMERG "BUG: %s stack guard page was hit at %p (stack is %p..%p)\n" , + name, (void *)fault_address, info->begin, info->end); + +die ("stack guard page" , regs,0 );/* Be absolutely certain we don't return. */ -panic ("%s" , message); +panic ("%s stack guard hit" , name); }#endif
@@ -353,6 +355,7 @@ DEFINE_IDTENTRY_DF(exc_double_fault)#ifdef CONFIG_VMAP_STACK unsigned long address =read_cr2 (); +struct stack_info info;#endif #ifdef CONFIG_X86_ESPFIX64
@@ -455,10 +458,8 @@ DEFINE_IDTENTRY_DF(exc_double_fault)* stack even if the actual trigger for the double fault was * something else. */ -if ((unsigned long )task_stack_page (tsk) -1 - address <PAGE_SIZE ) { -handle_stack_overflow ("kernel stack overflow (double-fault)" , - regs, address); - } +if (get_stack_guard_info ((void *)address, &info)) +handle_stack_overflow (regs, address, &info);#endif pr_emerg ("PANIC: double fault, error_code: 0x%lx\n" , error_code);
arch/x86/mm/fault.c +10 -10
@@ -32,6 +32,7 @@#include <asm/pgtable_areas.h> /* VMALLOC_START, ... */ #include <asm/kvm_para.h> /* kvm_handle_async_pf */ #include <asm/vdso.h> /* fixup_vdso_exception() */ +#include <asm/irq_stack.h> #define CREATE_TRACE_POINTS #include <asm/trace/exceptions.h>
@@ -631,6 +632,9 @@ static noinline void page_fault_oops(struct pt_regs *regs, unsigned long error_code, unsigned long address) { +#ifdef CONFIG_VMAP_STACK + struct stack_info info; +#endif unsigned long flags;int sig;
@@ -649,9 +653,7 @@ page_fault_oops(struct pt_regs *regs, unsigned long error_code,* that we're in vmalloc space to avoid this. */ if (is_vmalloc_addr ((void *)address) && - (((unsigned long )current->stack -1 - address <PAGE_SIZE ) || - address - ((unsigned long )current->stack +THREAD_SIZE ) <PAGE_SIZE )) { -unsigned long stack =__this_cpu_ist_top_va (DF ) -sizeof (void *); +get_stack_guard_info ((void *)address, &info)) {/* * We're likely to be running with very little stack space * left. It's plausible that we'd hit this condition but
@@ -662,13 +664,11 @@ page_fault_oops(struct pt_regs *regs, unsigned long error_code,* and then double-fault, though, because we're likely to * break the console driver and lose most of the stack dump. */ - asmvolatile ("movq %[stack], %%rsp\n\t" -"call handle_stack_overflow\n\t" -"1: jmp 1b" - : ASM_CALL_CONSTRAINT - :"D" ("kernel stack overflow (page fault)" ), -"S" (regs),"d" (address), - [stack]"rm" (stack)); + call_on_stack(__this_cpu_ist_top_va(DF) - sizeof(void*), + handle_stack_overflow, + ASM_CALL_ARG3, + , [arg1] "r" (regs), [arg2] "r" (address), [arg3] "r" (&info)); + unreachable(); }#endif
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 224/849 x86: Increase exception stack sizes
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 7fae4c24a2b84a66c7be399727aca11e7a888462 ]
It turns out that a single page of stack is trivial to overflow with all the tracing gunk enabled. Raise the exception stacks to 2 pages, which is still half the interrupt stacks, which are at 4 pages.
--- arch/x86/include/asm/page_64_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/page_64_types.h +1 -1
@@ -15,7 +15,7 @@#define THREAD_SIZE_ORDER (2 + KASAN_STACK_ORDER)#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) -#define EXCEPTION_STACK_ORDER (0 + KASAN_STACK_ORDER) +#define EXCEPTION_STACK_ORDER (1 + KASAN_STACK_ORDER)#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)#define IRQ_STACK_ORDER (2 + KASAN_STACK_ORDER)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 225/849 mwifiex: Run SET_BSS_MODE when changing from P2P to STATION vif-type
In reply to Greg Kroah-HartmanFrom: Jonas Dreßler <[email protected]>
[ Upstream commit c2e9666cdffd347460a2b17988db4cfaf2a68fb9 ]
We currently handle changing from the P2P to the STATION virtual interface type slightly different than changing from P2P to ADHOC: When changing to STATION, we don't send the SET_BSS_MODE command. We do send that command on all other type-changes though, and it probably makes sense to send the command since after all we just changed our BSS_MODE. Looking at prior changes to this part of the code, it seems that this is simply a leftover from old refactorings.
Since sending the SET_BSS_MODE command is the only difference between mwifiex_change_vif_to_sta_adhoc() and the current code, we can now use mwifiex_change_vif_to_sta_adhoc() for both switching to ADHOC and STATION interface type.
This does not fix any particular bug and just "looked right", so there's a small chance it might be a regression.
--- .../net/wireless/marvell/mwifiex/cfg80211.c | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +4 -18
@@ -1229,29 +1229,15 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,break ;case NL80211_IFTYPE_P2P_CLIENT :case NL80211_IFTYPE_P2P_GO : +if (mwifiex_cfg80211_deinit_p2p (priv)) +return -EFAULT ; +switch (type) { -case NL80211_IFTYPE_STATION : -if (mwifiex_cfg80211_deinit_p2p (priv)) -return -EFAULT ; - priv->adapter->curr_iface_comb.p2p_intf--; - priv->adapter->curr_iface_comb.sta_intf++; - dev->ieee80211_ptr->iftype = type; -if (mwifiex_deinit_priv_params (priv)) -return -1 ; -if (mwifiex_init_new_priv_params (priv, dev, type)) -return -1 ; -if (mwifiex_sta_init_cmd (priv, false, false)) -return -1 ; -break ;case NL80211_IFTYPE_ADHOC : -if (mwifiex_cfg80211_deinit_p2p (priv)) -return -EFAULT ; +case NL80211_IFTYPE_STATION :return mwifiex_change_vif_to_sta_adhoc (dev, curr_iftype, type, params); -break ;case NL80211_IFTYPE_AP : -if (mwifiex_cfg80211_deinit_p2p (priv)) -return -EFAULT ;return mwifiex_change_vif_to_ap (dev, curr_iftype, type, params);case NL80211_IFTYPE_UNSPECIFIED :
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 226/849 mwifiex: Properly initialize private structure on interface type changes
In reply to Greg Kroah-HartmanFrom: Jonas Dreßler <[email protected]>
[ Upstream commit c606008b70627a2fc485732a53cc22f0f66d0981 ]
When creating a new virtual interface in mwifiex_add_virtual_intf(), we update our internal driver states like bss_type, bss_priority, bss_role and bss_mode to reflect the mode the firmware will be set to.
When switching virtual interface mode using mwifiex_init_new_priv_params() though, we currently only update bss_mode and bss_role. In order for the interface mode switch to actually work, we also need to update bss_type to its proper value, so do that.
This fixes a crash of the firmware (because the driver tries to execute commands that are invalid in AP mode) when switching from station mode to AP mode.
--- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +7 -3
@@ -908,16 +908,20 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv,switch (type) {case NL80211_IFTYPE_STATION :case NL80211_IFTYPE_ADHOC : - priv->bss_role =MWIFIEX_BSS_ROLE_STA ; + priv->bss_role =MWIFIEX_BSS_ROLE_STA ; + priv->bss_type =MWIFIEX_BSS_TYPE_STA ;break ;case NL80211_IFTYPE_P2P_CLIENT : - priv->bss_role =MWIFIEX_BSS_ROLE_STA ; + priv->bss_role =MWIFIEX_BSS_ROLE_STA ; + priv->bss_type =MWIFIEX_BSS_TYPE_P2P ;break ;case NL80211_IFTYPE_P2P_GO : - priv->bss_role =MWIFIEX_BSS_ROLE_UAP ; + priv->bss_role =MWIFIEX_BSS_ROLE_UAP ; + priv->bss_type =MWIFIEX_BSS_TYPE_P2P ;break ;case NL80211_IFTYPE_AP : priv->bss_role =MWIFIEX_BSS_ROLE_UAP ; + priv->bss_type =MWIFIEX_BSS_TYPE_UAP ;break ;default : mwifiex_dbg(adapter, ERROR,
Signature · 1 line
2.33.0