kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] vt_ioctl: return -EFAULT on copy_from_user errors
@ 2010-06-04 10:20 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2010-06-04 10:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Alan Cox, Arnd Bergmann, linux-kernel, kernel-janitors

copy_from_user() returns the number of bytes remaining but we want to
return a negative error code here.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 6aa1028..cb19dbc 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -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;
 	      }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-06-04 10:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-04 10:20 [patch] vt_ioctl: return -EFAULT on copy_from_user errors Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).