aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-08-25 13:51:47 -0400
committerJaroslav Kysela <perex@suse.cz>2005-08-30 02:47:40 -0400
commit7153a558ad598ff521f1d9430982e2a4a6865126 (patch)
tree79b0a39ef01f45c25966c7bce3ab35d8a5a183db
parente0c93cf311b3eaa04bfb5769cff38861d4e748c8 (diff)
[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>
-rw-r--r--sound/core/pcm_compat.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index eef94a15f50a..4b6307df846d 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,
144 err = snd_pcm_sw_params(substream, &params); 144 err = snd_pcm_sw_params(substream, &params);
145 if (err < 0) 145 if (err < 0)
146 return err; 146 return err;
147 if (put_user(boundary, &src->boundary)) 147 if (boundary && put_user(boundary, &src->boundary))
148 return -EFAULT; 148 return -EFAULT;
149 return err; 149 return err;
150} 150}
@@ -252,8 +252,11 @@ static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream,
252 goto error; 252 goto error;
253 } 253 }
254 254
255 if (! refine) 255 if (! refine) {
256 runtime->boundary = recalculate_boundary(runtime); 256 unsigned int new_boundary = recalculate_boundary(runtime);
257 if (new_boundary)
258 runtime->boundary = new_boundary;
259 }
257 error: 260 error:
258 kfree(data); 261 kfree(data);
259 return err; 262 return err;
@@ -408,6 +411,8 @@ static int snd_pcm_ioctl_sync_ptr_compat(snd_pcm_substream_t *substream,
408 status = runtime->status; 411 status = runtime->status;
409 control = runtime->control; 412 control = runtime->control;
410 boundary = recalculate_boundary(runtime); 413 boundary = recalculate_boundary(runtime);
414 if (! boundary)
415 boundary = 0x7fffffff;
411 snd_pcm_stream_lock_irq(substream); 416 snd_pcm_stream_lock_irq(substream);
412 /* FIXME: we should consider the boundary for the sync from app */ 417 /* FIXME: we should consider the boundary for the sync from app */
413 if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) 418 if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL))