diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-15 12:11:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-15 12:11:11 -0400 |
commit | 3ee8da87ba6151ec91b2b8bbd27633bb248ea0d5 (patch) | |
tree | a348efdfe8f607583dd61bf75e1b5d077c92a4a0 /sound/core/pcm_native.c | |
parent | a2c252ebdeaab28c9b400570594d576dae295958 (diff) | |
parent | 9dd175f7d2db1826c891855d3d150da3a5792e94 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
ALSA: hda - Fix the cmd cache keys for amp verbs
ALSA: add missing definitions(letters) to HD-Audio.txt
ALSA: hda - Add quirk mask for Fujitsu Amilo laptops with ALC883
[ALSA] intel8x0: add one retry to the ac97_clock measurement routine
[ALSA] intel8x0: fix wrong conditions in ac97_clock measure routine
ALSA: hda - Avoid call of snd_jack_report at release
ALSA: add private_data to struct snd_jack
ALSA: snd-usb-caiaq: rename files to remove redundant information in file pathes
ALSA: snd-usb-caiaq: clean up header includes
ALSA: sound/pci: use memdup_user()
ALSA: sound/usb: use memdup_user()
ALSA: sound/isa: use memdup_user()
ALSA: sound/core: use memdup_user()
[ALSA] intel8x0: do not use zero value from PICB register
[ALSA] intel8x0: an attempt to make ac97_clock measurement more reliable
[ALSA] pcm-midlevel: Add more strict buffer position checks based on jiffies
[ALSA] hda_intel: fix unexpected ring buffer positions
ASoC: Disable S3C64xx support in Kconfig
ASoC: magician: remove un-necessary #include of pxa-regs.h and hardware.h
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r-- | sound/core/pcm_native.c | 93 |
1 files changed, 35 insertions, 58 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index a151fb01ba8..fc6f98e257d 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -327,21 +327,16 @@ static int snd_pcm_hw_refine_user(struct snd_pcm_substream *substream, | |||
327 | struct snd_pcm_hw_params *params; | 327 | struct snd_pcm_hw_params *params; |
328 | int err; | 328 | int err; |
329 | 329 | ||
330 | params = kmalloc(sizeof(*params), GFP_KERNEL); | 330 | params = memdup_user(_params, sizeof(*params)); |
331 | if (!params) { | 331 | if (IS_ERR(params)) |
332 | err = -ENOMEM; | 332 | return PTR_ERR(params); |
333 | goto out; | 333 | |
334 | } | ||
335 | if (copy_from_user(params, _params, sizeof(*params))) { | ||
336 | err = -EFAULT; | ||
337 | goto out; | ||
338 | } | ||
339 | err = snd_pcm_hw_refine(substream, params); | 334 | err = snd_pcm_hw_refine(substream, params); |
340 | if (copy_to_user(_params, params, sizeof(*params))) { | 335 | if (copy_to_user(_params, params, sizeof(*params))) { |
341 | if (!err) | 336 | if (!err) |
342 | err = -EFAULT; | 337 | err = -EFAULT; |
343 | } | 338 | } |
344 | out: | 339 | |
345 | kfree(params); | 340 | kfree(params); |
346 | return err; | 341 | return err; |
347 | } | 342 | } |
@@ -465,21 +460,16 @@ static int snd_pcm_hw_params_user(struct snd_pcm_substream *substream, | |||
465 | struct snd_pcm_hw_params *params; | 460 | struct snd_pcm_hw_params *params; |
466 | int err; | 461 | int err; |
467 | 462 | ||
468 | params = kmalloc(sizeof(*params), GFP_KERNEL); | 463 | params = memdup_user(_params, sizeof(*params)); |
469 | if (!params) { | 464 | if (IS_ERR(params)) |
470 | err = -ENOMEM; | 465 | return PTR_ERR(params); |
471 | goto out; | 466 | |
472 | } | ||
473 | if (copy_from_user(params, _params, sizeof(*params))) { | ||
474 | err = -EFAULT; | ||
475 | goto out; | ||
476 | } | ||
477 | err = snd_pcm_hw_params(substream, params); | 467 | err = snd_pcm_hw_params(substream, params); |
478 | if (copy_to_user(_params, params, sizeof(*params))) { | 468 | if (copy_to_user(_params, params, sizeof(*params))) { |
479 | if (!err) | 469 | if (!err) |
480 | err = -EFAULT; | 470 | err = -EFAULT; |
481 | } | 471 | } |
482 | out: | 472 | |
483 | kfree(params); | 473 | kfree(params); |
484 | return err; | 474 | return err; |
485 | } | 475 | } |
@@ -2593,13 +2583,11 @@ static int snd_pcm_playback_ioctl1(struct file *file, | |||
2593 | return -EFAULT; | 2583 | return -EFAULT; |
2594 | if (copy_from_user(&xfern, _xfern, sizeof(xfern))) | 2584 | if (copy_from_user(&xfern, _xfern, sizeof(xfern))) |
2595 | return -EFAULT; | 2585 | return -EFAULT; |
2596 | bufs = kmalloc(sizeof(void *) * runtime->channels, GFP_KERNEL); | 2586 | |
2597 | if (bufs == NULL) | 2587 | bufs = memdup_user(xfern.bufs, |
2598 | return -ENOMEM; | 2588 | sizeof(void *) * runtime->channels); |
2599 | if (copy_from_user(bufs, xfern.bufs, sizeof(void *) * runtime->channels)) { | 2589 | if (IS_ERR(bufs)) |
2600 | kfree(bufs); | 2590 | return PTR_ERR(bufs); |
2601 | return -EFAULT; | ||
2602 | } | ||
2603 | result = snd_pcm_lib_writev(substream, bufs, xfern.frames); | 2591 | result = snd_pcm_lib_writev(substream, bufs, xfern.frames); |
2604 | kfree(bufs); | 2592 | kfree(bufs); |
2605 | __put_user(result, &_xfern->result); | 2593 | __put_user(result, &_xfern->result); |
@@ -2675,13 +2663,11 @@ static int snd_pcm_capture_ioctl1(struct file *file, | |||
2675 | return -EFAULT; | 2663 | return -EFAULT; |
2676 | if (copy_from_user(&xfern, _xfern, sizeof(xfern))) | 2664 | if (copy_from_user(&xfern, _xfern, sizeof(xfern))) |
2677 | return -EFAULT; | 2665 | return -EFAULT; |
2678 | bufs = kmalloc(sizeof(void *) * runtime->channels, GFP_KERNEL); | 2666 | |
2679 | if (bufs == NULL) | 2667 | bufs = memdup_user(xfern.bufs, |
2680 | return -ENOMEM; | 2668 | sizeof(void *) * runtime->channels); |
2681 | if (copy_from_user(bufs, xfern.bufs, sizeof(void *) * runtime->channels)) { | 2669 | if (IS_ERR(bufs)) |
2682 | kfree(bufs); | 2670 | return PTR_ERR(bufs); |
2683 | return -EFAULT; | ||
2684 | } | ||
2685 | result = snd_pcm_lib_readv(substream, bufs, xfern.frames); | 2671 | result = snd_pcm_lib_readv(substream, bufs, xfern.frames); |
2686 | kfree(bufs); | 2672 | kfree(bufs); |
2687 | __put_user(result, &_xfern->result); | 2673 | __put_user(result, &_xfern->result); |
@@ -3312,18 +3298,12 @@ static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream, | |||
3312 | int err; | 3298 | int err; |
3313 | 3299 | ||
3314 | params = kmalloc(sizeof(*params), GFP_KERNEL); | 3300 | params = kmalloc(sizeof(*params), GFP_KERNEL); |
3315 | if (!params) { | 3301 | if (!params) |
3316 | err = -ENOMEM; | 3302 | return -ENOMEM; |
3317 | goto out; | ||
3318 | } | ||
3319 | oparams = kmalloc(sizeof(*oparams), GFP_KERNEL); | ||
3320 | if (!oparams) { | ||
3321 | err = -ENOMEM; | ||
3322 | goto out; | ||
3323 | } | ||
3324 | 3303 | ||
3325 | if (copy_from_user(oparams, _oparams, sizeof(*oparams))) { | 3304 | oparams = memdup_user(_oparams, sizeof(*oparams)); |
3326 | err = -EFAULT; | 3305 | if (IS_ERR(oparams)) { |
3306 | err = PTR_ERR(oparams); | ||
3327 | goto out; | 3307 | goto out; |
3328 | } | 3308 | } |
3329 | snd_pcm_hw_convert_from_old_params(params, oparams); | 3309 | snd_pcm_hw_convert_from_old_params(params, oparams); |
@@ -3333,9 +3313,10 @@ static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream, | |||
3333 | if (!err) | 3313 | if (!err) |
3334 | err = -EFAULT; | 3314 | err = -EFAULT; |
3335 | } | 3315 | } |
3316 | |||
3317 | kfree(oparams); | ||
3336 | out: | 3318 | out: |
3337 | kfree(params); | 3319 | kfree(params); |
3338 | kfree(oparams); | ||
3339 | return err; | 3320 | return err; |
3340 | } | 3321 | } |
3341 | 3322 | ||
@@ -3347,17 +3328,12 @@ static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream, | |||
3347 | int err; | 3328 | int err; |
3348 | 3329 | ||
3349 | params = kmalloc(sizeof(*params), GFP_KERNEL); | 3330 | params = kmalloc(sizeof(*params), GFP_KERNEL); |
3350 | if (!params) { | 3331 | if (!params) |
3351 | err = -ENOMEM; | 3332 | return -ENOMEM; |
3352 | goto out; | 3333 | |
3353 | } | 3334 | oparams = memdup_user(_oparams, sizeof(*oparams)); |
3354 | oparams = kmalloc(sizeof(*oparams), GFP_KERNEL); | 3335 | if (IS_ERR(oparams)) { |
3355 | if (!oparams) { | 3336 | err = PTR_ERR(oparams); |
3356 | err = -ENOMEM; | ||
3357 | goto out; | ||
3358 | } | ||
3359 | if (copy_from_user(oparams, _oparams, sizeof(*oparams))) { | ||
3360 | err = -EFAULT; | ||
3361 | goto out; | 3337 | goto out; |
3362 | } | 3338 | } |
3363 | snd_pcm_hw_convert_from_old_params(params, oparams); | 3339 | snd_pcm_hw_convert_from_old_params(params, oparams); |
@@ -3367,9 +3343,10 @@ static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream, | |||
3367 | if (!err) | 3343 | if (!err) |
3368 | err = -EFAULT; | 3344 | err = -EFAULT; |
3369 | } | 3345 | } |
3346 | |||
3347 | kfree(oparams); | ||
3370 | out: | 3348 | out: |
3371 | kfree(params); | 3349 | kfree(params); |
3372 | kfree(oparams); | ||
3373 | return err; | 3350 | return err; |
3374 | } | 3351 | } |
3375 | #endif /* CONFIG_SND_SUPPORT_OLD_API */ | 3352 | #endif /* CONFIG_SND_SUPPORT_OLD_API */ |