Skip to content

Commit

Permalink
ipv6: fix return value check in fib6_add()
Browse files Browse the repository at this point in the history
In case of error, the function fib6_add_1() returns ERR_PTR()
or NULL pointer. The ERR_PTR() case check is missing in fib6_add().

dpatch engine is used to generated this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wei Yongjun authored and David S. Miller committed Sep 21, 2012
1 parent 185d4c8 commit f950c0e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/ipv6/ip6_fib.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,10 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info)
offsetof(struct rt6_info, rt6i_src),
allow_create, replace_required);

if (IS_ERR(sn)) {
err = PTR_ERR(sn);
sn = NULL;
}
if (!sn) {
/* If it is failed, discard just allocated
root, and then (in st_failure) stale node
Expand Down

0 comments on commit f950c0e

Please sign in to comment.