aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-02-15 05:11:51 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-15 11:49:58 -0500
commit6cf18e6927c0b224f972e3042fb85770d63cb9f8 (patch)
treeea7ebea14338936e8b81a3d7a641a019fca986fe
parent47512cfd0d7a8bd6ab71d01cd89fca19eb2093eb (diff)
goldfish: Sanitize the broken interrupt handler
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> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/platform/goldfish/pdev_bus.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/platform/goldfish/pdev_bus.c b/drivers/platform/goldfish/pdev_bus.c
index 1f52462f4cdd..dd9ea463c2a4 100644
--- a/drivers/platform/goldfish/pdev_bus.c
+++ b/drivers/platform/goldfish/pdev_bus.c
@@ -157,23 +157,26 @@ static int goldfish_new_pdev(void)
157static irqreturn_t goldfish_pdev_bus_interrupt(int irq, void *dev_id) 157static irqreturn_t goldfish_pdev_bus_interrupt(int irq, void *dev_id)
158{ 158{
159 irqreturn_t ret = IRQ_NONE; 159 irqreturn_t ret = IRQ_NONE;
160
160 while (1) { 161 while (1) {
161 u32 op = readl(pdev_bus_base + PDEV_BUS_OP); 162 u32 op = readl(pdev_bus_base + PDEV_BUS_OP);
162 switch (op) {
163 case PDEV_BUS_OP_DONE:
164 return IRQ_NONE;
165 163
164 switch (op) {
166 case PDEV_BUS_OP_REMOVE_DEV: 165 case PDEV_BUS_OP_REMOVE_DEV:
167 goldfish_pdev_remove(); 166 goldfish_pdev_remove();
167 ret = IRQ_HANDLED;
168 break; 168 break;
169 169
170 case PDEV_BUS_OP_ADD_DEV: 170 case PDEV_BUS_OP_ADD_DEV:
171 goldfish_new_pdev(); 171 goldfish_new_pdev();
172 ret = IRQ_HANDLED;
172 break; 173 break;
174
175 case PDEV_BUS_OP_DONE:
176 default:
177 return ret;
173 } 178 }
174 ret = IRQ_HANDLED;
175 } 179 }
176 return ret;
177} 180}
178 181
179static int goldfish_pdev_bus_probe(struct platform_device *pdev) 182static int goldfish_pdev_bus_probe(struct platform_device *pdev)