From: Willy Tarreau <willy@w.ods.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Jesper Juhl <jesper.juhl@gmail.com>,
linux-kernel@vger.kernel.org, perex@suse.cz
Subject: Re: [PATCH] fix potential NULL pointer deref in snd_sb8dsp_midi_interrupt()
Date: Sun, 14 May 2006 16:40:54 +0200 [thread overview]
Message-ID: <20060514144054.GM11191@w.ods.org> (raw)
In-Reply-To: <20060514142409.GC23387@mipter.zuzino.mipt.ru>
On Sun, May 14, 2006 at 06:24:09PM +0400, Alexey Dobriyan wrote:
> On Sun, May 14, 2006 at 04:20:52AM +0200, Jesper Juhl wrote:
> > First testing if a pointer is NULL and if it is (or might be), proceeding
> > with code that dereferences that same pointer is clearly a mistake.
> > This happens in sound/isa/sb/sb8_midi.c::snd_sb8dsp_midi_interrupt()
> > The patch below reworks the code so this unfortunate case doesn't happen.
>
> All callers of snd_sb8dsp_midi_interrupt() dereference "chip" right
> before calling.
So the "if (chip == NULL)" part should be removed to avoid confusion.
>
> > --- linux-2.6.17-rc4-git2-orig/sound/isa/sb/sb8_midi.c
> > +++ linux-2.6.17-rc4-git2/sound/isa/sb/sb8_midi.c
> > -irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb * chip)
> > +irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip)
> > {
> > struct snd_rawmidi *rmidi;
> > int max = 64;
> > char byte;
> >
> > - if (chip == NULL || (rmidi = chip->rmidi) == NULL) {
> > + if (!chip)
> > + return IRQ_NONE;
> > +
> > + rmidi = chip->rmidi;
> > + if (!rmidi) {
> > inb(SBP(chip, DATA_AVAIL)); /* ack interrupt */
> > return IRQ_NONE;
> > }
Willy
prev parent reply other threads:[~2006-05-14 14:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-14 2:20 Jesper Juhl
2006-05-14 14:24 ` Alexey Dobriyan
2006-05-14 14:40 ` Willy Tarreau [this message]
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=20060514144054.GM11191@w.ods.org \
--to=willy@w.ods.org \
--cc=adobriyan@gmail.com \
--cc=jesper.juhl@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@suse.cz \
/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
all inboxes | Powered by JetHome®