[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 04 Mar 2008 01:57:31 +0300
From: "Denis V. Lunev" <den@...nvz.org>
To: David Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH 2/4 net-2.6.26] [IPV4]: Cleanup ip_options_compile.
On Mon, 2008-03-03 at 13:24 -0800, David Miller wrote:
> From: "Denis V. Lunev" <den@...nvz.org>
> Date: Mon, 03 Mar 2008 23:54:58 +0300
>
> > Though, it seems to me, that this structure does not came from
> > userspace. At least I do not see a way for this. Could you show me how
> > this can happen?
>
> Sorry, I meant to talk about cases where the options have
> been munged by the input or packet processing path, and
> as a result the kernel intends opt->__data to be used.
>
> For example, we might parse the options of an incoming
> packet, edit out some things we wish to ignore, and leave
> the result in opt->__data for ip_options_compile() to
> process.
>
> cipso_v4_sock_setattr() is a similar case.
>
> Look at how ip_options_get_from_user() works, it copies in the
> user provided IP options into opt->__data and sets
> opt->is_data. This gets passed down to ip_options_get_finish()
> which passes that down to ip_options_compile().
>
> Next, look at ip_cmsg_send(), it calls ip_options_get() which
> copies the data into opt->__data and passes this down to
> ip_options_get_finish() and thus ip_options_compile.
>
> I guess your ip_options_get_finish() changes handle these
> cases, but I cannot prove that the CIPSO is_data setting
> ends up being unused.
>
> I suppose it gets used by ip_options_build() for outgoing
> packets, which assumes that is_data is always set?
is_data is checked in the only place in the code, in the
ip_options_compile. It, in turn is called twice in the original code:
ip_options_get_finish
opt->is_data = 1; <-- !!!
if (optlen && ip_options_compile(opt, NULL))
ip_rcv_options
if (ip_options_compile(NULL, skb)) {
So, (opt && !opt->is_data) is impossible in the orignal code where it is
checked.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists