Update of /cvsroot/alsa/alsa-kernel/core In directory sc8-pr-cvs1:/tmp/cvs-serv2686
Modified Files: hwdep.c Log Message: Use try_module_get() and module_put() to block the toplevel module Fixed returned error code in the release() callback Index: hwdep.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/core/hwdep.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- hwdep.c 4 Sep 2003 18:12:30 -0000 1.19 +++ hwdep.c 4 Sep 2003 18:45:26 -0000 1.20 @@ -97,14 +97,19 @@ cardnum %= SNDRV_CARDS; device %= SNDRV_MINOR_HWDEPS; hw = snd_hwdep_devices[(cardnum * SNDRV_MINOR_HWDEPS) + device]; + if (hw == NULL) + return -ENODEV; - snd_assert(hw != NULL, return -ENODEV); if (!hw->ops.open) return -ENXIO; #ifdef CONFIG_SND_OSSEMUL if (major == SOUND_MAJOR && hw->oss_type < 0) return -ENXIO; #endif + + if (!try_module_get(hw->card->module)) + return -EFAULT; + init_waitqueue_entry(&wait, current); add_wait_queue(&hw->open_wait, &wait); down(&hw->open_mutex); @@ -137,9 +142,14 @@ if (err >= 0) { file->private_data = hw; hw->used++; + } else { + if (hw->ops.release) + hw->ops.release(hw, file); } } up(&hw->open_mutex); + if (err < 0) + module_put(hw->card->module); return err; } @@ -156,7 +166,8 @@ hw->used--; snd_card_file_remove(hw->card, file); up(&hw->open_mutex); - return -ENXIO; + module_put(hw->card->module); + return err; } static unsigned int snd_hwdep_poll(struct file * file, poll_table * wait) ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog