]> git.karo-electronics.de Git - karo-tx-linux.git/commit
pcmcia: avoid buffer overflow in pcmcia_setup_isa_irq
authorDominik Brodowski <linux@dominikbrodowski.net>
Tue, 3 Aug 2010 07:33:45 +0000 (09:33 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 26 Aug 2010 23:41:53 +0000 (16:41 -0700)
commit47084480bf6f0c78be4d3a82020fa18f90425f26
treee6455f8d4b1ca31ce8c8dce32b00b3739615a281
parent94739dc4e2da1ade4a87b53de97399c2ec0dd83b
pcmcia: avoid buffer overflow in pcmcia_setup_isa_irq

commit 127c03cdbad9bd5af5d7f33bd31a1015a90cb77f upstream.

NR_IRQS may be as low as 16, causing a (harmless?) buffer overflow in
pcmcia_setup_isa_irq():

static u8 pcmcia_used_irq[NR_IRQS];

...

if ((try < 32) && pcmcia_used_irq[irq])
continue;

This is read-only, so if this address would be non-zero, it would just
mean we would not attempt an IRQ >= NR_IRQS -- which would fail anyway!
And as request_irq() fails for an irq >= NR_IRQS, the setting code path:

pcmcia_used_irq[irq]++;

is never reached as well.

Reported-by: Christoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pcmcia/pcmcia_resource.c