public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] put_user() on struct is not nice
@ 2007-09-26  0:54 Al Viro
  2007-09-26  2:05 ` Rusty Russell
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2007-09-26  0:54 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, rusty


use copy_to_user() instead...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 drivers/lguest/hypercalls.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index db6caac..5ecd60b 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -295,6 +295,6 @@ void write_timestamp(struct lguest *lg)
 {
 	struct timespec now;
 	ktime_get_real_ts(&now);
-	if (put_user(now, &lg->lguest_data->time))
+	if (copy_to_user(&lg->lguest_data->time, &now, sizeof(struct timespec)))
 		kill_guest(lg, "Writing timestamp");
 }
-- 
1.5.3.GIT



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

* Re: [PATCH] put_user() on struct is not nice
  2007-09-26  0:54 [PATCH] put_user() on struct is not nice Al Viro
@ 2007-09-26  2:05 ` Rusty Russell
  2007-09-26  3:56   ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Rusty Russell @ 2007-09-26  2:05 UTC (permalink / raw)
  To: Al Viro; +Cc: torvalds, linux-kernel

On Wed, 2007-09-26 at 01:54 +0100, Al Viro wrote:
> use copy_to_user() instead...

Thanks Al, Jes sent me the same fix which I have queued for for 2.6.24:

From: Jes Sorensen <jes@sgi.com>

Use copy_to_user() when copying a struct timespec to the guest -
put_user() cannot handle two long's in one go on a 64bit arch.

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 drivers/lguest/hypercalls.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

===================================================================
--- linux-2.6.23-rc4.orig/drivers/lguest/hypercalls.c
+++ linux-2.6.23-rc4/drivers/lguest/hypercalls.c
@@ -243,6 +243,6 @@ void write_timestamp(struct lguest *lg)
 {
 	struct timespec now;
 	ktime_get_real_ts(&now);
-	if (put_user(now, &lg->lguest_data->time))
+	if (copy_to_user(&lg->lguest_data->time, &now, sizeof(struct timespec)))
 		kill_guest(lg, "Writing timestamp");
 }



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

* Re: [PATCH] put_user() on struct is not nice
  2007-09-26  2:05 ` Rusty Russell
@ 2007-09-26  3:56   ` Al Viro
  0 siblings, 0 replies; 3+ messages in thread
From: Al Viro @ 2007-09-26  3:56 UTC (permalink / raw)
  To: Rusty Russell; +Cc: torvalds, linux-kernel

On Wed, Sep 26, 2007 at 12:05:46PM +1000, Rusty Russell wrote:
> On Wed, 2007-09-26 at 01:54 +0100, Al Viro wrote:
> > use copy_to_user() instead...
> 
> Thanks Al, Jes sent me the same fix which I have queued for for 2.6.24:

OK, decision on urgency is up to you - post .23 is fine by me...

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

end of thread, other threads:[~2007-09-26  3:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-26  0:54 [PATCH] put_user() on struct is not nice Al Viro
2007-09-26  2:05 ` Rusty Russell
2007-09-26  3:56   ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox