aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/soundcard.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/oss/soundcard.c')
-rw-r--r--sound/oss/soundcard.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index c62530943888..fde7c12fe5da 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -328,11 +328,11 @@ static int sound_mixer_ioctl(int mixdev, unsigned int cmd, void __user *arg)
328 return mixer_devs[mixdev]->ioctl(mixdev, cmd, arg); 328 return mixer_devs[mixdev]->ioctl(mixdev, cmd, arg);
329} 329}
330 330
331static int sound_ioctl(struct inode *inode, struct file *file, 331static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
332 unsigned int cmd, unsigned long arg)
333{ 332{
334 int len = 0, dtype; 333 int len = 0, dtype;
335 int dev = iminor(inode); 334 int dev = iminor(file->f_dentry->d_inode);
335 long ret = -EINVAL;
336 void __user *p = (void __user *)arg; 336 void __user *p = (void __user *)arg;
337 337
338 if (_SIOC_DIR(cmd) != _SIOC_NONE && _SIOC_DIR(cmd) != 0) { 338 if (_SIOC_DIR(cmd) != _SIOC_NONE && _SIOC_DIR(cmd) != 0) {
@@ -353,6 +353,7 @@ static int sound_ioctl(struct inode *inode, struct file *file,
353 if (cmd == OSS_GETVERSION) 353 if (cmd == OSS_GETVERSION)
354 return __put_user(SOUND_VERSION, (int __user *)p); 354 return __put_user(SOUND_VERSION, (int __user *)p);
355 355
356 lock_kernel();
356 if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */ 357 if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */
357 (dev & 0x0f) != SND_DEV_CTL) { 358 (dev & 0x0f) != SND_DEV_CTL) {
358 dtype = dev & 0x0f; 359 dtype = dev & 0x0f;
@@ -360,24 +361,31 @@ static int sound_ioctl(struct inode *inode, struct file *file,
360 case SND_DEV_DSP: 361 case SND_DEV_DSP:
361 case SND_DEV_DSP16: 362 case SND_DEV_DSP16:
362 case SND_DEV_AUDIO: 363 case SND_DEV_AUDIO:
363 return sound_mixer_ioctl(audio_devs[dev >> 4]->mixer_dev, 364 ret = sound_mixer_ioctl(audio_devs[dev >> 4]->mixer_dev,
364 cmd, p); 365 cmd, p);
365 366 break;
366 default: 367 default:
367 return sound_mixer_ioctl(dev >> 4, cmd, p); 368 ret = sound_mixer_ioctl(dev >> 4, cmd, p);
369 break;
368 } 370 }
371 unlock_kernel();
372 return ret;
369 } 373 }
374
370 switch (dev & 0x0f) { 375 switch (dev & 0x0f) {
371 case SND_DEV_CTL: 376 case SND_DEV_CTL:
372 if (cmd == SOUND_MIXER_GETLEVELS) 377 if (cmd == SOUND_MIXER_GETLEVELS)
373 return get_mixer_levels(p); 378 ret = get_mixer_levels(p);
374 if (cmd == SOUND_MIXER_SETLEVELS) 379 else if (cmd == SOUND_MIXER_SETLEVELS)
375 return set_mixer_levels(p); 380 ret = set_mixer_levels(p);
376 return sound_mixer_ioctl(dev >> 4, cmd, p); 381 else
382 ret = sound_mixer_ioctl(dev >> 4, cmd, p);
383 break;
377 384
378 case SND_DEV_SEQ: 385 case SND_DEV_SEQ:
379 case SND_DEV_SEQ2: 386 case SND_DEV_SEQ2:
380 return sequencer_ioctl(dev, file, cmd, p); 387 ret = sequencer_ioctl(dev, file, cmd, p);
388 break;
381 389
382 case SND_DEV_DSP: 390 case SND_DEV_DSP:
383 case SND_DEV_DSP16: 391 case SND_DEV_DSP16:
@@ -390,7 +398,8 @@ static int sound_ioctl(struct inode *inode, struct file *file,
390 break; 398 break;
391 399
392 } 400 }
393 return -EINVAL; 401 unlock_kernel();
402 return ret;
394} 403}
395 404
396static unsigned int sound_poll(struct file *file, poll_table * wait) 405static unsigned int sound_poll(struct file *file, poll_table * wait)
@@ -490,7 +499,7 @@ const struct file_operations oss_sound_fops = {
490 .read = sound_read, 499 .read = sound_read,
491 .write = sound_write, 500 .write = sound_write,
492 .poll = sound_poll, 501 .poll = sound_poll,
493 .ioctl = sound_ioctl, 502 .unlocked_ioctl = sound_ioctl,
494 .mmap = sound_mmap, 503 .mmap = sound_mmap,
495 .open = sound_open, 504 .open = sound_open,
496 .release = sound_release, 505 .release = sound_release,