From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH] ipv4: fib: avoid NULL dereference Date: Fri, 6 Jul 2018 08:49:14 -0600 Message-ID: <92672813-153a-eccb-dbee-4b59bbf657f1@gmail.com> References: <20180706142836.1822-1-mark.rutland@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Alexey Kuznetsov , "David S . Miller" , Hideaki YOSHIFUJI , netdev@vger.kernel.org To: Mark Rutland , linux-kernel@vger.kernel.org Return-path: In-Reply-To: <20180706142836.1822-1-mark.rutland@arm.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org 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) { >