[PATCH] [UBUNTU:sound/core/] Fix dereference after free() in snd_hwdep_release()

crimsun at fungus.sh.nu crimsun at fungus.sh.nu
Sat Sep 30 04:04:08 UTC 2006


From 7c82ef5f836d37c1bc640869b3d627925c0a8386 Mon Sep 17 00:00:00 2001
From: Daniel T. Chen <crimsun at garnish.localdomain>
Date: Fri, 29 Sep 2006 21:10:45 -0400
Subject: [PATCH] [UBUNTU:sound/core/] Fix dereference after free() in snd_hwdep_release()

UpstreamStatus: Added in upstream alsa-kernel hg changeset:
		f74df30f7f11 [http://hg-mirror.alsa-project.org/alsa-kernel?cmd=changeset;node=f74df30f7f11bb7192daea6ffcb7697a500d6c6a;style=raw]

snd_card_file_remove() may free hw->card so we can't dereference
hw->card->module after that.

Coverity ID 1420.

Suitable for application to both Dapper and Edgy linux-source.

Signed-off-by: Florin Malita <fmalita at gmail.com>
Signed-off-by: Daniel T Chen <crimsun at ubuntu.com>
---
 sound/core/hwdep.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index e91cee3..a5a425f 100644
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -155,6 +155,7 @@ static int snd_hwdep_release(struct inod
 {
 	int err = -ENXIO;
 	snd_hwdep_t *hw = file->private_data;
+	struct module *mod = hw->card->module;
 	down(&hw->open_mutex);
 	if (hw->ops.release) {
 		err = hw->ops.release(hw, file);
@@ -164,7 +165,7 @@ static int snd_hwdep_release(struct inod
 		hw->used--;
 	snd_card_file_remove(hw->card, file);
 	up(&hw->open_mutex);
-	module_put(hw->card->module);
+	module_put(mod);
 	return err;
 }
 
-- 
1.4.1


-- 
Daniel T. Chen            crimsun at ubuntu.com
GPG key:  0xC88ABDA3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20060929/77c08e97/attachment.sig>


More information about the kernel-team mailing list