diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-14 14:41:18 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-26 20:58:47 +0200 |
commit | 83ee87a31dc43a5fd6dee3562c146033c3a4cb39 (patch) | |
tree | 3c8070786261f4994209328901bda6b183077e3c /drivers/media/video/cx88/cx88-alsa.c | |
parent | V4L/DVB (8022): saa7134: fix race between opening and closing the device (diff) | |
download | linux-83ee87a31dc43a5fd6dee3562c146033c3a4cb39.tar.xz linux-83ee87a31dc43a5fd6dee3562c146033c3a4cb39.zip |
V4L/DVB (8026): Avoids an OOPS if dev struct can't be successfully recovered
On some alsa versions, it seems that snd_pcm_substream_chip(substream)
is returning a NULL pointer. This causes an OOPS, as reported by:
https://bugs.launchpad.net/ubuntu/+source/linux-ubuntu-modules-2.6.24/+bug/212271
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/212960
This patch avoids the OOPS by not letting and open() succeed.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx88/cx88-alsa.c')
-rw-r--r-- | drivers/media/video/cx88/cx88-alsa.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index e976fc6bef7c..80c8883e54b5 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c @@ -332,6 +332,12 @@ static int snd_cx88_pcm_open(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; int err; + if (!chip) { + printk(KERN_ERR "BUG: cx88 can't find device struct." + " Can't proceed with open\n"); + return -ENODEV; + } + err = snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS); if (err < 0) goto _error; |