From: David Miller <davem@davemloft.net>
To: hartleys@visionengravers.com
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
kuznet@ms2.inr.ac.ru, pekkas@netcore.fi, jmorris@namei.org,
yoshfuji@linux-ipv6.org, kaber@trash.net
Subject: Re: [PATCH] ipv4/ip_sockglue.c: copy msg_control optval from user to kernel space
Date: Fri, 15 Jan 2010 17:30:44 -0800 (PST) [thread overview]
Message-ID: <20100115.173044.102257749.davem@davemloft.net> (raw)
In-Reply-To: <201001151024.59482.hartleys@visionengravers.com>
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?
next prev parent reply other threads:[~2010-01-16 1:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-15 17:24 [PATCH] ipv4/ip_sockglue.c: copy msg_control optval from user to kernel space H Hartley Sweeten
2010-01-16 1:30 ` David Miller [this message]
[not found] ` <BD79186B4FD85F4B8E60E381CAEE19091E790C@mi8nycmail19.Mi8.com>
2010-01-16 8:50 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100115.173044.102257749.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=hartleys@visionengravers.com \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pekkas@netcore.fi \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).