diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-08-25 19:51:47 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-08-30 08:47:40 +0200 |
commit | 7153a558ad598ff521f1d9430982e2a4a6865126 (patch) | |
tree | 79b0a39ef01f45c25966c7bce3ab35d8a5a183db /sound/core | |
parent | e0c93cf311b3eaa04bfb5769cff38861d4e748c8 (diff) | |
download | op-kernel-dev-7153a558ad598ff521f1d9430982e2a4a6865126.zip op-kernel-dev-7153a558ad598ff521f1d9430982e2a4a6865126.tar.gz |
[ALSA] pcm - Fix zero-division in 32bit compat layer
PCM Midlevel
Fixed zero-division bug in PCM 32bit compat layer.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/pcm_compat.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index eef94a1..4b6307d 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c @@ -144,7 +144,7 @@ static int snd_pcm_ioctl_sw_params_compat(snd_pcm_substream_t *substream, err = snd_pcm_sw_params(substream, ¶ms); if (err < 0) return err; - if (put_user(boundary, &src->boundary)) + if (boundary && put_user(boundary, &src->boundary)) return -EFAULT; return err; } @@ -252,8 +252,11 @@ static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream, goto error; } - if (! refine) - runtime->boundary = recalculate_boundary(runtime); + if (! refine) { + unsigned int new_boundary = recalculate_boundary(runtime); + if (new_boundary) + runtime->boundary = new_boundary; + } error: kfree(data); return err; @@ -408,6 +411,8 @@ static int snd_pcm_ioctl_sync_ptr_compat(snd_pcm_substream_t *substream, status = runtime->status; control = runtime->control; boundary = recalculate_boundary(runtime); + if (! boundary) + boundary = 0x7fffffff; snd_pcm_stream_lock_irq(substream); /* FIXME: we should consider the boundary for the sync from app */ if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) |