Merge branch 'fix/misc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6

* 'fix/misc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: rawmidi: fix oops (use after free) when unloading a driver module
This commit is contained in:
Linus Torvalds 2010-10-17 09:38:08 -07:00
commit 2b666ca4a6
1 changed files with 3 additions and 1 deletions

View File

@ -535,13 +535,15 @@ static int snd_rawmidi_release(struct inode *inode, struct file *file)
{ {
struct snd_rawmidi_file *rfile; struct snd_rawmidi_file *rfile;
struct snd_rawmidi *rmidi; struct snd_rawmidi *rmidi;
struct module *module;
rfile = file->private_data; rfile = file->private_data;
rmidi = rfile->rmidi; rmidi = rfile->rmidi;
rawmidi_release_priv(rfile); rawmidi_release_priv(rfile);
kfree(rfile); kfree(rfile);
module = rmidi->card->module;
snd_card_file_remove(rmidi->card, file); snd_card_file_remove(rmidi->card, file);
module_put(rmidi->card->module); module_put(module);
return 0; return 0;
} }