diff options
author | Mike Pagano <mpagano@gentoo.org> | 2019-09-06 13:24:41 -0400 |
---|---|---|
committer | Mike Pagano <mpagano@gentoo.org> | 2019-09-06 13:24:41 -0400 |
commit | eaf6eee7a1521f25a2bcd2b1479df9fb2357c96e (patch) | |
tree | 1e336aee84fb56f4852f14bc4647e6326abe89c0 | |
parent | Linux patch 4.19.69 (diff) | |
download | linux-patches-eaf6eee7a1521f25a2bcd2b1479df9fb2357c96e.tar.gz linux-patches-eaf6eee7a1521f25a2bcd2b1479df9fb2357c96e.tar.bz2 linux-patches-eaf6eee7a1521f25a2bcd2b1479df9fb2357c96e.zip |
Linux patch 4.19.70 and 4.19.714.19-70
Signed-off-by: Mike Pagano <mpagano@gentoo.org>
-rw-r--r-- | 0000_README | 4 | ||||
-rw-r--r-- | 1069_linux-4.19.70.patch | 2977 | ||||
-rw-r--r-- | 1070_linux-4.19.71.patch | 92 |
3 files changed, 3073 insertions, 0 deletions
diff --git a/0000_README b/0000_README index c2032037..807b793f 100644 --- a/0000_README +++ b/0000_README @@ -319,6 +319,10 @@ Patch: 1068_linux-4.19.69.patch From: https://www.kernel.org Desc: Linux 4.19.69 +Patch: 1070_linux-4.19.70.patch +From: https://www.kernel.org +Desc: Linux 4.19.70 + Patch: 1500_XATTR_USER_PREFIX.patch From: https://bugs.gentoo.org/show_bug.cgi?id=470644 Desc: Support for namespace user.pax.* on tmpfs. diff --git a/1069_linux-4.19.70.patch b/1069_linux-4.19.70.patch new file mode 100644 index 00000000..739863e6 --- /dev/null +++ b/1069_linux-4.19.70.patch @@ -0,0 +1,2977 @@ +diff --git a/Makefile b/Makefile +index 677341239449..ecf8806cb71f 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 4 + PATCHLEVEL = 19 +-SUBLEVEL = 69 ++SUBLEVEL = 70 + EXTRAVERSION = + NAME = "People's Front" + +diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c +index bce06083685d..94babc3d0ec2 100644 +--- a/arch/arm64/kernel/cpufeature.c ++++ b/arch/arm64/kernel/cpufeature.c +@@ -165,9 +165,17 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { + }; + + static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = { +- S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN4_SHIFT, 4, ID_AA64MMFR0_TGRAN4_NI), +- S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN64_SHIFT, 4, ID_AA64MMFR0_TGRAN64_NI), +- ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN16_SHIFT, 4, ID_AA64MMFR0_TGRAN16_NI), ++ /* ++ * We already refuse to boot CPUs that don't support our configured ++ * page size, so we can only detect mismatches for a page size other ++ * than the one we're currently using. Unfortunately, SoCs like this ++ * exist in the wild so, even though we don't like it, we'll have to go ++ * along with it and treat them as non-strict. ++ */ ++ S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN4_SHIFT, 4, ID_AA64MMFR0_TGRAN4_NI), ++ S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN64_SHIFT, 4, ID_AA64MMFR0_TGRAN64_NI), ++ ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN16_SHIFT, 4, ID_AA64MMFR0_TGRAN16_NI), ++ + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_BIGENDEL0_SHIFT, 4, 0), + /* Linux shouldn't care about secure memory */ + ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_SNSMEM_SHIFT, 4, 0), +diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c +index 9a3f2646ecc7..07a8004c3c23 100644 +--- a/arch/powerpc/kvm/book3s_64_vio.c ++++ b/arch/powerpc/kvm/book3s_64_vio.c +@@ -602,8 +602,10 @@ long kvmppc_h_put_tce_indirect(struct kvm_vcpu *vcpu, + + if (kvmppc_gpa_to_ua(vcpu->kvm, + tce & ~(TCE_PCI_READ | TCE_PCI_WRITE), +- &ua, NULL)) +- return H_PARAMETER; ++ &ua, NULL)) { ++ ret = H_PARAMETER; ++ goto unlock_exit; ++ } + + list_for_each_entry_lockless(stit, &stt->iommu_tables, next) { + ret = kvmppc_tce_iommu_map(vcpu->kvm, stt, +diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_64_vio_hv.c +index 6821ead4b4eb..eb8b11515a7f 100644 +--- a/arch/powerpc/kvm/book3s_64_vio_hv.c ++++ b/arch/powerpc/kvm/book3s_64_vio_hv.c +@@ -528,8 +528,10 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu, + ua = 0; + if (kvmppc_gpa_to_ua(vcpu->kvm, + tce & ~(TCE_PCI_READ | TCE_PCI_WRITE), +- &ua, NULL)) +- return H_PARAMETER; ++ &ua, NULL)) { ++ ret = H_PARAMETER; ++ goto unlock_exit; ++ } + + list_for_each_entry_lockless(stit, &stt->iommu_tables, next) { + ret = kvmppc_rm_tce_iommu_map(vcpu->kvm, stt, +diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c +index b316bd61a6ac..90be3a1506d3 100644 +--- a/arch/x86/kernel/apic/apic.c ++++ b/arch/x86/kernel/apic/apic.c +@@ -1140,6 +1140,10 @@ void clear_local_APIC(void) + apic_write(APIC_LVT0, v | APIC_LVT_MASKED); + v = apic_read(APIC_LVT1); + apic_write(APIC_LVT1, v | APIC_LVT_MASKED); ++ if (!x2apic_enabled()) { ++ v = apic_read(APIC_LDR) & ~APIC_LDR_MASK; ++ apic_write(APIC_LDR, v); ++ } + if (maxlvt >= 4) { + v = apic_read(APIC_LVTPC); + apic_write(APIC_LVTPC, v | APIC_LVT_MASKED); +diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c +index afee386ff711..caedd8d60d36 100644 +--- a/arch/x86/kernel/apic/bigsmp_32.c ++++ b/arch/x86/kernel/apic/bigsmp_32.c +@@ -38,32 +38,12 @@ static int bigsmp_early_logical_apicid(int cpu) + return early_per_cpu(x86_cpu_to_apicid, cpu); + } + +-static inline unsigned long calculate_ldr(int cpu) +-{ +- unsigned long val, id; +- +- val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; +- id = per_cpu(x86_bios_cpu_apicid, cpu); +- val |= SET_APIC_LOGICAL_ID(id); +- +- return val; +-} +- + /* +- * Set up the logical destination ID. +- * +- * Intel recommends to set DFR, LDR and TPR before enabling +- * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel +- * document number 292116). So here it goes... ++ * bigsmp enables physical destination mode ++ * and doesn't use LDR and DFR + */ + static void bigsmp_init_apic_ldr(void) + { +- unsigned long val; +- int cpu = smp_processor_id(); +- +- apic_write(APIC_DFR, APIC_DFR_FLAT); +- val = calculate_ldr(cpu); +- apic_write(APIC_LDR, val); + } + + static void bigsmp_setup_apic_routing(void) +diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c +index aeba77881d85..516ec7586a5f 100644 +--- a/arch/x86/kernel/ptrace.c ++++ b/arch/x86/kernel/ptrace.c +@@ -652,11 +652,10 @@ static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n) + { + struct thread_struct *thread = &tsk->thread; + unsigned long val = 0; +- int index = n; + + if (n < HBP_NUM) { ++ int index = array_index_nospec(n, HBP_NUM); + struct perf_event *bp = thread->ptrace_bps[index]; +- index = array_index_nospec(index, HBP_NUM); + + if (bp) + val = bp->hw.info.address; +diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c +index deb576b23b7c..9119859ba787 100644 +--- a/arch/x86/kernel/uprobes.c ++++ b/arch/x86/kernel/uprobes.c +@@ -521,9 +521,12 @@ struct uprobe_xol_ops { + void (*abort)(struct arch_uprobe *, struct pt_regs *); + }; + +-static inline int sizeof_long(void) ++static inline int sizeof_long(struct pt_regs *regs) + { +- return in_ia32_syscall() ? 4 : 8; ++ /* ++ * Check registers for mode as in_xxx_syscall() does not apply here. ++ */ ++ return user_64bit_mode(regs) ? 8 : 4; + } + + static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) +@@ -534,9 +537,9 @@ static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) + + static int emulate_push_stack(struct pt_regs *regs, unsigned long val) + { +- unsigned long new_sp = regs->sp - sizeof_long(); ++ unsigned long new_sp = regs->sp - sizeof_long(regs); + +- if (copy_to_user((void __user *)new_sp, &val, sizeof_long())) ++ if (copy_to_user((void __user *)new_sp, &val, sizeof_long(regs))) + return -EFAULT; + + regs->sp = new_sp; +@@ -569,7 +572,7 @@ static int default_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs + long correction = utask->vaddr - utask->xol_vaddr; + regs->ip += correction; + } else if (auprobe->defparam.fixups & UPROBE_FIX_CALL) { +- regs->sp += sizeof_long(); /* Pop incorrect return address */ ++ regs->sp += sizeof_long(regs); /* Pop incorrect return address */ + if (emulate_push_stack(regs, utask->vaddr + auprobe->defparam.ilen)) + return -ERESTART; + } +@@ -688,7 +691,7 @@ static int branch_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) + * "call" insn was executed out-of-line. Just restore ->sp and restart. + * We could also restore ->ip and try to call branch_emulate_op() again. + */ +- regs->sp += sizeof_long(); ++ regs->sp += sizeof_long(regs); + return -ERESTART; + } + +@@ -1068,7 +1071,7 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) + unsigned long + arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs) + { +- int rasize = sizeof_long(), nleft; ++ int rasize = sizeof_long(regs), nleft; + unsigned long orig_ret_vaddr = 0; /* clear high bits for 32-bit apps */ + + if (copy_from_user(&orig_ret_vaddr, (void __user *)regs->sp, rasize)) +diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c +index 031bd7f91f98..5f5bc5976804 100644 +--- a/arch/x86/kvm/lapic.c ++++ b/arch/x86/kvm/lapic.c +@@ -209,6 +209,9 @@ static void recalculate_apic_map(struct kvm *kvm) + if (!apic_x2apic_mode(apic) && !new->phys_map[xapic_id]) + new->phys_map[xapic_id] = apic; + ++ if (!kvm_apic_sw_enabled(apic)) ++ continue; ++ + ldr = kvm_lapic_get_reg(apic, APIC_LDR); + + if (apic_x2apic_mode(apic)) { +@@ -252,6 +255,8 @@ static inline void apic_set_spiv(struct kvm_lapic *apic, u32 val) + recalculate_apic_map(apic->vcpu->kvm); + } else + static_key_slow_inc(&apic_sw_disabled.key); ++ ++ recalculate_apic_map(apic->vcpu->kvm); + } + } + +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c +index e10a7a42449b..c27ce6059090 100644 +--- a/arch/x86/kvm/x86.c ++++ b/arch/x86/kvm/x86.c +@@ -6308,12 +6308,13 @@ restart: + unsigned long rflags = kvm_x86_ops->get_rflags(vcpu); + toggle_interruptibility(vcpu, ctxt->interruptibility); + vcpu->arch.emulate_regs_need_sync_to_vcpu = false; +- kvm_rip_write(vcpu, ctxt->eip); +- if (r == EMULATE_DONE && ctxt->tf) +- kvm_vcpu_do_singlestep(vcpu, &r); + if (!ctxt->have_exception || +- exception_type(ctxt->exception.vector) == EXCPT_TRAP) ++ exception_type(ctxt->exception.vector) == EXCPT_TRAP) { ++ kvm_rip_write(vcpu, ctxt->eip); ++ if (r == EMULATE_DONE && ctxt->tf) ++ kvm_vcpu_do_singlestep(vcpu, &r); + __kvm_set_rflags(vcpu, ctxt->eflags); ++ } + + /* + * For STI, interrupts are shadowed; so KVM_REQ_EVENT will +diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c +index 3b25a643058c..0b8e2a7d6e93 100644 +--- a/drivers/auxdisplay/panel.c ++++ b/drivers/auxdisplay/panel.c +@@ -1618,6 +1618,8 @@ static void panel_attach(struct parport *port) + return; + + err_lcd_unreg: ++ if (scan_timer.function) ++ del_timer_sync(&scan_timer); + if (lcd.enabled) + charlcd_unregister(lcd.charlcd); + err_unreg_device: +diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c +index a4bc74e72c39..55869b362fdf 100644 +--- a/drivers/block/xen-blkback/xenbus.c ++++ b/drivers/block/xen-blkback/xenbus.c +@@ -974,6 +974,7 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir) + } + blkif->nr_ring_pages = nr_grefs; + ++ err = -ENOMEM; + for (i = 0; i < nr_grefs * XEN_BLKIF_REQS_PER_PAGE; i++) { + req = kzalloc(sizeof(*req), GFP_KERNEL); + if (!req) +@@ -996,7 +997,7 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir) + err = xen_blkif_map(ring, ring_ref, nr_grefs, evtchn); + if (err) { + xenbus_dev_fatal(dev, err, "mapping ring-ref port %u", evtchn); +- return err; ++ goto fail; + } + + return 0; +@@ -1016,8 +1017,7 @@ fail: + } + kfree(req); + } +- return -ENOMEM; +- ++ return err; + } + + static int connect_ring(struct backend_info *be) +diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c +index d5f85455fa62..e31c02dc7770 100644 +--- a/drivers/bus/hisi_lpc.c ++++ b/drivers/bus/hisi_lpc.c +@@ -456,6 +456,17 @@ struct hisi_lpc_acpi_cell { + size_t pdata_size; + }; + ++static void hisi_lpc_acpi_remove(struct device *hostdev) ++{ ++ struct acpi_device *adev = ACPI_COMPANION(hostdev); ++ struct acpi_device *child; ++ ++ device_for_each_child(hostdev, NULL, hisi_lpc_acpi_remove_subdev); ++ ++ list_for_each_entry(child, &adev->children, node) ++ acpi_device_clear_enumerated(child); ++} ++ + /* + * hisi_lpc_acpi_probe - probe children for ACPI FW + * @hostdev: LPC host device pointer +@@ -556,8 +567,7 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) + return 0; + + fail: +- device_for_each_child(hostdev, NULL, +- hisi_lpc_acpi_remove_subdev); ++ hisi_lpc_acpi_remove(hostdev); + return ret; + } + +@@ -570,6 +580,10 @@ static int hisi_lpc_acpi_probe(struct device *dev) + { + return -ENODEV; + } ++ ++static void hisi_lpc_acpi_remove(struct device *hostdev) ++{ ++} + #endif // CONFIG_ACPI + + /* +@@ -607,24 +621,27 @@ static int hisi_lpc_probe(struct platform_device *pdev) + range->fwnode = dev->fwnode; + range->flags = LOGIC_PIO_INDIRECT; + range->size = PIO_INDIRECT_SIZE; ++ range->hostdata = lpcdev; ++ range->ops = &hisi_lpc_ops; ++ lpcdev->io_host = range; + + ret = logic_pio_register_range(range); + if (ret) { + dev_err(dev, "register IO range failed (%d)!\n", ret); + return ret; + } +- lpcdev->io_host = range; + + /* register the LPC host PIO resources */ + if (acpi_device) + ret = hisi_lpc_acpi_probe(dev); + else + ret = of_platform_populate(dev->of_node, NULL, NULL, dev); +- if (ret) ++ if (ret) { ++ logic_pio_unregister_range(range); + return ret; ++ } + +- lpcdev->io_host->hostdata = lpcdev; +- lpcdev->io_host->ops = &hisi_lpc_ops; ++ dev_set_drvdata(dev, lpcdev); + + io_end = lpcdev->io_host->io_start + lpcdev->io_host->size; + dev_info(dev, "registered range [%pa - %pa]\n", +@@ -633,6 +650,23 @@ static int hisi_lpc_probe(struct platform_device *pdev) + return ret; + } + ++static int hisi_lpc_remove(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct acpi_device *acpi_device = ACPI_COMPANION(dev); ++ struct hisi_lpc_dev *lpcdev = dev_get_drvdata(dev); ++ struct logic_pio_hwaddr *range = lpcdev->io_host; ++ ++ if (acpi_device) ++ hisi_lpc_acpi_remove(dev); ++ else ++ of_platform_depopulate(dev); ++ ++ logic_pio_unregister_range(range); ++ ++ return 0; ++} ++ + static const struct of_device_id hisi_lpc_of_match[] = { + { .compatible = "hisilicon,hip06-lpc", }, + { .compatible = "hisilicon,hip07-lpc", }, +@@ -646,5 +680,6 @@ static struct platform_driver hisi_lpc_driver = { + .acpi_match_table = ACPI_PTR(hisi_lpc_acpi_match), + }, + .probe = hisi_lpc_probe, ++ .remove = hisi_lpc_remove, + }; + builtin_platform_driver(hisi_lpc_driver); +diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c +index 9b6d8972a565..b8c94a01cfc9 100644 +--- a/drivers/crypto/ccp/ccp-dev.c ++++ b/drivers/crypto/ccp/ccp-dev.c +@@ -543,6 +543,10 @@ int ccp_dev_suspend(struct sp_device *sp, pm_message_t state) + unsigned long flags; + unsigned int i; + ++ /* If there's no device there's nothing to do */ ++ if (!ccp) ++ return 0; ++ + spin_lock_irqsave(&ccp->cmd_lock, flags); + + ccp->suspending = 1; +@@ -567,6 +571,10 @@ int ccp_dev_resume(struct sp_device *sp) + unsigned long flags; + unsigned int i; + ++ /* If there's no device there's nothing to do */ ++ if (!ccp) ++ return 0; ++ + spin_lock_irqsave(&ccp->cmd_lock, flags); + + ccp->suspending = 0; +diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c +index f4edfc56f34e..3d55405c49ca 100644 +--- a/drivers/dma/ste_dma40.c ++++ b/drivers/dma/ste_dma40.c +@@ -142,7 +142,7 @@ enum d40_events { + * when the DMA hw is powered off. + * TODO: Add save/restore of D40_DREG_GCC on dma40 v3 or later, if that works. + */ +-static u32 d40_backup_regs[] = { ++static __maybe_unused u32 d40_backup_regs[] = { + D40_DREG_LCPA, + D40_DREG_LCLA, + D40_DREG_PRMSE, +@@ -211,7 +211,7 @@ static u32 d40_backup_regs_v4b[] = { + + #define BACKUP_REGS_SZ_V4B ARRAY_SIZE(d40_backup_regs_v4b) + +-static u32 d40_backup_regs_chan[] = { ++static __maybe_unused u32 d40_backup_regs_chan[] = { + D40_CHAN_REG_SSCFG, + D40_CHAN_REG_SSELT, + D40_CHAN_REG_SSPTR, +diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c +index 06dd1725375e..8c3c3e5b812a 100644 +--- a/drivers/dma/stm32-mdma.c ++++ b/drivers/dma/stm32-mdma.c +@@ -1376,7 +1376,7 @@ static irqreturn_t stm32_mdma_irq_handler(int irq, void *devid) + + chan = &dmadev->chan[id]; + if (!chan) { +- dev_err(chan2dev(chan), "MDMA channel not initialized\n"); ++ dev_dbg(mdma2dev(dmadev), "MDMA channel not initialized\n"); + goto exit; + } + +diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c +index a4a931ddf6f6..aeb9c29e5255 100644 +--- a/drivers/dma/ti/omap-dma.c ++++ b/drivers/dma/ti/omap-dma.c +@@ -1237,7 +1237,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_interleaved( + if (src_icg) { + d->ccr |= CCR_SRC_AMODE_DBLIDX; + d->ei = 1; +- d->fi = src_icg; ++ d->fi = src_icg + 1; + } else if (xt->src_inc) { + d->ccr |= CCR_SRC_AMODE_POSTINC; + d->fi = 0; +@@ -1252,7 +1252,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_interleaved( + if (dst_icg) { + d->ccr |= CCR_DST_AMODE_DBLIDX; + sg->ei = 1; +- sg->fi = dst_icg; ++ sg->fi = dst_icg + 1; + } else if (xt->dst_inc) { + d->ccr |= CCR_DST_AMODE_POSTINC; + sg->fi = 0; +diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c +index df94021dd9d1..fdc0e458dbaa 100644 +--- a/drivers/fsi/fsi-scom.c ++++ b/drivers/fsi/fsi-scom.c +@@ -47,8 +47,7 @@ + #define SCOM_STATUS_PIB_RESP_MASK 0x00007000 + #define SCOM_STATUS_PIB_RESP_SHIFT 12 + +-#define SCOM_STATUS_ANY_ERR (SCOM_STATUS_ERR_SUMMARY | \ +- SCOM_STATUS_PROTECTION | \ ++#define SCOM_STATUS_ANY_ERR (SCOM_STATUS_PROTECTION | \ + SCOM_STATUS_PARITY | \ + SCOM_STATUS_PIB_ABORT | \ + SCOM_STATUS_PIB_RESP_MASK) +@@ -260,11 +259,6 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status) + /* Return -EBUSY on PIB abort to force a retry */ + if (status & SCOM_STATUS_PIB_ABORT) + return -EBUSY; +- if (status & SCOM_STATUS_ERR_SUMMARY) { +- fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG, &dummy, +- sizeof(uint32_t)); +- return -EIO; +- } + return 0; + } + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +index 92b11de19581..354c8b6106dc 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +@@ -575,6 +575,7 @@ static const struct amdgpu_px_quirk amdgpu_px_quirk_list[] = { + { 0x1002, 0x6900, 0x1002, 0x0124, AMDGPU_PX_QUIRK_FORCE_ATPX }, + { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX }, + { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX }, ++ { 0x1002, 0x699f, 0x1028, 0x0814, AMDGPU_PX_QUIRK_FORCE_ATPX }, + { 0x1002, 0x6900, 0x1025, 0x125A, AMDGPU_PX_QUIRK_FORCE_ATPX }, + { 0x1002, 0x6900, 0x17AA, 0x3806, AMDGPU_PX_QUIRK_FORCE_ATPX }, + { 0, 0, 0, 0, 0 }, +diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c +index 373700c05a00..224fa1ef87ff 100644 +--- a/drivers/gpu/drm/ast/ast_main.c ++++ b/drivers/gpu/drm/ast/ast_main.c +@@ -131,8 +131,8 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) + + + /* Enable extended register access */ +- ast_enable_mmio(dev); + ast_open_key(ast); ++ ast_enable_mmio(dev); + + /* Find out whether P2A works or whether to use device-tree */ + ast_detect_config_mode(dev, &scu_rev); +@@ -576,6 +576,9 @@ void ast_driver_unload(struct drm_device *dev) + { + struct ast_private *ast = dev->dev_private; + ++ /* enable standard VGA decode */ ++ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04); ++ + ast_release_firmware(dev); + kfree(ast->dp501_fw_addr); + ast_mode_fini(dev); +diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c +index 8bb355d5d43d..9d92d2d2fcfc 100644 +--- a/drivers/gpu/drm/ast/ast_mode.c ++++ b/drivers/gpu/drm/ast/ast_mode.c +@@ -600,7 +600,7 @@ static int ast_crtc_mode_set(struct drm_crtc *crtc, + return -EINVAL; + ast_open_key(ast); + +- ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04); ++ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); + + ast_set_std_reg(crtc, adjusted_mode, &vbios_mode); + ast_set_crtc_reg(crtc, adjusted_mode, &vbios_mode); +diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c +index f7d421359d56..c1d1ac51d1c2 100644 +--- a/drivers/gpu/drm/ast/ast_post.c ++++ b/drivers/gpu/drm/ast/ast_post.c +@@ -46,7 +46,7 @@ void ast_enable_mmio(struct drm_device *dev) + { + struct ast_private *ast = dev->dev_private; + +- ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04); ++ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); + } + + +diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c +index c3e32138c6bb..9dc109df0808 100644 +--- a/drivers/gpu/drm/bridge/ti-tfp410.c ++++ b/drivers/gpu/drm/bridge/ti-tfp410.c +@@ -64,7 +64,12 @@ static int tfp410_get_modes(struct drm_connector *connector) + + drm_connector_update_edid_property(connector, edid); + +- return drm_add_edid_modes(connector, edid); ++ ret = drm_add_edid_modes(connector, edid); ++ ++ kfree(edid); ++ ++ return ret; ++ + fallback: + /* No EDID, fallback on the XGA standard modes */ + ret = drm_add_modes_noedid(connector, 1920, 1200); +diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c +index f8cfd16be534..a4b4ab7b9f8e 100644 +--- a/drivers/gpu/drm/i915/i915_drv.c ++++ b/drivers/gpu/drm/i915/i915_drv.c +@@ -1120,6 +1120,12 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv) + + pci_set_master(pdev); + ++ /* ++ * We don't have a max segment size, so set it to the max so sg's ++ * debugging layer doesn't complain ++ */ ++ dma_set_max_seg_size(&pdev->dev, UINT_MAX); ++ + /* overlay on gen2 is broken and can't address above 1G */ + if (IS_GEN2(dev_priv)) { + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(30)); +diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c +index 869cf4a3b6de..a6cb3e034dd5 100644 +--- a/drivers/gpu/drm/i915/i915_vgpu.c ++++ b/drivers/gpu/drm/i915/i915_vgpu.c +@@ -100,6 +100,9 @@ static struct _balloon_info_ bl_info; + static void vgt_deballoon_space(struct i915_ggtt *ggtt, + struct drm_mm_node *node) + { ++ if (!drm_mm_node_allocated(node)) ++ return; ++ + DRM_DEBUG_DRIVER("deballoon space: range [0x%llx - 0x%llx] %llu KiB.\n", + node->start, + node->start + node->size, +diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c +index 0ef0c6448d53..01fa98299bae 100644 +--- a/drivers/gpu/drm/i915/intel_device_info.c ++++ b/drivers/gpu/drm/i915/intel_device_info.c +@@ -474,7 +474,7 @@ static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv) + u8 eu_disabled_mask; + u32 n_disabled; + +- if (!(sseu->subslice_mask[ss] & BIT(ss))) ++ if (!(sseu->subslice_mask[s] & BIT(ss))) + /* skip disabled subslice */ + continue; + +diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c +index 0fb300d41a09..e1868776da25 100644 +--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c ++++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c +@@ -184,6 +184,12 @@ static void tilcdc_fini(struct drm_device *dev) + { + struct tilcdc_drm_private *priv = dev->dev_private; + ++#ifdef CONFIG_CPU_FREQ ++ if (priv->freq_transition.notifier_call) ++ cpufreq_unregister_notifier(&priv->freq_transition, ++ CPUFREQ_TRANSITION_NOTIFIER); ++#endif ++ + if (priv->crtc) + tilcdc_crtc_shutdown(priv->crtc); + +@@ -198,12 +204,6 @@ static void tilcdc_fini(struct drm_device *dev) + drm_mode_config_cleanup(dev); + tilcdc_remove_external_device(dev); + +-#ifdef CONFIG_CPU_FREQ +- if (priv->freq_transition.notifier_call) +- cpufreq_unregister_notifier(&priv->freq_transition, +- CPUFREQ_TRANSITION_NOTIFIER); +-#endif +- + if (priv->clk) + clk_put(priv->clk); + +@@ -274,17 +274,6 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) + goto init_failed; + } + +-#ifdef CONFIG_CPU_FREQ +- priv->freq_transition.notifier_call = cpufreq_transition; +- ret = cpufreq_register_notifier(&priv->freq_transition, +- CPUFREQ_TRANSITION_NOTIFIER); +- if (ret) { +- dev_err(dev, "failed to register cpufreq notifier\n"); +- priv->freq_transition.notifier_call = NULL; +- goto init_failed; +- } +-#endif +- + if (of_property_read_u32(node, "max-bandwidth", &priv->max_bandwidth)) + priv->max_bandwidth = TILCDC_DEFAULT_MAX_BANDWIDTH; + +@@ -361,6 +350,17 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) + } + modeset_init(ddev); + ++#ifdef CONFIG_CPU_FREQ ++ priv->freq_transition.notifier_call = cpufreq_transition; ++ ret = cpufreq_register_notifier(&priv->freq_transition, ++ CPUFREQ_TRANSITION_NOTIFIER); ++ if (ret) { ++ dev_err(dev, "failed to register cpufreq notifier\n"); ++ priv->freq_transition.notifier_call = NULL; ++ goto init_failed; ++ } ++#endif ++ + if (priv->is_componentized) { + ret = component_bind_all(dev, ddev); + if (ret < 0) +diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c +index e759ac0d48be..968319f4e5f1 100644 +--- a/drivers/hwtracing/intel_th/pci.c ++++ b/drivers/hwtracing/intel_th/pci.c +@@ -140,6 +140,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa1a6), + .driver_data = (kernel_ulong_t)0, + }, ++ { ++ /* Lewisburg PCH */ ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa226), ++ .driver_data = (kernel_ulong_t)0, ++ }, + { + /* Gemini Lake */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e), +@@ -175,6 +180,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, ++ { ++ /* Tiger Lake PCH */ ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6), ++ .driver_data = (kernel_ulong_t)&intel_th_2x, ++ }, + { 0 }, + }; + +diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c +index 9ec9197edffa..eeba421dc823 100644 +--- a/drivers/hwtracing/stm/core.c ++++ b/drivers/hwtracing/stm/core.c +@@ -1098,7 +1098,6 @@ int stm_source_register_device(struct device *parent, + + err: + put_device(&src->dev); +- kfree(src); + + return err; + } +diff --git a/drivers/i2c/busses/i2c-emev2.c b/drivers/i2c/busses/i2c-emev2.c +index 35b302d983e0..959d4912ec0d 100644 +--- a/drivers/i2c/busses/i2c-emev2.c ++++ b/drivers/i2c/busses/i2c-emev2.c +@@ -69,6 +69,7 @@ struct em_i2c_device { + struct completion msg_done; + struct clk *sclk; + struct i2c_client *slave; ++ int irq; + }; + + static inline void em_clear_set_bit(struct em_i2c_device *priv, u8 clear, u8 set, u8 reg) +@@ -339,6 +340,12 @@ static int em_i2c_unreg_slave(struct i2c_client *slave) + + writeb(0, priv->base + I2C_OFS_SVA0); + ++ /* ++ * Wait for interrupt to finish. New slave irqs cannot happen because we ++ * cleared the slave address and, thus, only extension codes will be ++ * detected which do not use the slave ptr. ++ */ ++ synchronize_irq(priv->irq); + priv->slave = NULL; + + return 0; +@@ -355,7 +362,7 @@ static int em_i2c_probe(struct platform_device *pdev) + { + struct em_i2c_device *priv; + struct resource *r; +- int irq, ret; ++ int ret; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) +@@ -390,8 +397,8 @@ static int em_i2c_probe(struct platform_device *pdev) + + em_i2c_reset(&priv->adap); + +- irq = platform_get_irq(pdev, 0); +- ret = devm_request_irq(&pdev->dev, irq, em_i2c_irq_handler, 0, ++ priv->irq = platform_get_irq(pdev, 0); ++ ret = devm_request_irq(&pdev->dev, priv->irq, em_i2c_irq_handler, 0, + "em_i2c", priv); + if (ret) + goto err_clk; +@@ -401,7 +408,8 @@ static int em_i2c_probe(struct platform_device *pdev) + if (ret) + goto err_clk; + +- dev_info(&pdev->dev, "Added i2c controller %d, irq %d\n", priv->adap.nr, irq); ++ dev_info(&pdev->dev, "Added i2c controller %d, irq %d\n", priv->adap.nr, ++ priv->irq); + + return 0; + +diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c +index 90946a8b9a75..9ff3371ec385 100644 +--- a/drivers/i2c/busses/i2c-piix4.c ++++ b/drivers/i2c/busses/i2c-piix4.c +@@ -98,7 +98,7 @@ + #define SB800_PIIX4_PORT_IDX_MASK 0x06 + #define SB800_PIIX4_PORT_IDX_SHIFT 1 + +-/* On kerncz, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */ ++/* On kerncz and Hudson2, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */ + #define SB800_PIIX4_PORT_IDX_KERNCZ 0x02 + #define SB800_PIIX4_PORT_IDX_MASK_KERNCZ 0x18 + #define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ 3 +@@ -362,18 +362,16 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, + + /* Find which register is used for port selection */ + if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD) { +- switch (PIIX4_dev->device) { +- case PCI_DEVICE_ID_AMD_KERNCZ_SMBUS: ++ if (PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS || ++ (PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS && ++ PIIX4_dev->revision >= 0x1F)) { + piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ; + piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK_KERNCZ; + piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ; +- break; +- case PCI_DEVICE_ID_AMD_HUDSON2_SMBUS: +- default: ++ } else { + piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_ALT; + piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK; + piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT; +- break; + } + } else { + if (!request_muxed_region(SB800_PIIX4_SMB_IDX, 2, +diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c +index 254e6219e538..2c29f901d309 100644 +--- a/drivers/i2c/busses/i2c-rcar.c ++++ b/drivers/i2c/busses/i2c-rcar.c +@@ -139,6 +139,7 @@ struct rcar_i2c_priv { + enum dma_data_direction dma_direction; + + struct reset_control *rstc; ++ int irq; + }; + + #define rcar_i2c_priv_to_dev(p) ((p)->adap.dev.parent) +@@ -859,9 +860,11 @@ static int rcar_unreg_slave(struct i2c_client *slave) + + WARN_ON(!priv->slave); + ++ /* disable irqs and ensure none is running before clearing ptr */ + rcar_i2c_write(priv, ICSIER, 0); + rcar_i2c_write(priv, ICSCR, 0); + ++ synchronize_irq(priv->irq); + priv->slave = NULL; + + pm_runtime_put(rcar_i2c_priv_to_dev(priv)); +@@ -916,7 +919,7 @@ static int rcar_i2c_probe(struct platform_device *pdev) + struct i2c_adapter *adap; + struct device *dev = &pdev->dev; + struct i2c_timings i2c_t; +- int irq, ret; ++ int ret; + + priv = devm_kzalloc(dev, sizeof(struct rcar_i2c_priv), GFP_KERNEL); + if (!priv) +@@ -979,10 +982,10 @@ static int rcar_i2c_probe(struct platform_device *pdev) + pm_runtime_put(dev); + + +- irq = platform_get_irq(pdev, 0); +- ret = devm_request_irq(dev, irq, rcar_i2c_irq, 0, dev_name(dev), priv); ++ priv->irq = platform_get_irq(pdev, 0); ++ ret = devm_request_irq(dev, priv->irq, rcar_i2c_irq, 0, dev_name(dev), priv); + if (ret < 0) { +- dev_err(dev, "cannot get irq %d\n", irq); ++ dev_err(dev, "cannot get irq %d\n", priv->irq); + goto out_pm_disable; + } + +diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c +index 511ff9a1d6d9..f9dbb064f957 100644 +--- a/drivers/iommu/dma-iommu.c ++++ b/drivers/iommu/dma-iommu.c +@@ -675,7 +675,7 @@ static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents, + * - and wouldn't make the resulting output segment too long + */ + if (cur_len && !s_iova_off && (dma_addr & seg_mask) && +- (cur_len + s_length <= max_len)) { ++ (max_len - cur_len >= s_length)) { + /* ...then concatenate it with the previous one */ + cur_len += s_length; + } else { +diff --git a/drivers/media/platform/omap/omap_vout_vrfb.c b/drivers/media/platform/omap/omap_vout_vrfb.c +index 29e3f5da59c1..11ec048929e8 100644 +--- a/drivers/media/platform/omap/omap_vout_vrfb.c ++++ b/drivers/media/platform/omap/omap_vout_vrfb.c +@@ -253,8 +253,7 @@ int omap_vout_prepare_vrfb(struct omap_vout_device *vout, + */ + + pixsize = vout->bpp * vout->vrfb_bpp; +- dst_icg = ((MAX_PIXELS_PER_LINE * pixsize) - +- (vout->pix.width * vout->bpp)) + 1; ++ dst_icg = MAX_PIXELS_PER_LINE * pixsize - vout->pix.width * vout->bpp; + + xt->src_start = vout->buf_phy_addr[vb->i]; + xt->dst_start = vout->vrfb_context[vb->i].paddr[0]; +diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h +index 225373e4a9ef..cdd7af16d5ee 100644 +--- a/drivers/misc/mei/hw-me-regs.h ++++ b/drivers/misc/mei/hw-me-regs.h +@@ -141,6 +141,8 @@ + + #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ + ++#define MEI_DEV_ID_TGP_LP 0xA0E0 /* Tiger Lake Point LP */ ++ + #define MEI_DEV_ID_MCC 0x4B70 /* Mule Creek Canyon (EHL) */ + #define MEI_DEV_ID_MCC_4 0x4B75 /* Mule Creek Canyon 4 (EHL) */ + +diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c +index a66ebceea408..e41f9e0a3fdf 100644 +--- a/drivers/misc/mei/pci-me.c ++++ b/drivers/misc/mei/pci-me.c +@@ -107,6 +107,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = { + + {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, + ++ {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH12_CFG)}, ++ + {MEI_PCI_DEVICE(MEI_DEV_ID_MCC, MEI_ME_PCH12_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_MCC_4, MEI_ME_PCH8_CFG)}, + +diff --git a/drivers/misc/vmw_vmci/vmci_doorbell.c b/drivers/misc/vmw_vmci/vmci_doorbell.c +index b3fa738ae005..f005206d9033 100644 +--- a/drivers/misc/vmw_vmci/vmci_doorbell.c ++++ b/drivers/misc/vmw_vmci/vmci_doorbell.c +@@ -318,7 +318,8 @@ int vmci_dbell_host_context_notify(u32 src_cid, struct vmci_handle handle) + + entry = container_of(resource, struct dbell_entry, resource); + if (entry->run_delayed) { +- schedule_work(&entry->work); ++ if (!schedule_work(&entry->work)) ++ vmci_resource_put(resource); + } else { + entry->notify_cb(entry->client_data); + vmci_resource_put(resource); +@@ -366,7 +367,8 @@ static void dbell_fire_entries(u32 notify_idx) + atomic_read(&dbell->active) == 1) { + if (dbell->run_delayed) { + vmci_resource_get(&dbell->resource); +- schedule_work(&dbell->work); ++ if (!schedule_work(&dbell->work)) ++ vmci_resource_put(&dbell->resource); + } else { + dbell->notify_cb(dbell->client_data); + } +diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c +index cfb8ee24eaba..04738359ec02 100644 +--- a/drivers/mmc/core/sd.c ++++ b/drivers/mmc/core/sd.c +@@ -1277,6 +1277,12 @@ int mmc_attach_sd(struct mmc_host *host) + goto err; + } + ++ /* ++ * Some SD cards claims an out of spec VDD voltage range. Let's treat ++ * these bits as being in-valid and especially also bit7. ++ */ ++ ocr &= ~0x7FFF; ++ + rocr = mmc_select_voltage(host, ocr); + + /* +diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c +index 682c573e20a7..e284102c16e9 100644 +--- a/drivers/mmc/host/sdhci-of-at91.c ++++ b/drivers/mmc/host/sdhci-of-at91.c +@@ -365,6 +365,9 @@ static int sdhci_at91_probe(struct platform_device *pdev) + pm_runtime_set_autosuspend_delay(&pdev->dev, 50); + pm_runtime_use_autosuspend(&pdev->dev); + ++ /* HS200 is broken at this moment */ ++ host->quirks2 = SDHCI_QUIRK2_BROKEN_HS200; ++ + ret = sdhci_add_host(host); + if (ret) + goto pm_runtime_disable; +diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c +index 0a3e046d78db..da2ba51dec35 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c ++++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c +@@ -369,7 +369,7 @@ static void mt76x0_stop_hardware(struct mt76x0_dev *dev) + mt76x0_chip_onoff(dev, false, false); + } + +-int mt76x0_init_hardware(struct mt76x0_dev *dev) ++int mt76x0_init_hardware(struct mt76x0_dev *dev, bool reset) + { + static const u16 beacon_offsets[16] = { + /* 512 byte per beacon */ +@@ -382,7 +382,7 @@ int mt76x0_init_hardware(struct mt76x0_dev *dev) + + dev->beacon_offsets = beacon_offsets; + +- mt76x0_chip_onoff(dev, true, true); ++ mt76x0_chip_onoff(dev, true, reset); + + ret = mt76x0_wait_asic_ready(dev); + if (ret) +diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h +index fc9857f61771..f9dfe5097b09 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h ++++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h +@@ -279,7 +279,7 @@ void mt76x0_addr_wr(struct mt76x0_dev *dev, const u32 offset, const u8 *addr); + + /* Init */ + struct mt76x0_dev *mt76x0_alloc_device(struct device *dev); +-int mt76x0_init_hardware(struct mt76x0_dev *dev); ++int mt76x0_init_hardware(struct mt76x0_dev *dev, bool reset); + int mt76x0_register_device(struct mt76x0_dev *dev); + void mt76x0_cleanup(struct mt76x0_dev *dev); + void mt76x0_chip_onoff(struct mt76x0_dev *dev, bool enable, bool reset); +diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c +index 54ae1f113be2..5aacb1f6a841 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c ++++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c +@@ -300,7 +300,7 @@ static int mt76x0_probe(struct usb_interface *usb_intf, + if (!(mt76_rr(dev, MT_EFUSE_CTRL) & MT_EFUSE_CTRL_SEL)) + dev_warn(dev->mt76.dev, "Warning: eFUSE not present\n"); + +- ret = mt76x0_init_hardware(dev); ++ ret = mt76x0_init_hardware(dev, true); + if (ret) + goto err; + +@@ -354,7 +354,7 @@ static int mt76x0_resume(struct usb_interface *usb_intf) + struct mt76x0_dev *dev = usb_get_intfdata(usb_intf); + int ret; + +- ret = mt76x0_init_hardware(dev); ++ ret = mt76x0_init_hardware(dev, false); + if (ret) + return ret; + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index e26d1191c5ad..ae0b01059fc6 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -1183,6 +1183,9 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, + */ + if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { + mutex_lock(&ctrl->scan_lock); ++ mutex_lock(&ctrl->subsys->lock); ++ nvme_mpath_start_freeze(ctrl->subsys); ++ nvme_mpath_wait_freeze(ctrl->subsys); + nvme_start_freeze(ctrl); + nvme_wait_freeze(ctrl); + } +@@ -1213,6 +1216,8 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) + nvme_update_formats(ctrl); + if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { + nvme_unfreeze(ctrl); ++ nvme_mpath_unfreeze(ctrl->subsys); ++ mutex_unlock(&ctrl->subsys->lock); + mutex_unlock(&ctrl->scan_lock); + } + if (effects & NVME_CMD_EFFECTS_CCC) +@@ -1557,6 +1562,7 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) + if (ns->head->disk) { + nvme_update_disk_info(ns->head->disk, ns, id); + blk_queue_stack_limits(ns->head->disk->queue, ns->queue); ++ revalidate_disk(ns->head->disk); + } + #endif + } +diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c +index a11e210d173e..05d6371c7f38 100644 +--- a/drivers/nvme/host/multipath.c ++++ b/drivers/nvme/host/multipath.c +@@ -20,6 +20,36 @@ module_param(multipath, bool, 0444); + MODULE_PARM_DESC(multipath, + "turn on native support for multiple controllers per subsystem"); + ++void nvme_mpath_unfreeze(struct nvme_subsystem *subsys) ++{ ++ struct nvme_ns_head *h; ++ ++ lockdep_assert_held(&subsys->lock); ++ list_for_each_entry(h, &subsys->nsheads, entry) ++ if (h->disk) ++ blk_mq_unfreeze_queue(h->disk->queue); ++} ++ ++void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys) ++{ ++ struct nvme_ns_head *h; ++ ++ lockdep_assert_held(&subsys->lock); ++ list_for_each_entry(h, &subsys->nsheads, entry) ++ if (h->disk) ++ blk_mq_freeze_queue_wait(h->disk->queue); ++} ++ ++void nvme_mpath_start_freeze(struct nvme_subsystem *subsys) ++{ ++ struct nvme_ns_head *h; ++ ++ lockdep_assert_held(&subsys->lock); ++ list_for_each_entry(h, &subsys->nsheads, entry) ++ if (h->disk) ++ blk_freeze_queue_start(h->disk->queue); ++} ++ + /* + * If multipathing is enabled we need to always use the subsystem instance + * number for numbering our devices to avoid conflicts between subsystems that +diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h +index d5e29b57eb34..2653e1f4196d 100644 +--- a/drivers/nvme/host/nvme.h ++++ b/drivers/nvme/host/nvme.h +@@ -469,6 +469,9 @@ static inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl) + return ctrl->ana_log_buf != NULL; + } + ++void nvme_mpath_unfreeze(struct nvme_subsystem *subsys); ++void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys); ++void nvme_mpath_start_freeze(struct nvme_subsystem *subsys); + void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns, + struct nvme_ctrl *ctrl, int *flags); + void nvme_failover_req(struct request *req); +@@ -553,6 +556,15 @@ static inline void nvme_mpath_uninit(struct nvme_ctrl *ctrl) + static inline void nvme_mpath_stop(struct nvme_ctrl *ctrl) + { + } ++static inline void nvme_mpath_unfreeze(struct nvme_subsystem *subsys) ++{ ++} ++static inline void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys) ++{ ++} ++static inline void nvme_mpath_start_freeze(struct nvme_subsystem *subsys) ++{ ++} + #endif /* CONFIG_NVME_MULTIPATH */ + + #ifdef CONFIG_NVM +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c +index 0a5d064f82ca..a64a8bca0d5b 100644 +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -2468,7 +2468,7 @@ static void nvme_async_probe(void *data, async_cookie_t cookie) + { + struct nvme_dev *dev = data; + +- nvme_reset_ctrl_sync(&dev->ctrl); ++ flush_work(&dev->ctrl.reset_work); + flush_work(&dev->ctrl.scan_work); + nvme_put_ctrl(&dev->ctrl); + } +@@ -2535,6 +2535,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) + + dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev)); + ++ nvme_reset_ctrl(&dev->ctrl); + nvme_get_ctrl(&dev->ctrl); + async_schedule(nvme_async_probe, dev); + +diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c +index 9908082b32c4..137a27fa369c 100644 +--- a/drivers/nvme/target/loop.c ++++ b/drivers/nvme/target/loop.c +@@ -678,6 +678,14 @@ static void nvme_loop_remove_port(struct nvmet_port *port) + mutex_lock(&nvme_loop_ports_mutex); + list_del_init(&port->entry); + mutex_unlock(&nvme_loop_ports_mutex); ++ ++ /* ++ * Ensure any ctrls that are in the process of being ++ * deleted are in fact deleted before we return ++ * and free the port. This is to prevent active ++ * ctrls from using a port after it's freed. ++ */ ++ flush_workqueue(nvme_delete_wq); + } + + static const struct nvmet_fabrics_ops nvme_loop_ops = { +diff --git a/drivers/scsi/ufs/unipro.h b/drivers/scsi/ufs/unipro.h +index 23129d7b2678..c77e36526447 100644 +--- a/drivers/scsi/ufs/unipro.h ++++ b/drivers/scsi/ufs/unipro.h +@@ -52,7 +52,7 @@ + #define RX_HS_UNTERMINATED_ENABLE 0x00A6 + #define RX_ENTER_HIBERN8 0x00A7 + #define RX_BYPASS_8B10B_ENABLE 0x00A8 +-#define RX_TERMINATION_FORCE_ENABLE 0x0089 ++#define RX_TERMINATION_FORCE_ENABLE 0x00A9 + #define RX_MIN_ACTIVATETIME_CAPABILITY 0x008F + #define RX_HIBERN8TIME_CAPABILITY 0x0092 + #define RX_REFCLKFREQ 0x00EB +diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c +index cb6a331f448a..70f78eda037e 100644 +--- a/drivers/soundwire/cadence_master.c ++++ b/drivers/soundwire/cadence_master.c +@@ -81,8 +81,8 @@ + + #define CDNS_MCP_INTSET 0x4C + +-#define CDNS_SDW_SLAVE_STAT 0x50 +-#define CDNS_MCP_SLAVE_STAT_MASK BIT(1, 0) ++#define CDNS_MCP_SLAVE_STAT 0x50 ++#define CDNS_MCP_SLAVE_STAT_MASK GENMASK(1, 0) + + #define CDNS_MCP_SLAVE_INTSTAT0 0x54 + #define CDNS_MCP_SLAVE_INTSTAT1 0x58 +@@ -96,8 +96,8 @@ + #define CDNS_MCP_SLAVE_INTMASK0 0x5C + #define CDNS_MCP_SLAVE_INTMASK1 0x60 + +-#define CDNS_MCP_SLAVE_INTMASK0_MASK GENMASK(30, 0) +-#define CDNS_MCP_SLAVE_INTMASK1_MASK GENMASK(16, 0) ++#define CDNS_MCP_SLAVE_INTMASK0_MASK GENMASK(31, 0) ++#define CDNS_MCP_SLAVE_INTMASK1_MASK GENMASK(15, 0) + + #define CDNS_MCP_PORT_INTSTAT 0x64 + #define CDNS_MCP_PDI_STAT 0x6C +diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c +index cc7c856126df..169ccfacfc75 100644 +--- a/drivers/usb/chipidea/udc.c ++++ b/drivers/usb/chipidea/udc.c +@@ -708,12 +708,6 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) + struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget); + unsigned long flags; + +- spin_lock_irqsave(&ci->lock, flags); +- ci->gadget.speed = USB_SPEED_UNKNOWN; +- ci->remote_wakeup = 0; +- ci->suspended = 0; +- spin_unlock_irqrestore(&ci->lock, flags); +- + /* flush all endpoints */ + gadget_for_each_ep(ep, gadget) { + usb_ep_fifo_flush(ep); +@@ -731,6 +725,12 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) + ci->status = NULL; + } + ++ spin_lock_irqsave(&ci->lock, flags); ++ ci->gadget.speed = USB_SPEED_UNKNOWN; ++ ci->remote_wakeup = 0; ++ ci->suspended = 0; ++ spin_unlock_irqrestore(&ci->lock, flags); ++ + return 0; + } + +@@ -1302,6 +1302,10 @@ static int ep_disable(struct usb_ep *ep) + return -EBUSY; + + spin_lock_irqsave(hwep->lock, flags); ++ if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) { ++ spin_unlock_irqrestore(hwep->lock, flags); ++ return 0; ++ } + + /* only internal SW should disable ctrl endpts */ + +@@ -1391,6 +1395,10 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, + return -EINVAL; + + spin_lock_irqsave(hwep->lock, flags); ++ if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) { ++ spin_unlock_irqrestore(hwep->lock, flags); ++ return 0; ++ } + retval = _ep_queue(ep, req, gfp_flags); + spin_unlock_irqrestore(hwep->lock, flags); + return retval; +@@ -1414,8 +1422,8 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) + return -EINVAL; + + spin_lock_irqsave(hwep->lock, flags); +- +- hw_ep_flush(hwep->ci, hwep->num, hwep->dir); ++ if (hwep->ci->gadget.speed != USB_SPEED_UNKNOWN) ++ hw_ep_flush(hwep->ci, hwep->num, hwep->dir); + + list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { + dma_pool_free(hwep->td_pool, node->ptr, node->dma); +@@ -1486,6 +1494,10 @@ static void ep_fifo_flush(struct usb_ep *ep) + } + + spin_lock_irqsave(hwep->lock, flags); ++ if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) { ++ spin_unlock_irqrestore(hwep->lock, flags); ++ return; ++ } + + hw_ep_flush(hwep->ci, hwep->num, hwep->dir); + +@@ -1558,6 +1570,10 @@ static int ci_udc_wakeup(struct usb_gadget *_gadget) + int ret = 0; + + spin_lock_irqsave(&ci->lock, flags); ++ if (ci->gadget.speed == USB_SPEED_UNKNOWN) { ++ spin_unlock_irqrestore(&ci->lock, flags); ++ return 0; ++ } + if (!ci->remote_wakeup) { + ret = -EOPNOTSUPP; + goto out; +diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c +index bec581fb7c63..b8a1fdefb515 100644 +--- a/drivers/usb/class/cdc-wdm.c ++++ b/drivers/usb/class/cdc-wdm.c +@@ -587,10 +587,20 @@ static int wdm_flush(struct file *file, fl_owner_t id) + { + struct wdm_device *desc = file->private_data; + +- wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags)); ++ wait_event(desc->wait, ++ /* ++ * needs both flags. We cannot do with one ++ * because resetting it would cause a race ++ * with write() yet we need to signal ++ * a disconnect ++ */ ++ !test_bit(WDM_IN_USE, &desc->flags) || ++ test_bit(WDM_DISCONNECTING, &desc->flags)); + + /* cannot dereference desc->intf if WDM_DISCONNECTING */ +- if (desc->werr < 0 && !test_bit(WDM_DISCONNECTING, &desc->flags)) ++ if (test_bit(WDM_DISCONNECTING, &desc->flags)) ++ return -ENODEV; ++ if (desc->werr < 0) + dev_err(&desc->intf->dev, "Error in flush path: %d\n", + desc->werr); + +@@ -974,8 +984,6 @@ static void wdm_disconnect(struct usb_interface *intf) + spin_lock_irqsave(&desc->iuspin, flags); + set_bit(WDM_DISCONNECTING, &desc->flags); + set_bit(WDM_READ, &desc->flags); +- /* to terminate pending flushes */ +- clear_bit(WDM_IN_USE, &desc->flags); + spin_unlock_irqrestore(&desc->iuspin, flags); + wake_up_all(&desc->wait); + mutex_lock(&desc->rlock); +diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c +index 03432467b05f..7537681355f6 100644 +--- a/drivers/usb/core/hcd-pci.c ++++ b/drivers/usb/core/hcd-pci.c +@@ -216,17 +216,18 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) + /* EHCI, OHCI */ + hcd->rsrc_start = pci_resource_start(dev, 0); + hcd->rsrc_len = pci_resource_len(dev, 0); +- if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, +- driver->description)) { ++ if (!devm_request_mem_region(&dev->dev, hcd->rsrc_start, ++ hcd->rsrc_len, driver->description)) { + dev_dbg(&dev->dev, "controller already in use\n"); + retval = -EBUSY; + goto put_hcd; + } +- hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); ++ hcd->regs = devm_ioremap_nocache(&dev->dev, hcd->rsrc_start, ++ hcd->rsrc_len); + if (hcd->regs == NULL) { + dev_dbg(&dev->dev, "error mapping memory\n"); + retval = -EFAULT; +- goto release_mem_region; ++ goto put_hcd; + } + + } else { +@@ -240,8 +241,8 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) + + hcd->rsrc_start = pci_resource_start(dev, region); + hcd->rsrc_len = pci_resource_len(dev, region); +- if (request_region(hcd->rsrc_start, hcd->rsrc_len, +- driver->description)) ++ if (devm_request_region(&dev->dev, hcd->rsrc_start, ++ hcd->rsrc_len, driver->description)) + break; + } + if (region == PCI_ROM_RESOURCE) { +@@ -275,20 +276,13 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) + } + + if (retval != 0) +- goto unmap_registers; ++ goto put_hcd; + device_wakeup_enable(hcd->self.controller); + + if (pci_dev_run_wake(dev)) + pm_runtime_put_noidle(&dev->dev); + return retval; + +-unmap_registers: +- if (driver->flags & HCD_MEMORY) { +- iounmap(hcd->regs); +-release_mem_region: +- release_mem_region(hcd->rsrc_start, hcd->rsrc_len); +- } else +- release_region(hcd->rsrc_start, hcd->rsrc_len); + put_hcd: + usb_put_hcd(hcd); + disable_pci: +@@ -347,14 +341,6 @@ void usb_hcd_pci_remove(struct pci_dev *dev) + dev_set_drvdata(&dev->dev, NULL); + up_read(&companions_rwsem); + } +- +- if (hcd->driver->flags & HCD_MEMORY) { +- iounmap(hcd->regs); +- release_mem_region(hcd->rsrc_start, hcd->rsrc_len); +- } else { +- release_region(hcd->rsrc_start, hcd->rsrc_len); +- } +- + usb_put_hcd(hcd); + pci_disable_device(dev); + } +diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c +index b8a15840b4ff..dfcabadeed01 100644 +--- a/drivers/usb/gadget/composite.c ++++ b/drivers/usb/gadget/composite.c +@@ -1976,6 +1976,7 @@ void composite_disconnect(struct usb_gadget *gadget) + * disconnect callbacks? + */ + spin_lock_irqsave(&cdev->lock, flags); ++ cdev->suspended = 0; + if (cdev->config) + reset_config(cdev); + if (cdev->driver->disconnect) +diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c +index 1074cb82ec17..0b7b4d09785b 100644 +--- a/drivers/usb/gadget/function/f_mass_storage.c ++++ b/drivers/usb/gadget/function/f_mass_storage.c +@@ -261,7 +261,7 @@ struct fsg_common; + struct fsg_common { + struct usb_gadget *gadget; + struct usb_composite_dev *cdev; +- struct fsg_dev *fsg, *new_fsg; ++ struct fsg_dev *fsg; + wait_queue_head_t io_wait; + wait_queue_head_t fsg_wait; + +@@ -290,6 +290,7 @@ struct fsg_common { + unsigned int bulk_out_maxpacket; + enum fsg_state state; /* For exception handling */ + unsigned int exception_req_tag; ++ void *exception_arg; + + enum data_direction data_dir; + u32 data_size; +@@ -391,7 +392,8 @@ static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep) + + /* These routines may be called in process context or in_irq */ + +-static void raise_exception(struct fsg_common *common, enum fsg_state new_state) ++static void __raise_exception(struct fsg_common *common, enum fsg_state new_state, ++ void *arg) + { + unsigned long flags; + +@@ -404,6 +406,7 @@ static void raise_exception(struct fsg_common *common, enum fsg_state new_state) + if (common->state <= new_state) { + common->exception_req_tag = common->ep0_req_tag; + common->state = new_state; ++ common->exception_arg = arg; + if (common->thread_task) + send_sig_info(SIGUSR1, SEND_SIG_FORCED, + common->thread_task); +@@ -411,6 +414,10 @@ static void raise_exception(struct fsg_common *common, enum fsg_state new_state) + spin_unlock_irqrestore(&common->lock, flags); + } + ++static void raise_exception(struct fsg_common *common, enum fsg_state new_state) ++{ ++ __raise_exception(common, new_state, NULL); ++} + + /*-------------------------------------------------------------------------*/ + +@@ -2285,16 +2292,16 @@ reset: + static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) + { + struct fsg_dev *fsg = fsg_from_func(f); +- fsg->common->new_fsg = fsg; +- raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); ++ ++ __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, fsg); + return USB_GADGET_DELAYED_STATUS; + } + + static void fsg_disable(struct usb_function *f) + { + struct fsg_dev *fsg = fsg_from_func(f); +- fsg->common->new_fsg = NULL; +- raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); ++ ++ __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL); + } + + +@@ -2307,6 +2314,7 @@ static void handle_exception(struct fsg_common *common) + enum fsg_state old_state; + struct fsg_lun *curlun; + unsigned int exception_req_tag; ++ struct fsg_dev *new_fsg; + + /* + * Clear the existing signals. Anything but SIGUSR1 is converted +@@ -2360,6 +2368,7 @@ static void handle_exception(struct fsg_common *common) + common->next_buffhd_to_fill = &common->buffhds[0]; + common->next_buffhd_to_drain = &common->buffhds[0]; + exception_req_tag = common->exception_req_tag; ++ new_fsg = common->exception_arg; + old_state = common->state; + common->state = FSG_STATE_NORMAL; + +@@ -2413,8 +2422,8 @@ static void handle_exception(struct fsg_common *common) + break; + + case FSG_STATE_CONFIG_CHANGE: +- do_set_interface(common, common->new_fsg); +- if (common->new_fsg) ++ do_set_interface(common, new_fsg); ++ if (new_fsg) + usb_composite_setup_continue(common->cdev); + break; + +@@ -2989,8 +2998,7 @@ static void fsg_unbind(struct usb_configuration *c, struct usb_function *f) + + DBG(fsg, "unbind\n"); + if (fsg->common->fsg == fsg) { +- fsg->common->new_fsg = NULL; +- raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); ++ __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL); + /* FIXME: make interruptible or killable somehow? */ + wait_event(common->fsg_wait, common->fsg != fsg); + } +diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c +index e64eb47770c8..2d5a72c15069 100644 +--- a/drivers/usb/host/fotg210-hcd.c ++++ b/drivers/usb/host/fotg210-hcd.c +@@ -1627,6 +1627,10 @@ static int fotg210_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, + /* see what we found out */ + temp = check_reset_complete(fotg210, wIndex, status_reg, + fotg210_readl(fotg210, status_reg)); ++ ++ /* restart schedule */ ++ fotg210->command |= CMD_RUN; ++ fotg210_writel(fotg210, fotg210->command, &fotg210->regs->command); + } + + if (!(temp & (PORT_RESUME|PORT_RESET))) { +diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c +index 210181fd98d2..af11887f5f9e 100644 +--- a/drivers/usb/host/ohci-hcd.c ++++ b/drivers/usb/host/ohci-hcd.c +@@ -418,8 +418,7 @@ static void ohci_usb_reset (struct ohci_hcd *ohci) + * other cases where the next software may expect clean state from the + * "firmware". this is bus-neutral, unlike shutdown() methods. + */ +-static void +-ohci_shutdown (struct usb_hcd *hcd) ++static void _ohci_shutdown(struct usb_hcd *hcd) + { + struct ohci_hcd *ohci; + +@@ -435,6 +434,16 @@ ohci_shutdown (struct usb_hcd *hcd) + ohci->rh_state = OHCI_RH_HALTED; + } + ++static void ohci_shutdown(struct usb_hcd *hcd) ++{ ++ struct ohci_hcd *ohci = hcd_to_ohci(hcd); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&ohci->lock, flags); ++ _ohci_shutdown(hcd); ++ spin_unlock_irqrestore(&ohci->lock, flags); ++} ++ + /*-------------------------------------------------------------------------* + * HC functions + *-------------------------------------------------------------------------*/ +@@ -752,7 +761,7 @@ static void io_watchdog_func(struct timer_list *t) + died: + usb_hc_died(ohci_to_hcd(ohci)); + ohci_dump(ohci); +- ohci_shutdown(ohci_to_hcd(ohci)); ++ _ohci_shutdown(ohci_to_hcd(ohci)); + goto done; + } else { + /* No write back because the done queue was empty */ +diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c +index 8616c52849c6..2b0ccd150209 100644 +--- a/drivers/usb/host/xhci-rcar.c ++++ b/drivers/usb/host/xhci-rcar.c +@@ -104,7 +104,7 @@ static int xhci_rcar_is_gen2(struct device *dev) + return of_device_is_compatible(node, "renesas,xhci-r8a7790") || + of_device_is_compatible(node, "renesas,xhci-r8a7791") || + of_device_is_compatible(node, "renesas,xhci-r8a7793") || +- of_device_is_compatible(node, "renensas,rcar-gen2-xhci"); ++ of_device_is_compatible(node, "renesas,rcar-gen2-xhci"); + } + + static int xhci_rcar_is_gen3(struct device *dev) +diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c +index cc794e25a0b6..1d9ce9cbc831 100644 +--- a/drivers/usb/storage/realtek_cr.c ++++ b/drivers/usb/storage/realtek_cr.c +@@ -38,7 +38,7 @@ MODULE_LICENSE("GPL"); + + static int auto_delink_en = 1; + module_param(auto_delink_en, int, S_IRUGO | S_IWUSR); +-MODULE_PARM_DESC(auto_delink_en, "enable auto delink"); ++MODULE_PARM_DESC(auto_delink_en, "auto delink mode (0=firmware, 1=software [default])"); + + #ifdef CONFIG_REALTEK_AUTOPM + static int ss_en = 1; +@@ -996,12 +996,15 @@ static int init_realtek_cr(struct us_data *us) + goto INIT_FAIL; + } + +- if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) || +- CHECK_FW_VER(chip, 0x5901)) +- SET_AUTO_DELINK(chip); +- if (STATUS_LEN(chip) == 16) { +- if (SUPPORT_AUTO_DELINK(chip)) ++ if (CHECK_PID(chip, 0x0138) || CHECK_PID(chip, 0x0158) || ++ CHECK_PID(chip, 0x0159)) { ++ if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) || ++ CHECK_FW_VER(chip, 0x5901)) + SET_AUTO_DELINK(chip); ++ if (STATUS_LEN(chip) == 16) { ++ if (SUPPORT_AUTO_DELINK(chip)) ++ SET_AUTO_DELINK(chip); ++ } + } + #ifdef CONFIG_REALTEK_AUTOPM + if (ss_en) +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h +index ea0d27a94afe..1cd9b6305b06 100644 +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -2100,7 +2100,7 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, + US_FL_IGNORE_RESIDUE ), + + /* Reported by Michael Büsch <m@bues.ch> */ +-UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0116, ++UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0117, + "JMicron", + "USB to ATA/ATAPI Bridge", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, +diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c +index 5f29ce8d6c3f..fb20aa974ae1 100644 +--- a/drivers/usb/typec/tcpm.c ++++ b/drivers/usb/typec/tcpm.c +@@ -1445,7 +1445,7 @@ static enum pdo_err tcpm_caps_err(struct tcpm_port *port, const u32 *pdo, + else if ((pdo_min_voltage(pdo[i]) == + pdo_min_voltage(pdo[i - 1])) && + (pdo_max_voltage(pdo[i]) == +- pdo_min_voltage(pdo[i - 1]))) ++ pdo_max_voltage(pdo[i - 1]))) + return PDO_ERR_DUPE_PDO; + break; + /* +diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c +index ed05514cc2dc..e6c27b71b136 100644 +--- a/drivers/watchdog/bcm2835_wdt.c ++++ b/drivers/watchdog/bcm2835_wdt.c +@@ -249,6 +249,7 @@ module_param(nowayout, bool, 0); + MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); + ++MODULE_ALIAS("platform:bcm2835-wdt"); + MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>"); + MODULE_DESCRIPTION("Driver for Broadcom BCM2835 watchdog timer"); + MODULE_LICENSE("GPL"); +diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c +index 9e51d6fe7e8f..40c6860d4c63 100644 +--- a/fs/afs/cmservice.c ++++ b/fs/afs/cmservice.c +@@ -423,18 +423,14 @@ static void SRXAFSCB_ProbeUuid(struct work_struct *work) + struct afs_call *call = container_of(work, struct afs_call, work); + struct afs_uuid *r = call->request; + +- struct { +- __be32 match; +- } reply; +- + _enter(""); + + if (memcmp(r, &call->net->uuid, sizeof(call->net->uuid)) == 0) +- reply.match = htonl(0); ++ afs_send_empty_reply(call); + else +- reply.match = htonl(1); ++ rxrpc_kernel_abort_call(call->net->socket, call->rxcall, ++ 1, 1, "K-1"); + +- afs_send_simple_reply(call, &reply, sizeof(reply)); + afs_put_call(call); + _leave(""); + } +diff --git a/fs/afs/dir.c b/fs/afs/dir.c +index 855bf2b79fed..54e7f6f1405e 100644 +--- a/fs/afs/dir.c ++++ b/fs/afs/dir.c +@@ -937,7 +937,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) + dir_version = (long)dir->status.data_version; + de_version = (long)dentry->d_fsdata; + if (de_version == dir_version) +- goto out_valid; ++ goto out_valid_noupdate; + + dir_version = (long)dir->invalid_before; + if (de_version - dir_version >= 0) +@@ -1001,6 +1001,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) + + out_valid: + dentry->d_fsdata = (void *)dir_version; ++out_valid_noupdate: + dput(parent); + key_put(key); + _leave(" = 1 [valid]"); +diff --git a/fs/afs/file.c b/fs/afs/file.c +index 7d4f26198573..843d3b970b84 100644 +--- a/fs/afs/file.c ++++ b/fs/afs/file.c +@@ -193,11 +193,13 @@ void afs_put_read(struct afs_read *req) + int i; + + if (refcount_dec_and_test(&req->usage)) { +- for (i = 0; i < req->nr_pages; i++) +- if (req->pages[i]) +- put_page(req->pages[i]); +- if (req->pages != req->array) +- kfree(req->pages); ++ if (req->pages) { ++ for (i = 0; i < req->nr_pages; i++) ++ if (req->pages[i]) ++ put_page(req->pages[i]); ++ if (req->pages != req->array) ++ kfree(req->pages); ++ } + kfree(req); + } + } +diff --git a/fs/afs/vlclient.c b/fs/afs/vlclient.c +index c3b740813fc7..c7dd47eaff29 100644 +--- a/fs/afs/vlclient.c ++++ b/fs/afs/vlclient.c +@@ -60,23 +60,24 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call) + struct afs_uuid__xdr *xdr; + struct afs_uuid *uuid; + int j; ++ int n = entry->nr_servers; + + tmp = ntohl(uvldb->serverFlags[i]); + if (tmp & AFS_VLSF_DONTUSE || + (new_only && !(tmp & AFS_VLSF_NEWREPSITE))) + continue; + if (tmp & AFS_VLSF_RWVOL) { +- entry->fs_mask[i] |= AFS_VOL_VTM_RW; ++ entry->fs_mask[n] |= AFS_VOL_VTM_RW; + if (vlflags & AFS_VLF_BACKEXISTS) +- entry->fs_mask[i] |= AFS_VOL_VTM_BAK; ++ entry->fs_mask[n] |= AFS_VOL_VTM_BAK; + } + if (tmp & AFS_VLSF_ROVOL) +- entry->fs_mask[i] |= AFS_VOL_VTM_RO; +- if (!entry->fs_mask[i]) ++ entry->fs_mask[n] |= AFS_VOL_VTM_RO; ++ if (!entry->fs_mask[n]) + continue; + + xdr = &uvldb->serverNumber[i]; +- uuid = (struct afs_uuid *)&entry->fs_server[i]; ++ uuid = (struct afs_uuid *)&entry->fs_server[n]; + uuid->time_low = xdr->time_low; + uuid->time_mid = htons(ntohl(xdr->time_mid)); + uuid->time_hi_and_version = htons(ntohl(xdr->time_hi_and_version)); +diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c +index 33824a0a57bf..f516ace8f45d 100644 +--- a/fs/nfs/direct.c ++++ b/fs/nfs/direct.c +@@ -400,15 +400,21 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr) + unsigned long bytes = 0; + struct nfs_direct_req *dreq = hdr->dreq; + +- if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) +- goto out_put; +- + spin_lock(&dreq->lock); +- if (test_bit(NFS_IOHDR_ERROR, &hdr->flags) && (hdr->good_bytes == 0)) ++ if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) + dreq->error = hdr->error; +- else ++ ++ if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) { ++ spin_unlock(&dreq->lock); ++ goto out_put; ++ } ++ ++ if (hdr->good_bytes != 0) + nfs_direct_good_bytes(dreq, hdr); + ++ if (test_bit(NFS_IOHDR_EOF, &hdr->flags)) ++ dreq->error = 0; ++ + spin_unlock(&dreq->lock); + + while (!list_empty(&hdr->pages)) { +@@ -428,7 +434,7 @@ out_put: + hdr->release(hdr); + } + +-static void nfs_read_sync_pgio_error(struct list_head *head) ++static void nfs_read_sync_pgio_error(struct list_head *head, int error) + { + struct nfs_page *req; + +@@ -664,8 +670,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) + + list_for_each_entry_safe(req, tmp, &reqs, wb_list) { + if (!nfs_pageio_add_request(&desc, req)) { +- nfs_list_remove_request(req); +- nfs_list_add_request(req, &failed); ++ nfs_list_move_request(req, &failed); + spin_lock(&cinfo.inode->i_lock); + dreq->flags = 0; + if (desc.pg_error < 0) +@@ -775,16 +780,19 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) + bool request_commit = false; + struct nfs_page *req = nfs_list_entry(hdr->pages.next); + +- if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) +- goto out_put; +- + nfs_init_cinfo_from_dreq(&cinfo, dreq); + + spin_lock(&dreq->lock); + + if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) + dreq->error = hdr->error; +- if (dreq->error == 0) { ++ ++ if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) { ++ spin_unlock(&dreq->lock); ++ goto out_put; ++ } ++ ++ if (hdr->good_bytes != 0) { + nfs_direct_good_bytes(dreq, hdr); + if (nfs_write_need_commit(hdr)) { + if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES) +@@ -821,7 +829,7 @@ out_put: + hdr->release(hdr); + } + +-static void nfs_write_sync_pgio_error(struct list_head *head) ++static void nfs_write_sync_pgio_error(struct list_head *head, int error) + { + struct nfs_page *req; + +diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c +index 0ec6bce3dd69..d23ea74b5d20 100644 +--- a/fs/nfs/pagelist.c ++++ b/fs/nfs/pagelist.c +@@ -769,8 +769,7 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, + pageused = 0; + while (!list_empty(head)) { + req = nfs_list_entry(head->next); +- nfs_list_remove_request(req); +- nfs_list_add_request(req, &hdr->pages); ++ nfs_list_move_request(req, &hdr->pages); + + if (!last_page || last_page != req->wb_page) { + pageused++; +@@ -962,8 +961,7 @@ static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc, + } + if (!nfs_can_coalesce_requests(prev, req, desc)) + return 0; +- nfs_list_remove_request(req); +- nfs_list_add_request(req, &mirror->pg_list); ++ nfs_list_move_request(req, &mirror->pg_list); + mirror->pg_count += req->wb_bytes; + return 1; + } +@@ -995,9 +993,8 @@ nfs_pageio_cleanup_request(struct nfs_pageio_descriptor *desc, + { + LIST_HEAD(head); + +- nfs_list_remove_request(req); +- nfs_list_add_request(req, &head); +- desc->pg_completion_ops->error_cleanup(&head); ++ nfs_list_move_request(req, &head); ++ desc->pg_completion_ops->error_cleanup(&head, desc->pg_error); + } + + /** +@@ -1133,7 +1130,8 @@ static void nfs_pageio_error_cleanup(struct nfs_pageio_descriptor *desc) + + for (midx = 0; midx < desc->pg_mirror_count; midx++) { + mirror = &desc->pg_mirrors[midx]; +- desc->pg_completion_ops->error_cleanup(&mirror->pg_list); ++ desc->pg_completion_ops->error_cleanup(&mirror->pg_list, ++ desc->pg_error); + } + } + +@@ -1235,21 +1233,23 @@ static void nfs_pageio_complete_mirror(struct nfs_pageio_descriptor *desc, + int nfs_pageio_resend(struct nfs_pageio_descriptor *desc, + struct nfs_pgio_header *hdr) + { +- LIST_HEAD(failed); ++ LIST_HEAD(pages); + + desc->pg_io_completion = hdr->io_completion; + desc->pg_dreq = hdr->dreq; +- while (!list_empty(&hdr->pages)) { +- struct nfs_page *req = nfs_list_entry(hdr->pages.next); ++ list_splice_init(&hdr->pages, &pages); ++ while (!list_empty(&pages)) { ++ struct nfs_page *req = nfs_list_entry(pages.next); + +- nfs_list_remove_request(req); + if (!nfs_pageio_add_request(desc, req)) +- nfs_list_add_request(req, &failed); ++ break; + } + nfs_pageio_complete(desc); +- if (!list_empty(&failed)) { +- list_move(&failed, &hdr->pages); +- return desc->pg_error < 0 ? desc->pg_error : -EIO; ++ if (!list_empty(&pages)) { ++ int err = desc->pg_error < 0 ? desc->pg_error : -EIO; ++ hdr->completion_ops->error_cleanup(&pages, err); ++ nfs_set_pgio_error(hdr, err, hdr->io_start); ++ return err; + } + return 0; + } +diff --git a/fs/nfs/read.c b/fs/nfs/read.c +index 48d7277c60a9..09d5c282f50e 100644 +--- a/fs/nfs/read.c ++++ b/fs/nfs/read.c +@@ -205,7 +205,7 @@ static void nfs_initiate_read(struct nfs_pgio_header *hdr, + } + + static void +-nfs_async_read_error(struct list_head *head) ++nfs_async_read_error(struct list_head *head, int error) + { + struct nfs_page *req; + +diff --git a/fs/nfs/write.c b/fs/nfs/write.c +index 51d0b7913c04..5ab997912d8d 100644 +--- a/fs/nfs/write.c ++++ b/fs/nfs/write.c +@@ -1394,20 +1394,27 @@ static void nfs_redirty_request(struct nfs_page *req) + nfs_release_request(req); + } + +-static void nfs_async_write_error(struct list_head *head) ++static void nfs_async_write_error(struct list_head *head, int error) + { + struct nfs_page *req; + + while (!list_empty(head)) { + req = nfs_list_entry(head->next); + nfs_list_remove_request(req); ++ if (nfs_error_is_fatal(error)) { ++ nfs_context_set_write_error(req->wb_context, error); ++ if (nfs_error_is_fatal_on_server(error)) { ++ nfs_write_error_remove_page(req); ++ continue; ++ } ++ } + nfs_redirty_request(req); + } + } + + static void nfs_async_write_reschedule_io(struct nfs_pgio_header *hdr) + { +- nfs_async_write_error(&hdr->pages); ++ nfs_async_write_error(&hdr->pages, 0); + filemap_fdatawrite_range(hdr->inode->i_mapping, hdr->args.offset, + hdr->args.offset + hdr->args.count - 1); + } +diff --git a/include/linux/logic_pio.h b/include/linux/logic_pio.h +index cbd9d8495690..88e1e6304a71 100644 +--- a/include/linux/logic_pio.h ++++ b/include/linux/logic_pio.h +@@ -117,6 +117,7 @@ struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode); + unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode, + resource_size_t hw_addr, resource_size_t size); + int logic_pio_register_range(struct logic_pio_hwaddr *newrange); ++void logic_pio_unregister_range(struct logic_pio_hwaddr *range); + resource_size_t logic_pio_to_hwaddr(unsigned long pio); + unsigned long logic_pio_trans_cpuaddr(resource_size_t hw_addr); + +diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h +index e27572d30d97..ad69430fd0eb 100644 +--- a/include/linux/nfs_page.h ++++ b/include/linux/nfs_page.h +@@ -164,6 +164,16 @@ nfs_list_add_request(struct nfs_page *req, struct list_head *head) + list_add_tail(&req->wb_list, head); + } + ++/** ++ * nfs_list_move_request - Move a request to a new list ++ * @req: request ++ * @head: head of list into which to insert the request. ++ */ ++static inline void ++nfs_list_move_request(struct nfs_page *req, struct list_head *head) ++{ ++ list_move_tail(&req->wb_list, head); ++} + + /** + * nfs_list_remove_request - Remove a request from its wb_list +diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h +index bd1c889a9ed9..cab24a127feb 100644 +--- a/include/linux/nfs_xdr.h ++++ b/include/linux/nfs_xdr.h +@@ -1539,7 +1539,7 @@ struct nfs_commit_data { + }; + + struct nfs_pgio_completion_ops { +- void (*error_cleanup)(struct list_head *head); ++ void (*error_cleanup)(struct list_head *head, int); + void (*init_hdr)(struct nfs_pgio_header *hdr); + void (*completion)(struct nfs_pgio_header *hdr); + void (*reschedule_io)(struct nfs_pgio_header *hdr); +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c +index d9dd709b3c12..7e215dac9693 100644 +--- a/kernel/trace/ftrace.c ++++ b/kernel/trace/ftrace.c +@@ -3112,6 +3112,14 @@ t_probe_next(struct seq_file *m, loff_t *pos) + hnd = &iter->probe_entry->hlist; + + hash = iter->probe->ops.func_hash->filter_hash; ++ ++ /* ++ * A probe being registered may temporarily have an empty hash ++ * and it's at the end of the func_probes list. ++ */ ++ if (!hash || hash == EMPTY_HASH) ++ return NULL; ++ + size = 1 << hash->size_bits; + + retry: +@@ -4307,12 +4315,21 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr, + + mutex_unlock(&ftrace_lock); + ++ /* ++ * Note, there's a small window here that the func_hash->filter_hash ++ * may be NULL or empty. Need to be carefule when reading the loop. ++ */ + mutex_lock(&probe->ops.func_hash->regex_lock); + + orig_hash = &probe->ops.func_hash->filter_hash; + old_hash = *orig_hash; + hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash); + ++ if (!hash) { ++ ret = -ENOMEM; ++ goto out; ++ } ++ + ret = ftrace_match_records(hash, glob, strlen(glob)); + + /* Nothing found? */ +diff --git a/lib/logic_pio.c b/lib/logic_pio.c +index feea48fd1a0d..905027574e5d 100644 +--- a/lib/logic_pio.c ++++ b/lib/logic_pio.c +@@ -35,7 +35,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) + struct logic_pio_hwaddr *range; + resource_size_t start; + resource_size_t end; +- resource_size_t mmio_sz = 0; ++ resource_size_t mmio_end = 0; + resource_size_t iio_sz = MMIO_UPPER_LIMIT; + int ret = 0; + +@@ -46,7 +46,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) + end = new_range->hw_start + new_range->size; + + mutex_lock(&io_range_mutex); +- list_for_each_entry_rcu(range, &io_range_list, list) { ++ list_for_each_entry(range, &io_range_list, list) { + if (range->fwnode == new_range->fwnode) { + /* range already there */ + goto end_register; +@@ -56,7 +56,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) + /* for MMIO ranges we need to check for overlap */ + if (start >= range->hw_start + range->size || + end < range->hw_start) { +- mmio_sz += range->size; ++ mmio_end = range->io_start + range->size; + } else { + ret = -EFAULT; + goto end_register; +@@ -69,16 +69,16 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) + + /* range not registered yet, check for available space */ + if (new_range->flags == LOGIC_PIO_CPU_MMIO) { +- if (mmio_sz + new_range->size - 1 > MMIO_UPPER_LIMIT) { ++ if (mmio_end + new_range->size - 1 > MMIO_UPPER_LIMIT) { + /* if it's too big check if 64K space can be reserved */ +- if (mmio_sz + SZ_64K - 1 > MMIO_UPPER_LIMIT) { ++ if (mmio_end + SZ_64K - 1 > MMIO_UPPER_LIMIT) { + ret = -E2BIG; + goto end_register; + } + new_range->size = SZ_64K; + pr_warn("Requested IO range too big, new size set to 64K\n"); + } +- new_range->io_start = mmio_sz; ++ new_range->io_start = mmio_end; + } else if (new_range->flags == LOGIC_PIO_INDIRECT) { + if (iio_sz + new_range->size - 1 > IO_SPACE_LIMIT) { + ret = -E2BIG; +@@ -98,6 +98,20 @@ end_register: + return ret; + } + ++/** ++ * logic_pio_unregister_range - unregister a logical PIO range for a host ++ * @range: pointer to the IO range which has been already registered. ++ * ++ * Unregister a previously-registered IO range node. ++ */ ++void logic_pio_unregister_range(struct logic_pio_hwaddr *range) ++{ ++ mutex_lock(&io_range_mutex); ++ list_del_rcu(&range->list); ++ mutex_unlock(&io_range_mutex); ++ synchronize_rcu(); ++} ++ + /** + * find_io_range_by_fwnode - find logical PIO range for given FW node + * @fwnode: FW node handle associated with logical PIO range +@@ -108,26 +122,38 @@ end_register: + */ + struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode) + { +- struct logic_pio_hwaddr *range; ++ struct logic_pio_hwaddr *range, *found_range = NULL; + ++ rcu_read_lock(); + list_for_each_entry_rcu(range, &io_range_list, list) { +- if (range->fwnode == fwnode) +- return range; ++ if (range->fwnode == fwnode) { ++ found_range = range; ++ break; ++ } + } +- return NULL; ++ rcu_read_unlock(); ++ ++ return found_range; + } + + /* Return a registered range given an input PIO token */ + static struct logic_pio_hwaddr *find_io_range(unsigned long pio) + { +- struct logic_pio_hwaddr *range; ++ struct logic_pio_hwaddr *range, *found_range = NULL; + ++ rcu_read_lock(); + list_for_each_entry_rcu(range, &io_range_list, list) { +- if (in_range(pio, range->io_start, range->size)) +- return range; ++ if (in_range(pio, range->io_start, range->size)) { ++ found_range = range; ++ break; ++ } + } +- pr_err("PIO entry token %lx invalid\n", pio); +- return NULL; ++ rcu_read_unlock(); ++ ++ if (!found_range) ++ pr_err("PIO entry token 0x%lx invalid\n", pio); ++ ++ return found_range; + } + + /** +@@ -180,14 +206,23 @@ unsigned long logic_pio_trans_cpuaddr(resource_size_t addr) + { + struct logic_pio_hwaddr *range; + ++ rcu_read_lock(); + list_for_each_entry_rcu(range, &io_range_list, list) { + if (range->flags != LOGIC_PIO_CPU_MMIO) + continue; +- if (in_range(addr, range->hw_start, range->size)) +- return addr - range->hw_start + range->io_start; ++ if (in_range(addr, range->hw_start, range->size)) { ++ unsigned long cpuaddr; ++ ++ cpuaddr = addr - range->hw_start + range->io_start; ++ ++ rcu_read_unlock(); ++ return cpuaddr; ++ } + } +- pr_err("addr %llx not registered in io_range_list\n", +- (unsigned long long) addr); ++ rcu_read_unlock(); ++ ++ pr_err("addr %pa not registered in io_range_list\n", &addr); ++ + return ~0UL; + } + +diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c +index c2c4f739da8f..4b9063d12b93 100644 +--- a/mm/zsmalloc.c ++++ b/mm/zsmalloc.c +@@ -2432,7 +2432,9 @@ struct zs_pool *zs_create_pool(const char *name) + if (!pool->name) + goto err; + ++#ifdef CONFIG_COMPACTION + init_waitqueue_head(&pool->migration_wait); ++#endif + + if (create_cache(pool)) + goto err; +diff --git a/net/core/stream.c b/net/core/stream.c +index 7d329fb1f553..7f5eaa95a675 100644 +--- a/net/core/stream.c ++++ b/net/core/stream.c +@@ -120,7 +120,6 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) + int err = 0; + long vm_wait = 0; + long current_timeo = *timeo_p; +- bool noblock = (*timeo_p ? false : true); + DEFINE_WAIT_FUNC(wait, woken_wake_function); + + if (sk_stream_memory_free(sk)) +@@ -133,11 +132,8 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) + + if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN)) + goto do_error; +- if (!*timeo_p) { +- if (noblock) +- set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); +- goto do_nonblock; +- } ++ if (!*timeo_p) ++ goto do_eagain; + if (signal_pending(current)) + goto do_interrupted; + sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk); +@@ -169,7 +165,13 @@ out: + do_error: + err = -EPIPE; + goto out; +-do_nonblock: ++do_eagain: ++ /* Make sure that whenever EAGAIN is returned, EPOLLOUT event can ++ * be generated later. ++ * When TCP receives ACK packets that make room, tcp_check_space() ++ * only calls tcp_new_space() if SOCK_NOSPACE is set. ++ */ ++ set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); + err = -EAGAIN; + goto out; + do_interrupted: +diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c +index ad75c468ecfb..0167e23d1c8f 100644 +--- a/net/ipv4/icmp.c ++++ b/net/ipv4/icmp.c +@@ -587,7 +587,13 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info, + + if (!rt) + goto out; +- net = dev_net(rt->dst.dev); ++ ++ if (rt->dst.dev) ++ net = dev_net(rt->dst.dev); ++ else if (skb_in->dev) ++ net = dev_net(skb_in->dev); ++ else ++ goto out; + + /* + * Find the original header. It is expected to be valid, of course. +diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c +index c57efd5c5b38..49e2f6dac646 100644 +--- a/net/ipv6/addrconf.c ++++ b/net/ipv6/addrconf.c +@@ -995,7 +995,8 @@ ipv6_add_addr(struct inet6_dev *idev, struct ifa6_config *cfg, + int err = 0; + + if (addr_type == IPV6_ADDR_ANY || +- addr_type & IPV6_ADDR_MULTICAST || ++ (addr_type & IPV6_ADDR_MULTICAST && ++ !(cfg->ifa_flags & IFA_F_MCAUTOJOIN)) || + (!(idev->dev->flags & IFF_LOOPBACK) && + addr_type & IPV6_ADDR_LOOPBACK)) + return ERR_PTR(-EADDRNOTAVAIL); +diff --git a/net/ipv6/route.c b/net/ipv6/route.c +index 81220077d62f..c88586380134 100644 +--- a/net/ipv6/route.c ++++ b/net/ipv6/route.c +@@ -3109,7 +3109,7 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg, + rt->fib6_metric = cfg->fc_metric; + rt->fib6_nh.nh_weight = 1; + +- rt->fib6_type = cfg->fc_type; ++ rt->fib6_type = cfg->fc_type ? : RTN_UNICAST; + + /* We cannot add true routes via loopback here, + they would result in kernel looping; promote them to reject routes +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c +index 40c510223467..a48e83b19cfa 100644 +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1471,6 +1471,11 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, + if (is_multicast_ether_addr(mac)) + return -EINVAL; + ++ if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER) && ++ sdata->vif.type == NL80211_IFTYPE_STATION && ++ !sdata->u.mgd.associated) ++ return -EINVAL; ++ + sta = sta_info_alloc(sdata, mac, GFP_KERNEL); + if (!sta) + return -ENOMEM; +@@ -1478,10 +1483,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, + if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) + sta->sta.tdls = true; + +- if (sta->sta.tdls && sdata->vif.type == NL80211_IFTYPE_STATION && +- !sdata->u.mgd.associated) +- return -EINVAL; +- + err = sta_apply_parameters(local, sta, params); + if (err) { + sta_info_free(local, sta); +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c +index 7523d995ea8a..b12f23c996f4 100644 +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -2372,11 +2372,13 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb, + skb->protocol == cpu_to_be16(ETH_P_PREAUTH)) && + sdata->control_port_over_nl80211)) { + struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); +- bool noencrypt = status->flag & RX_FLAG_DECRYPTED; ++ bool noencrypt = !(status->flag & RX_FLAG_DECRYPTED); + + cfg80211_rx_control_port(dev, skb, noencrypt); + dev_kfree_skb(skb); + } else { ++ memset(skb->cb, 0, sizeof(skb->cb)); ++ + /* deliver to local stack */ + if (rx->napi) + napi_gro_receive(rx->napi, skb); +@@ -2470,8 +2472,6 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) + + if (skb) { + skb->protocol = eth_type_trans(skb, dev); +- memset(skb->cb, 0, sizeof(skb->cb)); +- + ieee80211_deliver_skb_to_local_stack(skb, rx); + } + +diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c +index d8366ed51757..28361aef9982 100644 +--- a/net/smc/smc_tx.c ++++ b/net/smc/smc_tx.c +@@ -75,13 +75,11 @@ static int smc_tx_wait(struct smc_sock *smc, int flags) + DEFINE_WAIT_FUNC(wait, woken_wake_function); + struct smc_connection *conn = &smc->conn; + struct sock *sk = &smc->sk; +- bool noblock; + long timeo; + int rc = 0; + + /* similar to sk_stream_wait_memory */ + timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); +- noblock = timeo ? false : true; + add_wait_queue(sk_sleep(sk), &wait); + while (1) { + sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); +@@ -96,8 +94,8 @@ static int smc_tx_wait(struct smc_sock *smc, int flags) + break; + } + if (!timeo) { +- if (noblock) +- set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); ++ /* ensure EPOLLOUT is subsequently generated */ ++ set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); + rc = -EAGAIN; + break; + } +diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c +index 4c0ac79f82d4..3288bdff9889 100644 +--- a/net/tls/tls_main.c ++++ b/net/tls/tls_main.c +@@ -301,6 +301,8 @@ static void tls_sk_proto_close(struct sock *sk, long timeout) + #else + { + #endif ++ if (sk->sk_write_space == tls_write_space) ++ sk->sk_write_space = ctx->sk_write_space; + tls_ctx_free(ctx); + ctx = NULL; + } +diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c +index 6848a8196711..bbb2da70e870 100644 +--- a/net/tls/tls_sw.c ++++ b/net/tls/tls_sw.c +@@ -354,7 +354,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) + { + struct tls_context *tls_ctx = tls_get_ctx(sk); + struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx); +- int ret = 0; ++ int ret; + int required_size; + long timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); + bool eor = !(msg->msg_flags & MSG_MORE); +@@ -370,7 +370,8 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) + + lock_sock(sk); + +- if (tls_complete_pending_work(sk, tls_ctx, msg->msg_flags, &timeo)) ++ ret = tls_complete_pending_work(sk, tls_ctx, msg->msg_flags, &timeo); ++ if (ret) + goto send_end; + + if (unlikely(msg->msg_controllen)) { +@@ -505,7 +506,7 @@ int tls_sw_sendpage(struct sock *sk, struct page *page, + { + struct tls_context *tls_ctx = tls_get_ctx(sk); + struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx); +- int ret = 0; ++ int ret; + long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); + bool eor; + size_t orig_size = size; +@@ -525,7 +526,8 @@ int tls_sw_sendpage(struct sock *sk, struct page *page, + + sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk); + +- if (tls_complete_pending_work(sk, tls_ctx, flags, &timeo)) ++ ret = tls_complete_pending_work(sk, tls_ctx, flags, &timeo); ++ if (ret) + goto sendpage_end; + + /* Call the sk_stream functions to manage the sndbuf mem. */ +diff --git a/net/wireless/reg.c b/net/wireless/reg.c +index 8a47297ff206..d8ebf4f0ef6e 100644 +--- a/net/wireless/reg.c ++++ b/net/wireless/reg.c +@@ -2777,7 +2777,7 @@ static void reg_process_pending_hints(void) + + /* When last_request->processed becomes true this will be rescheduled */ + if (lr && !lr->processed) { +- reg_process_hint(lr); ++ pr_debug("Pending regulatory request, waiting for it to be processed...\n"); + return; + } + +diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c +index bbf91a5a938b..bd3d68e0489d 100644 +--- a/sound/core/seq/seq_clientmgr.c ++++ b/sound/core/seq/seq_clientmgr.c +@@ -1818,8 +1818,7 @@ static int snd_seq_ioctl_get_client_pool(struct snd_seq_client *client, + if (cptr->type == USER_CLIENT) { + info->input_pool = cptr->data.user.fifo_pool_size; + info->input_free = info->input_pool; +- if (cptr->data.user.fifo) +- info->input_free = snd_seq_unused_cells(cptr->data.user.fifo->pool); ++ info->input_free = snd_seq_fifo_unused_cells(cptr->data.user.fifo); + } else { + info->input_pool = 0; + info->input_free = 0; +diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c +index 72c0302a55d2..6a24732704fc 100644 +--- a/sound/core/seq/seq_fifo.c ++++ b/sound/core/seq/seq_fifo.c +@@ -280,3 +280,20 @@ int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize) + + return 0; + } ++ ++/* get the number of unused cells safely */ ++int snd_seq_fifo_unused_cells(struct snd_seq_fifo *f) ++{ ++ unsigned long flags; ++ int cells; ++ ++ if (!f) ++ return 0; ++ ++ snd_use_lock_use(&f->use_lock); ++ spin_lock_irqsave(&f->lock, flags); ++ cells = snd_seq_unused_cells(f->pool); ++ spin_unlock_irqrestore(&f->lock, flags); ++ snd_use_lock_free(&f->use_lock); ++ return cells; ++} +diff --git a/sound/core/seq/seq_fifo.h b/sound/core/seq/seq_fifo.h +index 062c446e7867..5d38a0d7f0cd 100644 +--- a/sound/core/seq/seq_fifo.h ++++ b/sound/core/seq/seq_fifo.h +@@ -68,5 +68,7 @@ int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file, poll_table + /* resize pool in fifo */ + int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize); + ++/* get the number of unused cells safely */ ++int snd_seq_fifo_unused_cells(struct snd_seq_fifo *f); + + #endif +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c +index 6f17b256fcd0..ae8fde4c1a12 100644 +--- a/sound/pci/hda/patch_conexant.c ++++ b/sound/pci/hda/patch_conexant.c +@@ -624,18 +624,20 @@ static void cxt_fixup_hp_gate_mic_jack(struct hda_codec *codec, + + /* update LED status via GPIO */ + static void cxt_update_gpio_led(struct hda_codec *codec, unsigned int mask, +- bool enabled) ++ bool led_on) + { + struct conexant_spec *spec = codec->spec; + unsigned int oldval = spec->gpio_led; + + if (spec->mute_led_polarity) +- enabled = !enabled; ++ led_on = !led_on; + +- if (enabled) +- spec->gpio_led &= ~mask; +- else ++ if (led_on) + spec->gpio_led |= mask; ++ else ++ spec->gpio_led &= ~mask; ++ codec_dbg(codec, "mask:%d enabled:%d gpio_led:%d\n", ++ mask, led_on, spec->gpio_led); + if (spec->gpio_led != oldval) + snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, + spec->gpio_led); +@@ -646,8 +648,8 @@ static void cxt_fixup_gpio_mute_hook(void *private_data, int enabled) + { + struct hda_codec *codec = private_data; + struct conexant_spec *spec = codec->spec; +- +- cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled); ++ /* muted -> LED on */ ++ cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, !enabled); + } + + /* turn on/off mic-mute LED via GPIO per capture hook */ +@@ -669,7 +671,6 @@ static void cxt_fixup_mute_led_gpio(struct hda_codec *codec, + { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03 }, + {} + }; +- codec_info(codec, "action: %d gpio_led: %d\n", action, spec->gpio_led); + + if (action == HDA_FIXUP_ACT_PRE_PROBE) { + spec->gen.vmaster_mute.hook = cxt_fixup_gpio_mute_hook; +diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c +index dafc3b7f8d72..62aa320c2070 100644 +--- a/sound/soc/soc-core.c ++++ b/sound/soc/soc-core.c +@@ -1513,11 +1513,8 @@ static int soc_probe_link_dais(struct snd_soc_card *card, + } + } + +- if (dai_link->dai_fmt) { +- ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt); +- if (ret) +- return ret; +- } ++ if (dai_link->dai_fmt) ++ snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt); + + ret = soc_post_component_init(rtd, dai_link->name); + if (ret) +diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c +index 78c2d6cab3b5..531564269444 100644 +--- a/sound/usb/line6/pcm.c ++++ b/sound/usb/line6/pcm.c +@@ -554,6 +554,15 @@ int line6_init_pcm(struct usb_line6 *line6, + line6pcm->volume_monitor = 255; + line6pcm->line6 = line6; + ++ spin_lock_init(&line6pcm->out.lock); ++ spin_lock_init(&line6pcm->in.lock); ++ line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD; ++ ++ line6->line6pcm = line6pcm; ++ ++ pcm->private_data = line6pcm; ++ pcm->private_free = line6_cleanup_pcm; ++ + line6pcm->max_packet_size_in = + usb_maxpacket(line6->usbdev, + usb_rcvisocpipe(line6->usbdev, ep_read), 0); +@@ -566,15 +575,6 @@ int line6_init_pcm(struct usb_line6 *line6, + return -EINVAL; + } + +- spin_lock_init(&line6pcm->out.lock); +- spin_lock_init(&line6pcm->in.lock); +- line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD; +- +- line6->line6pcm = line6pcm; +- +- pcm->private_data = line6pcm; +- pcm->private_free = line6_cleanup_pcm; +- + err = line6_create_audio_out_urbs(line6pcm); + if (err < 0) + return err; +diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c +index 4b3e1c48ca2f..b0c5d4ef6137 100644 +--- a/sound/usb/mixer.c ++++ b/sound/usb/mixer.c +@@ -754,7 +754,6 @@ static int uac_mixer_unit_get_channels(struct mixer_build *state, + struct uac_mixer_unit_descriptor *desc) + { + int mu_channels; +- void *c; + + if (desc->bLength < sizeof(*desc)) + return -EINVAL; +@@ -777,13 +776,6 @@ static int uac_mixer_unit_get_channels(struct mixer_build *state, + break; + } + +- if (!mu_channels) +- return 0; +- +- c = uac_mixer_unit_bmControls(desc, state->mixer->protocol); +- if (c - (void *)desc + (mu_channels - 1) / 8 >= desc->bLength) +- return 0; /* no bmControls -> skip */ +- + return mu_channels; + } + +@@ -2028,6 +2020,31 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, + * Mixer Unit + */ + ++/* check whether the given in/out overflows bmMixerControls matrix */ ++static bool mixer_bitmap_overflow(struct uac_mixer_unit_descriptor *desc, ++ int protocol, int num_ins, int num_outs) ++{ ++ u8 *hdr = (u8 *)desc; ++ u8 *c = uac_mixer_unit_bmControls(desc, protocol); ++ size_t rest; /* remaining bytes after bmMixerControls */ ++ ++ switch (protocol) { ++ case UAC_VERSION_1: ++ default: ++ rest = 1; /* iMixer */ ++ break; ++ case UAC_VERSION_2: ++ rest = 2; /* bmControls + iMixer */ ++ break; ++ case UAC_VERSION_3: ++ rest = 6; /* bmControls + wMixerDescrStr */ ++ break; ++ } ++ ++ /* overflow? */ ++ return c + (num_ins * num_outs + 7) / 8 + rest > hdr + hdr[0]; ++} ++ + /* + * build a mixer unit control + * +@@ -2156,6 +2173,9 @@ static int parse_audio_mixer_unit(struct mixer_build *state, int unitid, + if (err < 0) + return err; + num_ins += iterm.channels; ++ if (mixer_bitmap_overflow(desc, state->mixer->protocol, ++ num_ins, num_outs)) ++ break; + for (; ich < num_ins; ich++) { + int och, ich_has_controls = 0; + +diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c +index 5b342fe30c75..10c6971cf477 100644 +--- a/sound/usb/mixer_quirks.c ++++ b/sound/usb/mixer_quirks.c +@@ -1167,17 +1167,17 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip, + { + struct usb_mixer_interface *mixer; + struct usb_mixer_elem_info *cval; +- int unitid = 12; /* SamleRate ExtensionUnit ID */ ++ int unitid = 12; /* SampleRate ExtensionUnit ID */ + + list_for_each_entry(mixer, &chip->mixer_list, list) { +- cval = mixer_elem_list_to_info(mixer->id_elems[unitid]); +- if (cval) { ++ if (mixer->id_elems[unitid]) { ++ cval = mixer_elem_list_to_info(mixer->id_elems[unitid]); + snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR, + cval->control << 8, + samplerate_id); + snd_usb_mixer_notify_id(mixer, unitid); ++ break; + } +- break; + } + } + +diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c +index db114f3977e0..35c57a4204a8 100644 +--- a/sound/usb/pcm.c ++++ b/sound/usb/pcm.c +@@ -350,6 +350,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, + ep = 0x81; + ifnum = 2; + goto add_sync_ep_from_ifnum; ++ case USB_ID(0x1397, 0x0001): /* Behringer UFX1604 */ + case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */ + ep = 0x81; + ifnum = 1; +diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c +index d7e06fe0270e..0ce50c319cfd 100644 +--- a/tools/hv/hv_kvp_daemon.c ++++ b/tools/hv/hv_kvp_daemon.c +@@ -1386,6 +1386,8 @@ int main(int argc, char *argv[]) + daemonize = 0; + break; + case 'h': ++ print_usage(argv); ++ exit(0); + default: + print_usage(argv); + exit(EXIT_FAILURE); +diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c +index b13300172762..c2bb8a360177 100644 +--- a/tools/hv/hv_vss_daemon.c ++++ b/tools/hv/hv_vss_daemon.c +@@ -229,6 +229,8 @@ int main(int argc, char *argv[]) + daemonize = 0; + break; + case 'h': ++ print_usage(argv); ++ exit(0); + default: + print_usage(argv); + exit(EXIT_FAILURE); +diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus +index 55e7374bade0..099f2c44dbed 100644 +--- a/tools/hv/lsvmbus ++++ b/tools/hv/lsvmbus +@@ -4,10 +4,10 @@ + import os + from optparse import OptionParser + ++help_msg = "print verbose messages. Try -vv, -vvv for more verbose messages" + parser = OptionParser() +-parser.add_option("-v", "--verbose", dest="verbose", +- help="print verbose messages. Try -vv, -vvv for \ +- more verbose messages", action="count") ++parser.add_option( ++ "-v", "--verbose", dest="verbose", help=help_msg, action="count") + + (options, args) = parser.parse_args() + +@@ -21,27 +21,28 @@ if not os.path.isdir(vmbus_sys_path): + exit(-1) + + vmbus_dev_dict = { +- '{0e0b6031-5213-4934-818b-38d90ced39db}' : '[Operating system shutdown]', +- '{9527e630-d0ae-497b-adce-e80ab0175caf}' : '[Time Synchronization]', +- '{57164f39-9115-4e78-ab55-382f3bd5422d}' : '[Heartbeat]', +- '{a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}' : '[Data Exchange]', +- '{35fa2e29-ea23-4236-96ae-3a6ebacba440}' : '[Backup (volume checkpoint)]', +- '{34d14be3-dee4-41c8-9ae7-6b174977c192}' : '[Guest services]', +- '{525074dc-8985-46e2-8057-a307dc18a502}' : '[Dynamic Memory]', +- '{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}' : 'Synthetic mouse', +- '{f912ad6d-2b17-48ea-bd65-f927a61c7684}' : 'Synthetic keyboard', +- '{da0a7802-e377-4aac-8e77-0558eb1073f8}' : 'Synthetic framebuffer adapter', +- '{f8615163-df3e-46c5-913f-f2d2f965ed0e}' : 'Synthetic network adapter', +- '{32412632-86cb-44a2-9b5c-50d1417354f5}' : 'Synthetic IDE Controller', +- '{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}' : 'Synthetic SCSI Controller', +- '{2f9bcc4a-0069-4af3-b76b-6fd0be528cda}' : 'Synthetic fiber channel adapter', +- '{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}' : 'Synthetic RDMA adapter', +- '{44c4f61d-4444-4400-9d52-802e27ede19f}' : 'PCI Express pass-through', +- '{276aacf4-ac15-426c-98dd-7521ad3f01fe}' : '[Reserved system device]', +- '{f8e65716-3cb3-4a06-9a60-1889c5cccab5}' : '[Reserved system device]', +- '{3375baf4-9e15-4b30-b765-67acb10d607b}' : '[Reserved system device]', ++ '{0e0b6031-5213-4934-818b-38d90ced39db}': '[Operating system shutdown]', ++ '{9527e630-d0ae-497b-adce-e80ab0175caf}': '[Time Synchronization]', ++ '{57164f39-9115-4e78-ab55-382f3bd5422d}': '[Heartbeat]', ++ '{a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}': '[Data Exchange]', ++ '{35fa2e29-ea23-4236-96ae-3a6ebacba440}': '[Backup (volume checkpoint)]', ++ '{34d14be3-dee4-41c8-9ae7-6b174977c192}': '[Guest services]', ++ '{525074dc-8985-46e2-8057-a307dc18a502}': '[Dynamic Memory]', ++ '{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}': 'Synthetic mouse', ++ '{f912ad6d-2b17-48ea-bd65-f927a61c7684}': 'Synthetic keyboard', ++ '{da0a7802-e377-4aac-8e77-0558eb1073f8}': 'Synthetic framebuffer adapter', ++ '{f8615163-df3e-46c5-913f-f2d2f965ed0e}': 'Synthetic network adapter', ++ '{32412632-86cb-44a2-9b5c-50d1417354f5}': 'Synthetic IDE Controller', ++ '{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}': 'Synthetic SCSI Controller', ++ '{2f9bcc4a-0069-4af3-b76b-6fd0be528cda}': 'Synthetic fiber channel adapter', ++ '{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}': 'Synthetic RDMA adapter', ++ '{44c4f61d-4444-4400-9d52-802e27ede19f}': 'PCI Express pass-through', ++ '{276aacf4-ac15-426c-98dd-7521ad3f01fe}': '[Reserved system device]', ++ '{f8e65716-3cb3-4a06-9a60-1889c5cccab5}': '[Reserved system device]', ++ '{3375baf4-9e15-4b30-b765-67acb10d607b}': '[Reserved system device]', + } + ++ + def get_vmbus_dev_attr(dev_name, attr): + try: + f = open('%s/%s/%s' % (vmbus_sys_path, dev_name, attr), 'r') +@@ -52,6 +53,7 @@ def get_vmbus_dev_attr(dev_name, attr): + + return lines + ++ + class VMBus_Dev: + pass + +@@ -66,12 +68,13 @@ for f in os.listdir(vmbus_sys_path): + + chn_vp_mapping = get_vmbus_dev_attr(f, 'channel_vp_mapping') + chn_vp_mapping = [c.strip() for c in chn_vp_mapping] +- chn_vp_mapping = sorted(chn_vp_mapping, +- key = lambda c : int(c.split(':')[0])) ++ chn_vp_mapping = sorted( ++ chn_vp_mapping, key=lambda c: int(c.split(':')[0])) + +- chn_vp_mapping = ['\tRel_ID=%s, target_cpu=%s' % +- (c.split(':')[0], c.split(':')[1]) +- for c in chn_vp_mapping] ++ chn_vp_mapping = [ ++ '\tRel_ID=%s, target_cpu=%s' % ++ (c.split(':')[0], c.split(':')[1]) for c in chn_vp_mapping ++ ] + d = VMBus_Dev() + d.sysfs_path = '%s/%s' % (vmbus_sys_path, f) + d.vmbus_id = vmbus_id +@@ -85,7 +88,7 @@ for f in os.listdir(vmbus_sys_path): + vmbus_dev_list.append(d) + + +-vmbus_dev_list = sorted(vmbus_dev_list, key = lambda d : int(d.vmbus_id)) ++vmbus_dev_list = sorted(vmbus_dev_list, key=lambda d: int(d.vmbus_id)) + + format0 = '%2s: %s' + format1 = '%2s: Class_ID = %s - %s\n%s' +@@ -95,9 +98,15 @@ for d in vmbus_dev_list: + if verbose == 0: + print(('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc)) + elif verbose == 1: +- print (('VMBUS ID ' + format1) % \ +- (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping)) ++ print( ++ ('VMBUS ID ' + format1) % ++ (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping) ++ ) + else: +- print (('VMBUS ID ' + format2) % \ +- (d.vmbus_id, d.class_id, d.dev_desc, \ +- d.device_id, d.sysfs_path, d.chn_vp_mapping)) ++ print( ++ ('VMBUS ID ' + format2) % ++ ( ++ d.vmbus_id, d.class_id, d.dev_desc, ++ d.device_id, d.sysfs_path, d.chn_vp_mapping ++ ) ++ ) +diff --git a/virt/kvm/arm/vgic/vgic-mmio.c b/virt/kvm/arm/vgic/vgic-mmio.c +index ceeda7e04a4d..762f81900529 100644 +--- a/virt/kvm/arm/vgic/vgic-mmio.c ++++ b/virt/kvm/arm/vgic/vgic-mmio.c +@@ -203,6 +203,12 @@ static void vgic_hw_irq_spending(struct kvm_vcpu *vcpu, struct vgic_irq *irq, + vgic_irq_set_phys_active(irq, true); + } + ++static bool is_vgic_v2_sgi(struct kvm_vcpu *vcpu, struct vgic_irq *irq) ++{ ++ return (vgic_irq_is_sgi(irq->intid) && ++ vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V2); ++} ++ + void vgic_mmio_write_spending(struct kvm_vcpu *vcpu, + gpa_t addr, unsigned int len, + unsigned long val) +@@ -215,6 +221,12 @@ void vgic_mmio_write_spending(struct kvm_vcpu *vcpu, + for_each_set_bit(i, &val, len * 8) { + struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); + ++ /* GICD_ISPENDR0 SGI bits are WI */ ++ if (is_vgic_v2_sgi(vcpu, irq)) { ++ vgic_put_irq(vcpu->kvm, irq); ++ continue; ++ } ++ + spin_lock_irqsave(&irq->irq_lock, flags); + if (irq->hw) + vgic_hw_irq_spending(vcpu, irq, is_uaccess); +@@ -262,6 +274,12 @@ void vgic_mmio_write_cpending(struct kvm_vcpu *vcpu, + for_each_set_bit(i, &val, len * 8) { + struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); + ++ /* GICD_ICPENDR0 SGI bits are WI */ ++ if (is_vgic_v2_sgi(vcpu, irq)) { ++ vgic_put_irq(vcpu->kvm, irq); ++ continue; ++ } ++ + spin_lock_irqsave(&irq->irq_lock, flags); + + if (irq->hw) +diff --git a/virt/kvm/arm/vgic/vgic-v2.c b/virt/kvm/arm/vgic/vgic-v2.c +index 57281c1594d0..91b14dfacd1d 100644 +--- a/virt/kvm/arm/vgic/vgic-v2.c ++++ b/virt/kvm/arm/vgic/vgic-v2.c +@@ -195,7 +195,10 @@ void vgic_v2_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr) + if (vgic_irq_is_sgi(irq->intid)) { + u32 src = ffs(irq->source); + +- BUG_ON(!src); ++ if (WARN_RATELIMIT(!src, "No SGI source for INTID %d\n", ++ irq->intid)) ++ return; ++ + val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT; + irq->source &= ~(1 << (src - 1)); + if (irq->source) { +diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c +index 5c55995a1a16..8b958ed05306 100644 +--- a/virt/kvm/arm/vgic/vgic-v3.c ++++ b/virt/kvm/arm/vgic/vgic-v3.c +@@ -179,7 +179,10 @@ void vgic_v3_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr) + model == KVM_DEV_TYPE_ARM_VGIC_V2) { + u32 src = ffs(irq->source); + +- BUG_ON(!src); ++ if (WARN_RATELIMIT(!src, "No SGI source for INTID %d\n", ++ irq->intid)) ++ return; ++ + val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT; + irq->source &= ~(1 << (src - 1)); + if (irq->source) { +diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c +index 250cd72c95a5..4040a33cdc90 100644 +--- a/virt/kvm/arm/vgic/vgic.c ++++ b/virt/kvm/arm/vgic/vgic.c +@@ -244,6 +244,13 @@ static int vgic_irq_cmp(void *priv, struct list_head *a, struct list_head *b) + bool penda, pendb; + int ret; + ++ /* ++ * list_sort may call this function with the same element when ++ * the list is fairly long. ++ */ ++ if (unlikely(irqa == irqb)) ++ return 0; ++ + spin_lock(&irqa->irq_lock); + spin_lock_nested(&irqb->irq_lock, SINGLE_DEPTH_NESTING); + diff --git a/1070_linux-4.19.71.patch b/1070_linux-4.19.71.patch new file mode 100644 index 00000000..3bb5f040 --- /dev/null +++ b/1070_linux-4.19.71.patch @@ -0,0 +1,92 @@ +diff --git a/Makefile b/Makefile +index ecf8806cb71f..f6c9d5757470 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 4 + PATCHLEVEL = 19 +-SUBLEVEL = 70 ++SUBLEVEL = 71 + EXTRAVERSION = + NAME = "People's Front" + +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c +index eb9b9de47fd1..530142b5a115 100644 +--- a/drivers/input/mouse/elantech.c ++++ b/drivers/input/mouse/elantech.c +@@ -1810,30 +1810,6 @@ static int elantech_create_smbus(struct psmouse *psmouse, + leave_breadcrumbs); + } + +-static bool elantech_use_host_notify(struct psmouse *psmouse, +- struct elantech_device_info *info) +-{ +- if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) +- return true; +- +- switch (info->bus) { +- case ETP_BUS_PS2_ONLY: +- /* expected case */ +- break; +- case ETP_BUS_SMB_HST_NTFY_ONLY: +- case ETP_BUS_PS2_SMB_HST_NTFY: +- /* SMbus implementation is stable since 2018 */ +- if (dmi_get_bios_year() >= 2018) +- return true; +- default: +- psmouse_dbg(psmouse, +- "Ignoring SMBus bus provider %d\n", info->bus); +- break; +- } +- +- return false; +-} +- + /** + * elantech_setup_smbus - called once the PS/2 devices are enumerated + * and decides to instantiate a SMBus InterTouch device. +@@ -1853,7 +1829,7 @@ static int elantech_setup_smbus(struct psmouse *psmouse, + * i2c_blacklist_pnp_ids. + * Old ICs are up to the user to decide. + */ +- if (!elantech_use_host_notify(psmouse, info) || ++ if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) || + psmouse_matches_pnp_id(psmouse, i2c_blacklist_pnp_ids)) + return -ENXIO; + } +@@ -1873,6 +1849,34 @@ static int elantech_setup_smbus(struct psmouse *psmouse, + return 0; + } + ++static bool elantech_use_host_notify(struct psmouse *psmouse, ++ struct elantech_device_info *info) ++{ ++ if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) ++ return true; ++ ++ switch (info->bus) { ++ case ETP_BUS_PS2_ONLY: ++ /* expected case */ ++ break; ++ case ETP_BUS_SMB_ALERT_ONLY: ++ /* fall-through */ ++ case ETP_BUS_PS2_SMB_ALERT: ++ psmouse_dbg(psmouse, "Ignoring SMBus provider through alert protocol.\n"); ++ break; ++ case ETP_BUS_SMB_HST_NTFY_ONLY: ++ /* fall-through */ ++ case ETP_BUS_PS2_SMB_HST_NTFY: ++ return true; ++ default: ++ psmouse_dbg(psmouse, ++ "Ignoring SMBus bus provider %d.\n", ++ info->bus); ++ } ++ ++ return false; ++} ++ + int elantech_init_smbus(struct psmouse *psmouse) + { + struct elantech_device_info info; |