diff options
author | Sergey Popovich <popovich_sergei@mail.ru> | 2014-05-06 17:23:08 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-07 23:14:32 +0200 |
commit | aeefa1ecfc799b0ea2c4979617f14cecd5cccbfd (patch) | |
tree | 89e426b9a1e402fae250984d2083c5148358b5bb /net/ipv4/fib_semantics.c | |
parent | Merge branch 'qlcnic_net' (diff) | |
download | linux-aeefa1ecfc799b0ea2c4979617f14cecd5cccbfd.tar.xz linux-aeefa1ecfc799b0ea2c4979617f14cecd5cccbfd.zip |
ipv4: fib_semantics: increment fib_info_cnt after fib_info allocation
Increment fib_info_cnt in fib_create_info() right after successfuly
alllocating fib_info structure, overwise fib_metrics allocation failure
leads to fib_info_cnt incorrectly decremented in free_fib_info(), called
on error path from fib_create_info().
Signed-off-by: Sergey Popovich <popovich_sergei@mail.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_semantics.c')
-rw-r--r-- | net/ipv4/fib_semantics.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 8a043f03c88e..b10cd43a4722 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -821,13 +821,13 @@ struct fib_info *fib_create_info(struct fib_config *cfg) fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); if (fi == NULL) goto failure; + fib_info_cnt++; if (cfg->fc_mx) { fi->fib_metrics = kzalloc(sizeof(u32) * RTAX_MAX, GFP_KERNEL); if (!fi->fib_metrics) goto failure; } else fi->fib_metrics = (u32 *) dst_default_metrics; - fib_info_cnt++; fi->fib_net = hold_net(net); fi->fib_protocol = cfg->fc_protocol; |