From: Sasha Levin Date: Thu, 23 Jul 2020 00:03:37 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v4.14.190~56 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d9f6633c21a7463b8e286ad6487075fdd0b1ccbe;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/fuse-fix-weird-page-warning.patch b/queue-4.19/fuse-fix-weird-page-warning.patch new file mode 100644 index 00000000000..9c28e05f8c9 --- /dev/null +++ b/queue-4.19/fuse-fix-weird-page-warning.patch @@ -0,0 +1,41 @@ +From 522a7ea7cd55821956ac7b95319906a9747f0d1c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jul 2020 15:54:59 -0300 +Subject: fuse: fix weird page warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Miklos Szeredi + +commit a5005c3cda6eeb6b95645e6cc32f58dafeffc976 upstream. + +When PageWaiters was added, updating this check was missed. + +Reported-by: Nikolaus Rath +Reported-by: Hugh Dickins +Fixes: 62906027091f ("mm: add PageWaiters indicating tasks are waiting for a page bit") +Signed-off-by: Miklos Szeredi +Signed-off-by: André Almeida +Signed-off-by: Sasha Levin +--- + fs/fuse/dev.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c +index 6d39143cfa094..01e6ea11822bf 100644 +--- a/fs/fuse/dev.c ++++ b/fs/fuse/dev.c +@@ -838,7 +838,8 @@ static int fuse_check_page(struct page *page) + 1 << PG_uptodate | + 1 << PG_lru | + 1 << PG_active | +- 1 << PG_reclaim))) { ++ 1 << PG_reclaim | ++ 1 << PG_waiters))) { + printk(KERN_WARNING "fuse: trying to steal weird page\n"); + printk(KERN_WARNING " page=%p index=%li flags=%08lx, count=%i, mapcount=%i, mapping=%p\n", page, page->index, page->flags, page_count(page), page_mapcount(page), page->mapping); + return 1; +-- +2.25.1 + diff --git a/queue-4.19/irqdomain-treewide-keep-firmware-node-unconditionall.patch b/queue-4.19/irqdomain-treewide-keep-firmware-node-unconditionall.patch new file mode 100644 index 00000000000..02687486aa0 --- /dev/null +++ b/queue-4.19/irqdomain-treewide-keep-firmware-node-unconditionall.patch @@ -0,0 +1,194 @@ +From 9ceb5528188910050e5510668e5326c9280c0327 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jul 2020 11:53:06 +0200 +Subject: irqdomain/treewide: Keep firmware node unconditionally allocated + +From: Thomas Gleixner + +[ Upstream commit e3beca48a45b5e0e6e6a4e0124276b8248dcc9bb ] + +Quite some non OF/ACPI users of irqdomains allocate firmware nodes of type +IRQCHIP_FWNODE_NAMED or IRQCHIP_FWNODE_NAMED_ID and free them right after +creating the irqdomain. The only purpose of these FW nodes is to convey +name information. When this was introduced the core code did not store the +pointer to the node in the irqdomain. A recent change stored the firmware +node pointer in irqdomain for other reasons and missed to notice that the +usage sites which do the alloc_fwnode/create_domain/free_fwnode sequence +are broken by this. Storing a dangling pointer is dangerous itself, but in +case that the domain is destroyed later on this leads to a double free. + +Remove the freeing of the firmware node after creating the irqdomain from +all affected call sites to cure this. + +Fixes: 711419e504eb ("irqdomain: Add the missing assignment of domain->fwnode for named fwnode") +Reported-by: Andy Shevchenko +Signed-off-by: Thomas Gleixner +Acked-by: Bjorn Helgaas +Acked-by: Marc Zyngier +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/873661qakd.fsf@nanos.tec.linutronix.de +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/apic/io_apic.c | 10 +++++----- + arch/x86/kernel/apic/msi.c | 18 ++++++++++++------ + arch/x86/kernel/apic/vector.c | 1 - + arch/x86/platform/uv/uv_irq.c | 3 ++- + drivers/iommu/amd_iommu.c | 5 +++-- + drivers/iommu/intel_irq_remapping.c | 2 +- + drivers/pci/controller/vmd.c | 5 +++-- + 7 files changed, 26 insertions(+), 18 deletions(-) + +diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c +index fa3b85b222e31..08e2f3a5f1242 100644 +--- a/arch/x86/kernel/apic/io_apic.c ++++ b/arch/x86/kernel/apic/io_apic.c +@@ -2323,12 +2323,12 @@ static int mp_irqdomain_create(int ioapic) + ip->irqdomain = irq_domain_create_linear(fn, hwirqs, cfg->ops, + (void *)(long)ioapic); + +- /* Release fw handle if it was allocated above */ +- if (!cfg->dev) +- irq_domain_free_fwnode(fn); +- +- if (!ip->irqdomain) ++ if (!ip->irqdomain) { ++ /* Release fw handle if it was allocated above */ ++ if (!cfg->dev) ++ irq_domain_free_fwnode(fn); + return -ENOMEM; ++ } + + ip->irqdomain->parent = parent; + +diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c +index 1f5df339e48ff..fb26c956c4421 100644 +--- a/arch/x86/kernel/apic/msi.c ++++ b/arch/x86/kernel/apic/msi.c +@@ -265,12 +265,13 @@ void __init arch_init_msi_domain(struct irq_domain *parent) + msi_default_domain = + pci_msi_create_irq_domain(fn, &pci_msi_domain_info, + parent); +- irq_domain_free_fwnode(fn); + } +- if (!msi_default_domain) ++ if (!msi_default_domain) { ++ irq_domain_free_fwnode(fn); + pr_warn("failed to initialize irqdomain for MSI/MSI-x.\n"); +- else ++ } else { + msi_default_domain->flags |= IRQ_DOMAIN_MSI_NOMASK_QUIRK; ++ } + } + + #ifdef CONFIG_IRQ_REMAP +@@ -303,7 +304,8 @@ struct irq_domain *arch_create_remap_msi_irq_domain(struct irq_domain *parent, + if (!fn) + return NULL; + d = pci_msi_create_irq_domain(fn, &pci_msi_ir_domain_info, parent); +- irq_domain_free_fwnode(fn); ++ if (!d) ++ irq_domain_free_fwnode(fn); + return d; + } + #endif +@@ -366,7 +368,8 @@ static struct irq_domain *dmar_get_irq_domain(void) + if (fn) { + dmar_domain = msi_create_irq_domain(fn, &dmar_msi_domain_info, + x86_vector_domain); +- irq_domain_free_fwnode(fn); ++ if (!dmar_domain) ++ irq_domain_free_fwnode(fn); + } + out: + mutex_unlock(&dmar_lock); +@@ -491,7 +494,10 @@ struct irq_domain *hpet_create_irq_domain(int hpet_id) + } + + d = msi_create_irq_domain(fn, domain_info, parent); +- irq_domain_free_fwnode(fn); ++ if (!d) { ++ irq_domain_free_fwnode(fn); ++ kfree(domain_info); ++ } + return d; + } + +diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c +index e41be2c25da81..99c28c02b7a54 100644 +--- a/arch/x86/kernel/apic/vector.c ++++ b/arch/x86/kernel/apic/vector.c +@@ -703,7 +703,6 @@ int __init arch_early_irq_init(void) + x86_vector_domain = irq_domain_create_tree(fn, &x86_vector_domain_ops, + NULL); + BUG_ON(x86_vector_domain == NULL); +- irq_domain_free_fwnode(fn); + irq_set_default_host(x86_vector_domain); + + arch_init_msi_domain(x86_vector_domain); +diff --git a/arch/x86/platform/uv/uv_irq.c b/arch/x86/platform/uv/uv_irq.c +index fc13cbbb2dce2..abb6075397f05 100644 +--- a/arch/x86/platform/uv/uv_irq.c ++++ b/arch/x86/platform/uv/uv_irq.c +@@ -167,9 +167,10 @@ static struct irq_domain *uv_get_irq_domain(void) + goto out; + + uv_domain = irq_domain_create_tree(fn, &uv_domain_ops, NULL); +- irq_domain_free_fwnode(fn); + if (uv_domain) + uv_domain->parent = x86_vector_domain; ++ else ++ irq_domain_free_fwnode(fn); + out: + mutex_unlock(&uv_lock); + +diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c +index 0783f44e9afe5..d0cbe910ee9db 100644 +--- a/drivers/iommu/amd_iommu.c ++++ b/drivers/iommu/amd_iommu.c +@@ -4508,9 +4508,10 @@ int amd_iommu_create_irq_domain(struct amd_iommu *iommu) + if (!fn) + return -ENOMEM; + iommu->ir_domain = irq_domain_create_tree(fn, &amd_ir_domain_ops, iommu); +- irq_domain_free_fwnode(fn); +- if (!iommu->ir_domain) ++ if (!iommu->ir_domain) { ++ irq_domain_free_fwnode(fn); + return -ENOMEM; ++ } + + iommu->ir_domain->parent = arch_get_ir_parent_domain(); + iommu->msi_domain = arch_create_remap_msi_irq_domain(iommu->ir_domain, +diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c +index 967450bd421a1..852e2841395b4 100644 +--- a/drivers/iommu/intel_irq_remapping.c ++++ b/drivers/iommu/intel_irq_remapping.c +@@ -536,8 +536,8 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) + 0, INTR_REMAP_TABLE_ENTRIES, + fn, &intel_ir_domain_ops, + iommu); +- irq_domain_free_fwnode(fn); + if (!iommu->ir_domain) { ++ irq_domain_free_fwnode(fn); + pr_err("IR%d: failed to allocate irqdomain\n", iommu->seq_id); + goto out_free_bitmap; + } +diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c +index c3ac7f094a394..ad39b404f10a4 100644 +--- a/drivers/pci/controller/vmd.c ++++ b/drivers/pci/controller/vmd.c +@@ -704,9 +704,10 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) + + vmd->irq_domain = pci_msi_create_irq_domain(fn, &vmd_msi_domain_info, + x86_vector_domain); +- irq_domain_free_fwnode(fn); +- if (!vmd->irq_domain) ++ if (!vmd->irq_domain) { ++ irq_domain_free_fwnode(fn); + return -ENODEV; ++ } + + pci_add_resource(&resources, &vmd->resources[0]); + pci_add_resource_offset(&resources, &vmd->resources[1], offset[0]); +-- +2.25.1 + diff --git a/queue-4.19/series b/queue-4.19/series index 21ace1cd012..285528cebb4 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -9,3 +9,5 @@ drivers-net-wan-lapbether-fixed-the-value-of-hard_he.patch net-sky2-initialize-return-of-gm_phy_read.patch drm-nouveau-i2c-g94-increase-nv_pmgr_dp_auxctl_trans.patch drivers-firmware-psci-fix-memory-leakage-in-alloc_in.patch +fuse-fix-weird-page-warning.patch +irqdomain-treewide-keep-firmware-node-unconditionall.patch