diff options
author | David S. Miller <davem@davemloft.net> | 2017-08-16 06:23:23 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-16 06:23:23 +0300 |
commit | 463910e2dff580e4e9a678af710b4818b5189691 (patch) | |
tree | 21b4e53cdbec7e5a537ddfc1598fbf17deae57e2 /net/ipv4/fib_semantics.c | |
parent | 22cb7a3ac380ecaab6837670963813599b123a53 (diff) | |
parent | 510c8a899caf095cb13d09d203573deef15db2fe (diff) | |
download | linux-463910e2dff580e4e9a678af710b4818b5189691.tar.xz |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net/ipv4/fib_semantics.c')
-rw-r--r-- | net/ipv4/fib_semantics.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 632b454ce77c..d521caf57385 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -1084,15 +1084,17 @@ struct fib_info *fib_create_info(struct fib_config *cfg, fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); if (!fi) goto failure; - fib_info_cnt++; if (cfg->fc_mx) { fi->fib_metrics = kzalloc(sizeof(*fi->fib_metrics), GFP_KERNEL); - if (!fi->fib_metrics) - goto failure; + if (unlikely(!fi->fib_metrics)) { + kfree(fi); + return ERR_PTR(err); + } atomic_set(&fi->fib_metrics->refcnt, 1); - } else + } else { fi->fib_metrics = (struct dst_metrics *)&dst_default_metrics; - + } + fib_info_cnt++; fi->fib_net = net; fi->fib_protocol = cfg->fc_protocol; fi->fib_scope = cfg->fc_scope; |