lkml.org 
[lkml]   [2019]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] net: key: af_key: Fix possible null-pointer dereferences in pfkey_send_policy_notify()
On Fri, Jul 26, 2019 at 09:15:55PM +0100, Jeremy Sowden wrote:
> On 2019-07-26, at 11:45:14 +0200, Steffen Klassert wrote:
> > On Wed, Jul 24, 2019 at 05:35:09PM +0800, Jia-Ju Bai wrote:
> > >
> > > diff --git a/net/key/af_key.c b/net/key/af_key.c
> > > index b67ed3a8486c..ced54144d5fd 100644
> > > --- a/net/key/af_key.c
> > > +++ b/net/key/af_key.c
> > > @@ -3087,6 +3087,8 @@ static int pfkey_send_policy_notify(struct xfrm_policy *xp, int dir, const struc
> > > case XFRM_MSG_DELPOLICY:
> > > case XFRM_MSG_NEWPOLICY:
> > > case XFRM_MSG_UPDPOLICY:
> > > + if (!xp)
> > > + break;
> >
> > I think this can not happen. Who sends one of these notifications
> > without a pointer to the policy?
>
> I had a quick grep and found two places where km_policy_notify is passed
> NULL as the policy:
>
> $ grep -rn '\<km_policy_notify(NULL,' net/
> net/xfrm/xfrm_user.c:2154: km_policy_notify(NULL, 0, &c);
> net/key/af_key.c:2788: km_policy_notify(NULL, 0, &c);
>
> They occur in xfrm_flush_policy() and pfkey_spdflush() respectively.

Yes, but these two send a XFRM_MSG_FLUSHPOLICY notify.
This does not trigger the code that is changed here.

\
 
 \ /
  Last update: 2019-07-27 10:34    [W:0.073 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site