Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1581195 > unrolled thread

[patch 0/2] goldfish: Prevent the trainwreck from doing harm

Started byThomas Gleixner <tglx@linutronix.de>
First post2017-02-15 11:30 +0100
Last post2017-02-15 18:00 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [patch 0/2] goldfish: Prevent the trainwreck from doing harm Thomas Gleixner <tglx@linutronix.de> - 2017-02-15 11:30 +0100
    [patch 2/2] goldfish: Sanitize the broken interrupt handler Thomas Gleixner <tglx@linutronix.de> - 2017-02-15 11:30 +0100
    Re: [patch 0/2] goldfish: Prevent the trainwreck from doing harm Linus Torvalds <torvalds@linux-foundation.org> - 2017-02-15 16:50 +0100
      Re: [patch 0/2] goldfish: Prevent the trainwreck from doing harm Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-15 18:00 +0100

#1581195 — [patch 0/2] goldfish: Prevent the trainwreck from doing harm

FromThomas Gleixner <tglx@linutronix.de>
Date2017-02-15 11:30 +0100
Subject[patch 0/2] goldfish: Prevent the trainwreck from doing harm
Message-ID<tb50t-78r-3@gated-at.bofh.it>
The goldfish android emulator platform is a complete trainwreck which
causes havoc when enabled in Kconfig.

Aside of unconditionally registering a platform device with hardcoded
address ranges, it prevents the serial interrupt from being requested and
in case of a spurious interrupt the broken interrupt handler of the
pdev_bus driver goes into a hard to debug infinite loop.

Thanks to Gabriel and Borislav for providing patiently debug information.

No thanks to the folks @Intel who choked this $corporate trainwreck down
our throat and wasted the time of everyone who got bitten by this.

Thanks,

	tglx

[toc] | [next] | [standalone]


#1581198 — [patch 2/2] goldfish: Sanitize the broken interrupt handler

FromThomas Gleixner <tglx@linutronix.de>
Date2017-02-15 11:30 +0100
Subject[patch 2/2] goldfish: Sanitize the broken interrupt handler
Message-ID<tb50u-78r-15@gated-at.bofh.it>
In reply to#1581195
This interrupt handler is broken in several ways:

  - It loops forever when the op code is not decodeable

  - It never returns IRQ_HANDLED because the only way to exit the loop
    returns IRQ_NONE unconditionally.

The whole concept of this is broken. Creating devices in an interrupt
handler is beyond any point of sanity.

Make it at least behave halfways sane so accidental users do not have to
deal with a hard to debug lockup.

Fixes: e809c22b8fb028 ("goldfish: add the goldfish virtual bus")
Reported-by: Gabriel C <nix.or.die@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
---
 drivers/platform/goldfish/pdev_bus.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

--- a/drivers/platform/goldfish/pdev_bus.c
+++ b/drivers/platform/goldfish/pdev_bus.c
@@ -157,23 +157,26 @@ static int goldfish_new_pdev(void)
 static irqreturn_t goldfish_pdev_bus_interrupt(int irq, void *dev_id)
 {
 	irqreturn_t ret = IRQ_NONE;
+
 	while (1) {
 		u32 op = readl(pdev_bus_base + PDEV_BUS_OP);
-		switch (op) {
-		case PDEV_BUS_OP_DONE:
-			return IRQ_NONE;
 
+		switch (op) {
 		case PDEV_BUS_OP_REMOVE_DEV:
 			goldfish_pdev_remove();
+			ret = IRQ_HANDLED;
 			break;
 
 		case PDEV_BUS_OP_ADD_DEV:
 			goldfish_new_pdev();
+			ret = IRQ_HANDLED;
 			break;
+
+		case PDEV_BUS_OP_DONE:
+		default:
+			return ret;
 		}
-		ret = IRQ_HANDLED;
 	}
-	return ret;
 }
 
 static int goldfish_pdev_bus_probe(struct platform_device *pdev)

[toc] | [prev] | [next] | [standalone]


#1581411

FromLinus Torvalds <torvalds@linux-foundation.org>
Date2017-02-15 16:50 +0100
Message-ID<tba0a-1Py-11@gated-at.bofh.it>
In reply to#1581195
Ack. I'm assuming Greg will pick this up, in the meantime I hope
anybody who has problems just disables the goldfish support.

Thanks,

               Linus

[toc] | [prev] | [next] | [standalone]


#1581464

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-02-15 18:00 +0100
Message-ID<tbb5V-2sv-35@gated-at.bofh.it>
In reply to#1581411
On Wed, Feb 15, 2017 at 07:49:25AM -0800, Linus Torvalds wrote:
> Ack. I'm assuming Greg will pick this up, in the meantime I hope
> anybody who has problems just disables the goldfish support.

I've queued them up now for the next merge window, and they are tagged
for stable so will show up in 4.10.1.

thanks,

greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web