From: Rusty Russell <rusty@rustcorp.com.au>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [TRIVIAL] [patch, 2.4] drivers_sound_ad1848.c doesn't release region on error
Date: Tue, 13 Aug 2002 15:01:12 +1000 [thread overview]
Message-ID: <20020813002128.9959C2C150@lists.samba.org> (raw)
In-Reply-To: Your message of "12 Aug 2002 11:14:18 +0100." <1029147258.16421.123.camel@irongate.swansea.linux.org.uk>
In message <1029147258.16421.123.camel@irongate.swansea.linux.org.uk> you write
:
> On Mon, 2002-08-12 at 04:35, Rusty Russell wrote:
> > [ Simple, and looks trivially correct from reading file. ]
> > From: Marcus Alanen <maalanen@ra.abo.fi>
> >
> > Doesn't check request_region and doesn't release region on failed
> > kmalloc.
>
> I don't have hardware to test this, so on the basis its not tested I'd
> say no until someone with the hardware tests it.
Can someone with an ad1848 please test this trivial patch? Preferably
test that loading the module the second time works fine?
Thanks!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
===== drivers/sound/ad1848.c 1.8 vs edited =====
--- 1.8/drivers/sound/ad1848.c Fri May 10 01:40:52 2002
+++ edited/drivers/sound/ad1848.c Sun Jul 14 18:21:20 2002
@@ -1997,7 +1997,8 @@
sprintf(dev_name,
"Generic audio codec (%s)", devc->chip_name);
- request_region(devc->base, 4, devc->name);
+ if (!request_region(devc->base, 4, devc->name))
+ return -1;
conf_printf2(dev_name, devc->base, devc->irq, dma_playback, dma_capture);
@@ -2013,8 +2014,10 @@
}
portc = (ad1848_port_info *) kmalloc(sizeof(ad1848_port_info), GFP_KERNEL);
- if(portc==NULL)
+ if(portc==NULL) {
+ release_region(devc->base, 4);
return -1;
+ }
if ((my_dev = sound_install_audiodrv(AUDIO_DRIVER_VERSION,
dev_name,
@@ -2026,8 +2029,8 @@
dma_playback,
dma_capture)) < 0)
{
+ release_region(devc->base, 4);
kfree(portc);
- portc=NULL;
return -1;
}
parent reply other threads:[~2002-08-13 5:17 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1029147258.16421.123.camel@irongate.swansea.linux.org.uk>]
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=20020813002128.9959C2C150@lists.samba.org \
--to=rusty@rustcorp.com.au \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
/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