* Re: [PATCH] potential NULL pointer deref in net/key/af_key.c
[not found] <200611272244.08189.jesper.juhl@gmail.com>
@ 2006-11-27 21:53 ` David Miller
2006-11-27 21:56 ` Jesper Juhl
0 siblings, 1 reply; 2+ messages in thread
From: David Miller @ 2006-11-27 21:53 UTC (permalink / raw)
To: jesper.juhl
Cc: linux-kernel, netdev, gem, davem, kuznet, kunihiro, miyazawa, derek
From: Jesper Juhl <jesper.juhl@gmail.com>
Date: Mon, 27 Nov 2006 22:44:07 +0100
> In net/key/af_key.c::pfkey_send_policy_notify() there's a check at the
> beginning of the function :
>
> if (xp && xp->type != XFRM_POLICY_TYPE_MAIN)
>
> this implies that 'xp' may be null when the function is called. But later
> on in the function we have this code :
>
> return key_notify_policy(xp, dir, c);
>
> key_notify_policy() passes 'xp' to pfkey_xfrm_policy2msg_prep() that pass
> it on to pfkey_xfrm_policy2msg_size() which dereferences it.
> key_notify_policy() also passes 'xp' to pfkey_xfrm_policy2msg() which
> also dereferences it.
>
> So, in pfkey_send_policy_notify() in the cases where we end up calling
> key_notify_policy(), we should test 'xp' for NULL.
>
> (note: patch is compile tested only)
>
>
> Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
We really need to teach your automated tool about context.
The NULL case can only occur for XFRM_MSG_FLUSHPOLICY.
Look at the km_policy_notify() call sites. You can even see from the
net/xfrm/xfrm_user.c:xfrm_send_policy_notify() implementation of this
callback that for XFRM_MSG_FLUSHPOLICY the "xp" argument is ignored.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] potential NULL pointer deref in net/key/af_key.c
2006-11-27 21:53 ` [PATCH] potential NULL pointer deref in net/key/af_key.c David Miller
@ 2006-11-27 21:56 ` Jesper Juhl
0 siblings, 0 replies; 2+ messages in thread
From: Jesper Juhl @ 2006-11-27 21:56 UTC (permalink / raw)
To: David Miller
Cc: linux-kernel, netdev, gem, davem, kuznet, kunihiro, miyazawa, derek
On 27/11/06, David Miller <davem@davemloft.net> wrote:
> From: Jesper Juhl <jesper.juhl@gmail.com>
> Date: Mon, 27 Nov 2006 22:44:07 +0100
>
> > In net/key/af_key.c::pfkey_send_policy_notify() there's a check at the
> > beginning of the function :
> >
> > if (xp && xp->type != XFRM_POLICY_TYPE_MAIN)
> >
> > this implies that 'xp' may be null when the function is called. But later
> > on in the function we have this code :
> >
> > return key_notify_policy(xp, dir, c);
> >
> > key_notify_policy() passes 'xp' to pfkey_xfrm_policy2msg_prep() that pass
> > it on to pfkey_xfrm_policy2msg_size() which dereferences it.
> > key_notify_policy() also passes 'xp' to pfkey_xfrm_policy2msg() which
> > also dereferences it.
> >
> > So, in pfkey_send_policy_notify() in the cases where we end up calling
> > key_notify_policy(), we should test 'xp' for NULL.
> >
> > (note: patch is compile tested only)
> >
> >
> > Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
>
> We really need to teach your automated tool about context.
>
> The NULL case can only occur for XFRM_MSG_FLUSHPOLICY.
>
> Look at the km_policy_notify() call sites. You can even see from the
> net/xfrm/xfrm_user.c:xfrm_send_policy_notify() implementation of this
> callback that for XFRM_MSG_FLUSHPOLICY the "xp" argument is ignored.
>
Arrgh, you are right. I really need to check call sites more carefully :(
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-27 21:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <200611272244.08189.jesper.juhl@gmail.com>
2006-11-27 21:53 ` [PATCH] potential NULL pointer deref in net/key/af_key.c David Miller
2006-11-27 21:56 ` Jesper Juhl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®