From 0129e9142f98e696042e647826bf9fb828f95784 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 30 Mar 2018 10:58:04 +0200 Subject: [PATCH] 3.18-stable patches added patches: revert-genirq-use-irqd_get_trigger_type-to-compare-the.patch --- ...hether-the-trigger-type-has-been-set.patch | 105 ------------------ ...irqd_get_trigger_type-to-compare-the.patch | 37 ++++++ queue-3.18/series | 2 +- 3 files changed, 38 insertions(+), 106 deletions(-) delete mode 100644 queue-3.18/genirq-track-whether-the-trigger-type-has-been-set.patch create mode 100644 queue-3.18/revert-genirq-use-irqd_get_trigger_type-to-compare-the.patch diff --git a/queue-3.18/genirq-track-whether-the-trigger-type-has-been-set.patch b/queue-3.18/genirq-track-whether-the-trigger-type-has-been-set.patch deleted file mode 100644 index fe8cba7fd7a..00000000000 --- a/queue-3.18/genirq-track-whether-the-trigger-type-has-been-set.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 4f8413a3a799c958f7a10a6310a451e6b8aef5ad Mon Sep 17 00:00:00 2001 -From: Marc Zyngier -Date: Thu, 9 Nov 2017 14:17:59 +0000 -Subject: genirq: Track whether the trigger type has been set - -From: Marc Zyngier - -commit 4f8413a3a799c958f7a10a6310a451e6b8aef5ad upstream. - -When requesting a shared interrupt, we assume that the firmware -support code (DT or ACPI) has called irqd_set_trigger_type -already, so that we can retrieve it and check that the requester -is being reasonnable. - -Unfortunately, we still have non-DT, non-ACPI systems around, -and these guys won't call irqd_set_trigger_type before requesting -the interrupt. The consequence is that we fail the request that -would have worked before. - -We can either chase all these use cases (boring), or address it -in core code (easier). Let's have a per-irq_desc flag that -indicates whether irqd_set_trigger_type has been called, and -let's just check it when checking for a shared interrupt. -If it hasn't been set, just take whatever the interrupt -requester asks. - -Fixes: 382bd4de6182 ("genirq: Use irqd_get_trigger_type to compare the trigger type for shared IRQs") -Cc: stable@vger.kernel.org -Reported-and-tested-by: Petr Cvek -Signed-off-by: Marc Zyngier -Cc: Guenter Roeck -Signed-off-by: Greg Kroah-Hartman - ---- - include/linux/irq.h | 11 ++++++++++- - kernel/irq/manage.c | 13 ++++++++++++- - 2 files changed, 22 insertions(+), 2 deletions(-) - ---- a/include/linux/irq.h -+++ b/include/linux/irq.h -@@ -175,6 +175,7 @@ struct irq_data { - * IRQD_IRQ_MASKED - Masked state of the interrupt - * IRQD_IRQ_INPROGRESS - In progress state of the interrupt - * IRQD_WAKEUP_ARMED - Wakeup mode armed -+ * IRQD_DEFAULT_TRIGGER_SET - Expected trigger already been set - */ - enum { - IRQD_TRIGGER_MASK = 0xf, -@@ -189,6 +190,7 @@ enum { - IRQD_IRQ_MASKED = (1 << 17), - IRQD_IRQ_INPROGRESS = (1 << 18), - IRQD_WAKEUP_ARMED = (1 << 19), -+ IRQD_DEFAULT_TRIGGER_SET = (1 << 25), - }; - - static inline bool irqd_is_setaffinity_pending(struct irq_data *d) -@@ -216,18 +218,25 @@ static inline void irqd_mark_affinity_wa - d->state_use_accessors |= IRQD_AFFINITY_SET; - } - -+static inline bool irqd_trigger_type_was_set(struct irq_data *d) -+{ -+ return d->state_use_accessors & IRQD_DEFAULT_TRIGGER_SET; -+} -+ - static inline u32 irqd_get_trigger_type(struct irq_data *d) - { - return d->state_use_accessors & IRQD_TRIGGER_MASK; - } - - /* -- * Must only be called inside irq_chip.irq_set_type() functions. -+ * Must only be called inside irq_chip.irq_set_type() functions or -+ * from the DT/ACPI setup code. - */ - static inline void irqd_set_trigger_type(struct irq_data *d, u32 type) - { - d->state_use_accessors &= ~IRQD_TRIGGER_MASK; - d->state_use_accessors |= type & IRQD_TRIGGER_MASK; -+ d->state_use_accessors |= IRQD_DEFAULT_TRIGGER_SET; - } - - static inline bool irqd_is_level_type(struct irq_data *d) ---- a/kernel/irq/manage.c -+++ b/kernel/irq/manage.c -@@ -1058,7 +1058,18 @@ __setup_irq(unsigned int irq, struct irq - * set the trigger type must match. Also all must - * agree on ONESHOT. - */ -- unsigned int oldtype = irqd_get_trigger_type(&desc->irq_data); -+ unsigned int oldtype; -+ -+ /* -+ * If nobody did set the configuration before, inherit -+ * the one provided by the requester. -+ */ -+ if (irqd_trigger_type_was_set(&desc->irq_data)) { -+ oldtype = irqd_get_trigger_type(&desc->irq_data); -+ } else { -+ oldtype = new->flags & IRQF_TRIGGER_MASK; -+ irqd_set_trigger_type(&desc->irq_data, oldtype); -+ } - - if (!((old->flags & new->flags) & IRQF_SHARED) || - (oldtype != (new->flags & IRQF_TRIGGER_MASK)) || diff --git a/queue-3.18/revert-genirq-use-irqd_get_trigger_type-to-compare-the.patch b/queue-3.18/revert-genirq-use-irqd_get_trigger_type-to-compare-the.patch new file mode 100644 index 00000000000..52c3490fb69 --- /dev/null +++ b/queue-3.18/revert-genirq-use-irqd_get_trigger_type-to-compare-the.patch @@ -0,0 +1,37 @@ +From 6ac05ec9c1bdefb8a88aefd4681869814b3f6c73 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Fri, 30 Mar 2018 10:56:51 +0200 +Subject: [PATCH] Revert "genirq: Use irqd_get_trigger_type to compare the + trigger type for shared IRQs" + +This reverts commit 093c265afffb0a91a7611c3bb74d0883731a807b which is +commit 382bd4de61827dbaaf5fb4fb7b1f4be4a86505e7 upstream. + +It causes too many problems with the stable tree, and would require too +many other things to be backported, so just revert it. + +Reported-by: Guenter Roeck +Cc: Thomas Gleixner +Cc: Hans de Goede +Cc: Marc Zyngier +Cc: Thomas Gleixner +Cc: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + kernel/irq/manage.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/kernel/irq/manage.c ++++ b/kernel/irq/manage.c +@@ -1058,10 +1058,8 @@ __setup_irq(unsigned int irq, struct irq + * set the trigger type must match. Also all must + * agree on ONESHOT. + */ +- unsigned int oldtype = irqd_get_trigger_type(&desc->irq_data); +- + if (!((old->flags & new->flags) & IRQF_SHARED) || +- (oldtype != (new->flags & IRQF_TRIGGER_MASK)) || ++ ((old->flags ^ new->flags) & IRQF_TRIGGER_MASK) || + ((old->flags ^ new->flags) & IRQF_ONESHOT)) + goto mismatch; + diff --git a/queue-3.18/series b/queue-3.18/series index 0b119ced542..be12f825682 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -19,7 +19,7 @@ can-cc770-fix-use-after-free-in-cc770_tx_interrupt.patch tty-vt-fix-up-tabstops-properly.patch kvm-x86-fix-icebp-instruction-handling.patch scsi-sg-don-t-return-bogus-sg_requests.patch -genirq-track-whether-the-trigger-type-has-been-set.patch +revert-genirq-use-irqd_get_trigger_type-to-compare-the.patch dccp-check-sk-for-closed-state-in-dccp_sendmsg.patch ipv6-fix-access-to-non-linear-packet-in-ndisc_fill_redirect_hdr_option.patch l2tp-do-not-accept-arbitrary-sockets.patch -- 2.47.2