Merge branch 'v4l_for_2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/mcheha...
[safe/jmp/linux-2.6] / drivers / char / vt_ioctl.c
index 30b5d12..cb19dbc 100644 (file)
@@ -103,8 +103,8 @@ void vt_event_post(unsigned int event, unsigned int old, unsigned int new)
                ve->event.event = event;
                /* kernel view is consoles 0..n-1, user space view is
                   console 1..n with 0 meaning current, so we must bias */
-               ve->event.old = old + 1;
-               ve->event.new = new + 1;
+               ve->event.oldev = old + 1;
+               ve->event.newev = new + 1;
                wake = 1;
                ve->done = 1;
        }
@@ -186,7 +186,7 @@ int vt_waitactive(int n)
                vt_event_wait(&vw);
                if (vw.done == 0)
                        return -EINTR;
-       } while (vw.event.new != n);
+       } while (vw.event.newev != n);
        return 0;
 }
 
@@ -981,8 +981,10 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
                        goto eperm;
 
                if (copy_from_user(&vsa, (struct vt_setactivate __user *)arg,
-                                               sizeof(struct vt_setactivate)))
-                       return -EFAULT;
+                                       sizeof(struct vt_setactivate))) {
+                       ret = -EFAULT;
+                       goto out;
+               }
                if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)
                        ret = -ENXIO;
                else {
@@ -1301,7 +1303,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
                if (!perm)
                        goto eperm;
                ret = copy_from_user(&ui, up, sizeof(struct unimapinit));
-               if (!ret)
+               if (ret)
+                       ret = -EFAULT;
+               else
                        con_clear_unimap(vc, &ui);
                break;
              }
@@ -1530,7 +1534,7 @@ long vt_compat_ioctl(struct tty_struct *tty, struct file * file,
 
        case PIO_UNIMAP:
        case GIO_UNIMAP:
-               ret = do_unimap_ioctl(cmd, up, perm, vc);
+               ret = compat_unimap_ioctl(cmd, up, perm, vc);
                break;
 
        /*
@@ -1757,7 +1761,7 @@ int vt_move_to_console(unsigned int vt, int alloc)
                return -EIO;
        }
        release_console_sem();
-       if (vt_waitactive(vt)) {
+       if (vt_waitactive(vt + 1)) {
                pr_debug("Suspend: Can't switch VCs.");
                return -EINTR;
        }