* [PATCH 3/3] sound/pci: Eliminate use after free
@ 2010-04-02 12:47 Julia Lawall
2010-04-04 10:22 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2010-04-02 12:47 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
Use the call to snd_card_free in the error handling code at the end of the
function, as in the other error cases.
A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression E,E2;
@@
snd_card_free(E)
...
(
E = E2
|
* E
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
sound/pci/echoaudio/echoaudio.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 8dab82d..668a5ec 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -2184,10 +2184,9 @@ static int __devinit snd_echo_probe(struct pci_dev *pci,
goto ctl_error;
#endif
- if ((err = snd_card_register(card)) < 0) {
- snd_card_free(card);
+ err = snd_card_register(card);
+ if (err < 0)
goto ctl_error;
- }
snd_printk(KERN_INFO "Card registered: %s\n", card->longname);
pci_set_drvdata(pci, chip);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 3/3] sound/pci: Eliminate use after free
2010-04-02 12:47 [PATCH 3/3] sound/pci: Eliminate use after free Julia Lawall
@ 2010-04-04 10:22 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2010-04-04 10:22 UTC (permalink / raw)
To: Julia Lawall; +Cc: Jaroslav Kysela, alsa-devel, linux-kernel, kernel-janitors
At Fri, 2 Apr 2010 14:47:59 +0200 (CEST),
Julia Lawall wrote:
>
> From: Julia Lawall <julia@diku.dk>
>
> Use the call to snd_card_free in the error handling code at the end of the
> function, as in the other error cases.
>
> A simplified version of the semantic patch that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression E,E2;
> @@
>
> snd_card_free(E)
> ...
> (
> E = E2
> |
> * E
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
Applied now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-04 10:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-02 12:47 [PATCH 3/3] sound/pci: Eliminate use after free Julia Lawall
2010-04-04 10:22 ` Takashi Iwai
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®