Commit 7153a558 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] pcm - Fix zero-division in 32bit compat layer

PCM Midlevel
Fixed zero-division bug in PCM 32bit compat layer.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent e0c93cf3
...@@ -144,7 +144,7 @@ static int snd_pcm_ioctl_sw_params_compat(snd_pcm_substream_t *substream, ...@@ -144,7 +144,7 @@ static int snd_pcm_ioctl_sw_params_compat(snd_pcm_substream_t *substream,
err = snd_pcm_sw_params(substream, &params); err = snd_pcm_sw_params(substream, &params);
if (err < 0) if (err < 0)
return err; return err;
if (put_user(boundary, &src->boundary)) if (boundary && put_user(boundary, &src->boundary))
return -EFAULT; return -EFAULT;
return err; return err;
} }
...@@ -252,8 +252,11 @@ static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream, ...@@ -252,8 +252,11 @@ static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream,
goto error; goto error;
} }
if (! refine) if (! refine) {
runtime->boundary = recalculate_boundary(runtime); unsigned int new_boundary = recalculate_boundary(runtime);
if (new_boundary)
runtime->boundary = new_boundary;
}
error: error:
kfree(data); kfree(data);
return err; return err;
...@@ -408,6 +411,8 @@ static int snd_pcm_ioctl_sync_ptr_compat(snd_pcm_substream_t *substream, ...@@ -408,6 +411,8 @@ static int snd_pcm_ioctl_sync_ptr_compat(snd_pcm_substream_t *substream,
status = runtime->status; status = runtime->status;
control = runtime->control; control = runtime->control;
boundary = recalculate_boundary(runtime); boundary = recalculate_boundary(runtime);
if (! boundary)
boundary = 0x7fffffff;
snd_pcm_stream_lock_irq(substream); snd_pcm_stream_lock_irq(substream);
/* FIXME: we should consider the boundary for the sync from app */ /* FIXME: we should consider the boundary for the sync from app */
if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment