aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/pcm_native.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-11-08 14:36:18 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-17 13:14:26 -0800
commitaaf238baf31e14cb1c111815193c3a78770b1873 (patch)
tree36c89b47364c470c7cbafbade2220d5c68a4ccc2 /sound/core/pcm_native.c
parent919609d3cba52431b16501a63e6a5d45266a25c6 (diff)
downloadkernel_samsung_smdk4412-aaf238baf31e14cb1c111815193c3a78770b1873.zip
kernel_samsung_smdk4412-aaf238baf31e14cb1c111815193c3a78770b1873.tar.gz
kernel_samsung_smdk4412-aaf238baf31e14cb1c111815193c3a78770b1873.tar.bz2
ALSA: Fix card refcount unbalance
commit 8bb4d9ce08b0a92ca174e41d92c180328f86173f upstream. There are uncovered cases whether the card refcount introduced by the commit a0830dbd isn't properly increased or decreased: - OSS PCM and mixer success paths - When lookup function gets NULL This patch fixes these places. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50251 Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r--sound/core/pcm_native.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index c8e5a6b..7393551 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2110,7 +2110,8 @@ static int snd_pcm_playback_open(struct inode *inode, struct file *file)
pcm = snd_lookup_minor_data(iminor(inode),
SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);
- snd_card_unref(pcm->card);
+ if (pcm)
+ snd_card_unref(pcm->card);
return err;
}
@@ -2123,7 +2124,8 @@ static int snd_pcm_capture_open(struct inode *inode, struct file *file)
pcm = snd_lookup_minor_data(iminor(inode),
SNDRV_DEVICE_TYPE_PCM_CAPTURE);
err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);
- snd_card_unref(pcm->card);
+ if (pcm)
+ snd_card_unref(pcm->card);
return err;
}