lkml.org 
[lkml]   [2018]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ipv4: fib: avoid NULL dereference
On Fri, Jul 06, 2018 at 08:49:14AM -0600, David Ahern wrote:
> 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

As tn_info(tn) is container_of(kv, struct tnode, tn), the end result is
the same tn value, so this is not a problem.

Thanks,
Mark.

\
 
 \ /
  Last update: 2018-07-06 16:56    [W:0.054 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site