public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Mark Rutland <mark.rutland@arm.com>, linux-kernel@vger.kernel.org
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	"David S . Miller" <davem@davemloft.net>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH] ipv4: fib: avoid NULL dereference
Date: Fri, 6 Jul 2018 08:49:14 -0600	[thread overview]
Message-ID: <92672813-153a-eccb-dbee-4b59bbf657f1@gmail.com> (raw)
In-Reply-To: <20180706142836.1822-1-mark.rutland@arm.com>

On 7/6/18 8:28 AM, Mark Rutland wrote:
> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> index 5bc0c89e81e4..8d98c8162554 100644
> --- a/net/ipv4/fib_trie.c
> +++ b/net/ipv4/fib_trie.c
> @@ -497,11 +497,11 @@ static void tnode_free(struct key_vector *tn)
>  	struct callback_head *head = &tn_info(tn)->rcu;
>  
>  	while (head) {
> +		tn = container_of(head, struct tnode, rcu)->kv;
> +
>  		head = head->next;
>  		tnode_free_size += TNODE_SIZE(1ul << tn->bits);
>  		node_free(tn);

you are changing tn before the above 2 calls are made on the tn passed in


> -
> -		tn = container_of(head, struct tnode, rcu)->kv;
>  	}
>  
>  	if (tnode_free_size >= PAGE_SIZE * sync_pages) {
> 


  parent reply	other threads:[~2018-07-06 14:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-06 14:28 [PATCH] ipv4: fib: avoid NULL dereference Mark Rutland
2018-07-06 14:47 ` Eric Dumazet
2018-07-06 14:57   ` Mark Rutland
2018-07-06 15:39     ` Eric Dumazet
2018-07-06 15:54       ` Mark Rutland
2018-07-06 16:20         ` Eric Dumazet
2018-07-06 16:33           ` Mark Rutland
2018-07-06 16:39             ` Eric Dumazet
2018-07-06 14:49 ` David Ahern [this message]
2018-07-06 14:55   ` Mark Rutland

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=92672813-153a-eccb-dbee-4b59bbf657f1@gmail.com \
    --to=dsahern@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=netdev@vger.kernel.org \
    --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