linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: bkkarthik@pesu.pes.edu
Cc: steffen.klassert@secunet.com, herbert@gondor.apana.org.au,
	kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, kuba@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	gregkh@linuxfoundation.org, skhan@linuxfoundation.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH v2] net: ipv6: fix use-after-free Read in __xfrm6_tunnel_spi_lookup
Date: Tue, 28 Jul 2020 17:36:29 -0700 (PDT)	[thread overview]
Message-ID: <20200728.173629.741539582090080322.davem@davemloft.net> (raw)
In-Reply-To: <20200726030855.q6dfjekazfzl5usw@pesu.pes.edu>

From: B K Karthik <bkkarthik@pesu.pes.edu>
Date: Sun, 26 Jul 2020 08:38:55 +0530

> @@ -103,10 +103,10 @@ static int __xfrm6_tunnel_spi_check(struct net *net, u32 spi)
>  {
>  	struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net);
>  	struct xfrm6_tunnel_spi *x6spi;
> -	int index = xfrm6_tunnel_spi_hash_byspi(spi);
> +	int index = xfrm6_tunnel_spi_hash_byaddr((const xfrm_address_t *)spi);

We can cast this a thousand times to make the compiler quiet, but the
fact is that this function does not expect an integer SPI as an
argument.

It expects a protocol address.

Please stop forcing this fix, I fear you don't understand how this code
works.  Come back to us when you do.

Thank you.

      parent reply	other threads:[~2020-07-29  0:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-26  3:08 [PATCH v2] net: ipv6: fix use-after-free Read in __xfrm6_tunnel_spi_lookup B K Karthik
2020-07-26  5:35 ` Cong Wang
2020-07-26  6:12   ` B K Karthik
2020-07-26 20:07     ` Cong Wang
2020-07-27  5:19       ` B K Karthik
2020-07-27  9:50   ` Steffen Klassert
2020-07-26  7:20 ` kernel test robot
2020-07-26 10:37 ` kernel test robot
2020-07-29  0:36 ` David Miller [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=20200728.173629.741539582090080322.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=bkkarthik@pesu.pes.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=kuba@kernel.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=steffen.klassert@secunet.com \
    --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).