]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 Aug 2019 15:46:13 +0000 (17:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 Aug 2019 15:46:13 +0000 (17:46 +0200)
added patches:
genirq-properly-pair-kobject_del-with-kobject_add.patch

queue-4.9/genirq-properly-pair-kobject_del-with-kobject_add.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/genirq-properly-pair-kobject_del-with-kobject_add.patch b/queue-4.9/genirq-properly-pair-kobject_del-with-kobject_add.patch
new file mode 100644 (file)
index 0000000..efa7e6b
--- /dev/null
@@ -0,0 +1,73 @@
+From d0ff14fdc987303aeeb7de6f1bd72c3749ae2a9b Mon Sep 17 00:00:00 2001
+From: Michael Kelley <mikelley@microsoft.com>
+Date: Thu, 1 Aug 2019 23:53:53 +0000
+Subject: genirq: Properly pair kobject_del() with kobject_add()
+
+From: Michael Kelley <mikelley@microsoft.com>
+
+commit d0ff14fdc987303aeeb7de6f1bd72c3749ae2a9b upstream.
+
+If alloc_descs() fails before irq_sysfs_init() has run, free_desc() in the
+cleanup path will call kobject_del() even though the kobject has not been
+added with kobject_add().
+
+Fix this by making the call to kobject_del() conditional on whether
+irq_sysfs_init() has run.
+
+This problem surfaced because commit aa30f47cf666 ("kobject: Add support
+for default attribute groups to kobj_type") makes kobject_del() stricter
+about pairing with kobject_add(). If the pairing is incorrrect, a WARNING
+and backtrace occur in sysfs_remove_group() because there is no parent.
+
+[ tglx: Add a comment to the code and make it work with CONFIG_SYSFS=n ]
+
+Fixes: ecb3f394c5db ("genirq: Expose interrupt information through sysfs")
+Signed-off-by: Michael Kelley <mikelley@microsoft.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/1564703564-4116-1-git-send-email-mikelley@microsoft.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/irq/irqdesc.c |   15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+--- a/kernel/irq/irqdesc.c
++++ b/kernel/irq/irqdesc.c
+@@ -267,6 +267,18 @@ static void irq_sysfs_add(int irq, struc
+       }
+ }
++static void irq_sysfs_del(struct irq_desc *desc)
++{
++      /*
++       * If irq_sysfs_init() has not yet been invoked (early boot), then
++       * irq_kobj_base is NULL and the descriptor was never added.
++       * kobject_del() complains about a object with no parent, so make
++       * it conditional.
++       */
++      if (irq_kobj_base)
++              kobject_del(&desc->kobj);
++}
++
+ static int __init irq_sysfs_init(void)
+ {
+       struct irq_desc *desc;
+@@ -297,6 +309,7 @@ static struct kobj_type irq_kobj_type =
+ };
+ static void irq_sysfs_add(int irq, struct irq_desc *desc) {}
++static void irq_sysfs_del(struct irq_desc *desc) {}
+ #endif /* CONFIG_SYSFS */
+@@ -406,7 +419,7 @@ static void free_desc(unsigned int irq)
+        * The sysfs entry must be serialized against a concurrent
+        * irq_sysfs_init() as well.
+        */
+-      kobject_del(&desc->kobj);
++      irq_sysfs_del(desc);
+       delete_irq_desc(irq);
+       /*
index f255051b5e9e919bb44335995437dfed79f20d12..b03461799ee7d39438a75a652dda81b73db6181c 100644 (file)
@@ -37,3 +37,4 @@ x86-boot-fix-boot-regression-caused-by-bootparam-sanitizing.patch
 dm-btree-fix-order-of-block-initialization-in-btree_split_beneath.patch
 dm-space-map-metadata-fix-missing-store-of-apply_bops-return-value.patch
 dm-table-fix-invalid-memory-accesses-with-too-high-sector-number.patch
+genirq-properly-pair-kobject_del-with-kobject_add.patch