Skip to content

Commit 663d8fb

Browse files
William Breathitt Graygregkh
authored andcommitted
counter: 104-quad-8: Fix use-after-free by quad8_irq_handler
On unbind an irq might be pending which results in quad8_irq_handler() calling counter_push_event() for a counter that is already unregistered. This patch fixes that situation by passing the struct counter_device dev to devm_request_irq() rather than the parent's so that the irq handler is cleaned before the counter is unregistered. Fixes: 7aa2ba0 ("counter: 104-quad-8: Add IRQ support for the ACCES 104-QUAD-8") Cc: Syed Nayyar Waris <[email protected]> Reported-by: Uwe Kleine-König <[email protected]> Signed-off-by: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8f2cade commit 663d8fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/counter/104-quad-8.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,8 +1188,8 @@ static int quad8_probe(struct device *dev, unsigned int id)
11881188
/* Enable all counters and enable interrupt function */
11891189
outb(QUAD8_CHAN_OP_ENABLE_INTERRUPT_FUNC, base[id] + QUAD8_REG_CHAN_OP);
11901190

1191-
err = devm_request_irq(dev, irq[id], quad8_irq_handler, IRQF_SHARED,
1192-
counter->name, counter);
1191+
err = devm_request_irq(&counter->dev, irq[id], quad8_irq_handler,
1192+
IRQF_SHARED, counter->name, counter);
11931193
if (err)
11941194
return err;
11951195

0 commit comments

Comments
 (0)