Skip to content

Commit 1569697

Browse files
KAGA-KOKOgregkh
authored andcommitted
goldfish: Sanitize the broken interrupt handler
commit 6cf18e6927c0b224f972e3042fb85770d63cb9f8 upstream. 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: e809c22 ("goldfish: add the goldfish virtual bus") Reported-by: Gabriel C <nix.or.die@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d7f9730 commit 1569697

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

drivers/platform/goldfish/pdev_bus.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,23 +157,26 @@ static int goldfish_new_pdev(void)
157157
static irqreturn_t goldfish_pdev_bus_interrupt(int irq, void *dev_id)
158158
{
159159
irqreturn_t ret = IRQ_NONE;
160+
160161
while (1) {
161162
u32 op = readl(pdev_bus_base + PDEV_BUS_OP);
162-
switch (op) {
163-
case PDEV_BUS_OP_DONE:
164-
return IRQ_NONE;
165163

164+
switch (op) {
166165
case PDEV_BUS_OP_REMOVE_DEV:
167166
goldfish_pdev_remove();
167+
ret = IRQ_HANDLED;
168168
break;
169169

170170
case PDEV_BUS_OP_ADD_DEV:
171171
goldfish_new_pdev();
172+
ret = IRQ_HANDLED;
172173
break;
174+
175+
case PDEV_BUS_OP_DONE:
176+
default:
177+
return ret;
173178
}
174-
ret = IRQ_HANDLED;
175179
}
176-
return ret;
177180
}
178181

179182
static int goldfish_pdev_bus_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)