Skip to content

Commit

Permalink
vt_ioctl: return -EFAULT on copy_from_user errors
Browse files Browse the repository at this point in the history
copy_from_user() returns the number of bytes remaining but we want to
return a negative error code here.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
error27 authored and gregkh committed Jun 4, 2010
1 parent c1bfffa commit 3fde85d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/char/vt_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1303,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;
}
Expand Down

0 comments on commit 3fde85d

Please sign in to comment.