[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20170815.171424.754423204914655743.davem@davemloft.net>
Date: Tue, 15 Aug 2017 17:14:24 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net] ipv4: fix NULL dereference in free_fib_info_rcu()
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Tue, 15 Aug 2017 05:26:17 -0700
> From: Eric Dumazet <edumazet@...gle.com>
>
> If fi->fib_metrics could not be allocated in fib_create_info()
> we attempt to dereference a NULL pointer in free_fib_info_rcu() :
>
> m = fi->fib_metrics;
> if (m != &dst_default_metrics && atomic_dec_and_test(&m->refcnt))
> kfree(m);
>
> Before my recent patch, we used to call kfree(NULL) and nothing wrong
> happened.
>
> Instead of using RCU to defer freeing while we are under memory stress,
> it seems better to take immediate action.
>
> This was reported by syzkaller team.
>
> Fixes: 3fb07daff8e9 ("ipv4: add reference counting to metrics")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Reported-by: Dmitry Vyukov <dvyukov@...gle.com>
Applied and queued up for -stable.
Powered by blists - more mailing lists