From: Christoph Fritz <chf.fritz@googlemail.com>
To: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: linux-next <linux-next@vger.kernel.org>
Subject: [BUG -next] pcmcia: setup IRQ to be used by PCMCIA drivers at card insert
Date: Tue, 03 Aug 2010 02:38:19 +0200 [thread overview]
Message-ID: <1280795899.11158.52.camel@lovely.krouter> (raw)
Hi,
buffer overflow in next-tree's commit 6f0f38c45a8f2f511c25893e33011ff32fc811db:
size of array pcmcia_used_irq[] can be less than 32
in drivers/pcmcia/pcmcia_resource.c
+static int pcmcia_setup_isa_irq(struct pcmcia_device *p_dev, int type)
+{
[..]
+ for (try = 0; try < 64; try++) {
+ irq = try % 32;
[..]
+
+ /* avoid an IRQ which is already used by another PCMCIA card */
+ if ((try < 32) && pcmcia_used_irq[irq])
+ continue;
drivers/pcmcia/pcmcia_resource.c
static u8 pcmcia_used_irq[NR_IRQS];
arch/x86/include/asm/irq_vectors.h
#define NR_IRQS_LEGACY 16
[..]
#else /* !CONFIG_X86_IO_APIC: */
# define NR_IRQS NR_IRQS_LEGACY
#endif
---
non-tested fix:
---
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index d48437f..f8363e6 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -697,15 +697,15 @@ static int pcmcia_setup_isa_irq(struct pcmcia_device *p_dev, int type)
u32 mask = s->irq_mask;
int ret = -ENODEV;
- for (try = 0; try < 64; try++) {
- irq = try % 32;
+ for (try = 0; try < (NR_IRQS * 2); try++) {
+ irq = try % NR_IRQS;
/* marked as available by driver, not blocked by userspace? */
if (!((mask >> irq) & 1))
continue;
/* avoid an IRQ which is already used by another PCMCIA card */
- if ((try < 32) && pcmcia_used_irq[irq])
+ if ((try < NR_IRQS) && pcmcia_used_irq[irq])
continue;
/* register the correct driver, if possible, to check whether
next reply other threads:[~2010-08-03 0:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-03 0:38 Christoph Fritz [this message]
2010-08-03 6:17 ` [BUG -next] pcmcia: setup IRQ to be used by PCMCIA drivers at card insert Dominik Brodowski
2010-08-03 10:23 ` Christoph Fritz
2010-08-03 7:40 ` [PATCH] pcmcia: avoid buffer overflow in pcmcia_setup_isa_irq Dominik Brodowski
2010-08-03 7:42 ` Dominik Brodowski
2010-08-03 10:26 ` Christoph Fritz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1280795899.11158.52.camel@lovely.krouter \
--to=chf.fritz@googlemail.com \
--cc=linux-next@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox