]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] fix security leaks and a crash in es1370
authorAlan Cox <alan@lxorguk.ukuu.org.uk>
Fri, 11 Jul 2003 13:50:18 +0000 (06:50 -0700)
committerSteve French <cifs.adm@hostme.bitkeeper.com>
Fri, 11 Jul 2003 13:50:18 +0000 (06:50 -0700)
sound/oss/es1370.c

index c7c3f7ec9152b9f0a0988032c26a6eeea4e87d0b..d583a7f19edf7071c89f0fb9115fb6c2b38460ba 100644 (file)
@@ -889,8 +889,8 @@ static int mixer_ioctl(struct es1370_state *s, unsigned int cmd, unsigned long a
        }
         if (cmd == SOUND_MIXER_INFO) {
                mixer_info info;
-               strlcpy(info.id, "ES1370", sizeof(info.id));
-               strlcpy(info.name, "Ensoniq ES1370", sizeof(info.name));
+               strncpy(info.id, "ES1370", sizeof(info.id));
+               strncpy(info.name, "Ensoniq ES1370", sizeof(info.name));
                info.modify_counter = s->mix.modcnt;
                if (copy_to_user((void *)arg, &info, sizeof(info)))
                        return -EFAULT;
@@ -898,8 +898,8 @@ static int mixer_ioctl(struct es1370_state *s, unsigned int cmd, unsigned long a
        }
        if (cmd == SOUND_OLD_MIXER_INFO) {
                _old_mixer_info info;
-               strlcpy(info.id, "ES1370", sizeof(info.id));
-               strlcpy(info.name, "Ensoniq ES1370", sizeof(info.name));
+               strncpy(info.id, "ES1370", sizeof(info.id));
+               strncpy(info.name, "Ensoniq ES1370", sizeof(info.name));
                if (copy_to_user((void *)arg, &info, sizeof(info)))
                        return -EFAULT;
                return 0;
@@ -2484,12 +2484,8 @@ static int es1370_midi_release(struct inode *inode, struct file *file)
                                break;
                        if (signal_pending(current))
                                break;
-                       if (file->f_flags & O_NONBLOCK) {
-                               remove_wait_queue(&s->midi.owait, &wait);
-                               set_current_state(TASK_RUNNING);
-                               unlock_kernel();
-                               return -EBUSY;
-                       }
+                       if (file->f_flags & O_NONBLOCK) 
+                               break;
                        tmo = (count * HZ) / 3100;
                        if (!schedule_timeout(tmo ? : 1) && tmo)
                                DBG(printk(KERN_DEBUG "es1370: midi timed out??\n");)