lkml.org 
[lkml]   [2010]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] ipv4/ip_sockglue.c: copy msg_control optval from user to kernel space
From
From: H Hartley Sweeten <hartleys@visionengravers.com>
Date: Fri, 15 Jan 2010 10:24:59 -0700

> ipv4/ip_sockglue.c: copy msg_control optval from user to kernel space
>
> In do_ip_getsockopt the char __user *optval is used directly in
> IP_PKTOPTIONS for the msg.msg_control and not copied from
> user to kernel address space. This produces a sparse warning:
>
> warning: incorrect type in assignment (different address spaces)
> expected void *msg_control
> got char [noderef] <asn:1>*optval
>
> Fix this by using copy _from_user to set msg.msg_control.
>
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>

This isn't right.

We want the 'optval' pointer itself, not the data it points to, stored
in msg.msg_control

And 'msg_control' is, in this case a user pointer.

It just isn't annotated (along with the rest of struct msghdr) with
"__user" because we mix the usage of this object with kernel and user
pointers.

How did you test your change?


\
 
 \ /
  Last update: 2010-01-16 02:33    [from the cache]
©2003-2011 Jasper Spaans