Skip to content

Commit 2b666ca

Browse files
committed
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
2 parents 2d01971 + aa73aec commit 2b666ca

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sound/core/rawmidi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,13 +535,15 @@ static int snd_rawmidi_release(struct inode *inode, struct file *file)
535535
{
536536
struct snd_rawmidi_file *rfile;
537537
struct snd_rawmidi *rmidi;
538+
struct module *module;
538539

539540
rfile = file->private_data;
540541
rmidi = rfile->rmidi;
541542
rawmidi_release_priv(rfile);
542543
kfree(rfile);
544+
module = rmidi->card->module;
543545
snd_card_file_remove(rmidi->card, file);
544-
module_put(rmidi->card->module);
546+
module_put(module);
545547
return 0;
546548
}
547549

0 commit comments

Comments
 (0)