提交 864db232 编写于 作者: M Muhammad Usama Anjum 提交者: David S. Miller

net: ipv6: check for validity before dereferencing cfg->fc_nlinfo.nlh

nlh is being checked for validtity two times when it is dereferenced in
this function. Check for validity again when updating the flags through
nlh pointer to make the dereferencing safe.

CC: <stable@vger.kernel.org>
Addresses-Coverity: ("NULL pointer dereference")
Signed-off-by: NMuhammad Usama Anjum <musamaanjum@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2d1b50ab
...@@ -5209,9 +5209,11 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, ...@@ -5209,9 +5209,11 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
* nexthops have been replaced by first new, the rest should * nexthops have been replaced by first new, the rest should
* be added to it. * be added to it.
*/ */
cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | if (cfg->fc_nlinfo.nlh) {
NLM_F_REPLACE); cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL |
cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE; NLM_F_REPLACE);
cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE;
}
nhn++; nhn++;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册