linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] fcntl: return -EFAULT if copy_to_user fails
@ 2010-06-03 10:04 Dan Carpenter
  2010-06-03 10:22 ` Takuya Yoshikawa
       [not found] ` <4C07826A.6060302@oss.ntt.co.jp>
  0 siblings, 2 replies; 13+ messages in thread
From: Dan Carpenter @ 2010-06-03 10:04 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Alexander Viro, Andrew Morton, Oleg Nesterov, Jens Axboe,
	Greg Kroah-Hartman, Peter Zijlstra, linux-fsdevel, linux-kernel

copy_to_user() returns the number of bytes remaining, but we want to
return -EFAULT.

	ret = fcntl(fd, F_SETOWN_EX, NULL);

With the original code ret would be 8 here.

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

diff --git a/fs/fcntl.c b/fs/fcntl.c
index f74d270..0ea7b0f 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -274,7 +274,7 @@ static int f_setown_ex(struct file *filp, unsigned long arg)
 
 	ret = copy_from_user(&owner, owner_p, sizeof(owner));
 	if (ret)
-		return ret;
+		return -EFAULT;
 
 	switch (owner.type) {
 	case F_OWNER_TID:

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-06-04 11:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-03 10:04 [patch] fcntl: return -EFAULT if copy_to_user fails Dan Carpenter
2010-06-03 10:22 ` Takuya Yoshikawa
     [not found] ` <4C07826A.6060302@oss.ntt.co.jp>
2010-06-03 10:35   ` [patch v2] " Dan Carpenter
2010-06-03 10:42     ` Peter Zijlstra
2010-06-03 11:59     ` Jens Axboe
     [not found]     ` <4C07990A.8080508@fusionio.com>
2010-06-03 12:16       ` Takuya Yoshikawa
2010-06-03 12:38         ` Eric Dumazet
2010-06-03 13:10           ` Nick Piggin
2010-06-03 13:24             ` Takuya Yoshikawa
2010-06-03 13:42               ` Eric Dumazet
2010-06-03 12:45         ` Dan Carpenter
2010-06-04 11:14           ` Dan Carpenter
2010-06-03 12:45   ` [patch] " Al Viro

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).