netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: Jeremy Sowden <jeremy@azazel.net>
Cc: Jia-Ju Bai <baijiaju1990@gmail.com>,
	<herbert@gondor.apana.org.au>, <davem@davemloft.net>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: key: af_key: Fix possible null-pointer dereferences in pfkey_send_policy_notify()
Date: Sat, 27 Jul 2019 10:32:00 +0200	[thread overview]
Message-ID: <20190727083200.GE14601@gauss3.secunet.de> (raw)
In-Reply-To: <20190726201555.GA4745@azazel.net>

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.

      reply	other threads:[~2019-07-27  8:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24  9:35 [PATCH] net: key: af_key: Fix possible null-pointer dereferences in pfkey_send_policy_notify() Jia-Ju Bai
2019-07-26  9:45 ` Steffen Klassert
2019-07-26 20:15   ` Jeremy Sowden
2019-07-27  8:32     ` Steffen Klassert [this message]

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=20190727083200.GE14601@gauss3.secunet.de \
    --to=steffen.klassert@secunet.com \
    --cc=baijiaju1990@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jeremy@azazel.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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).