From: David Miller <davem@davemloft.net>
To: weiwan@google.com
Cc: netdev@vger.kernel.org, edumazet@google.com, kafai@fb.com
Subject: Re: [PATCH net-next] ipv6: check fn before doing FIB6_SUBTREE(fn)
Date: Mon, 16 Oct 2017 21:06:34 +0100 (WEST) [thread overview]
Message-ID: <20171016.210634.1944938562694750278.davem@davemloft.net> (raw)
In-Reply-To: <20171013220108.88710-1-tracywwnj@gmail.com>
From: Wei Wang <weiwan@google.com>
Date: Fri, 13 Oct 2017 15:01:08 -0700
> From: Wei Wang <weiwan@google.com>
>
> In fib6_locate(), we need to first make sure fn is not NULL before doing
> FIB6_SUBTREE(fn) to avoid crash.
>
> This fixes the following static checker warning:
> net/ipv6/ip6_fib.c:1462 fib6_locate()
> warn: variable dereferenced before check 'fn' (see line 1459)
>
> net/ipv6/ip6_fib.c
> 1458 if (src_len) {
> 1459 struct fib6_node *subtree = FIB6_SUBTREE(fn);
> ^^^^^^^^^^^^^^^^
> We shifted this dereference
>
> 1460
> 1461 WARN_ON(saddr == NULL);
> 1462 if (fn && subtree)
> ^^
> before the check for NULL.
>
> 1463 fn = fib6_locate_1(subtree, saddr, src_len,
> 1464 offsetof(struct rt6_info, rt6i_src)
>
> Fixes: 66f5d6ce53e6 ("ipv6: replace rwlock with rcu and spinlock in fib6_table")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Wei Wang <weiwan@google.com>
> Acked-by: Eric Dumazet <edumazet@google.com>
Applied.
prev parent reply other threads:[~2017-10-16 20:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 22:01 [PATCH net-next] ipv6: check fn before doing FIB6_SUBTREE(fn) Wei Wang
2017-10-13 22:49 ` Martin KaFai Lau
2017-10-16 20:06 ` 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=20171016.210634.1944938562694750278.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kafai@fb.com \
--cc=netdev@vger.kernel.org \
--cc=weiwan@google.com \
/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).