diff options
author | Sergey Popovich <popovich_sergei@mail.ru> | 2014-05-06 11:23:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-07 17:14:32 -0400 |
commit | aeefa1ecfc799b0ea2c4979617f14cecd5cccbfd (patch) | |
tree | 89e426b9a1e402fae250984d2083c5148358b5bb | |
parent | 7fc1c5f3ca2ade64c8a7c78a1df3130f74f383e4 (diff) |
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>
-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) | |||
821 | fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); | 821 | fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); |
822 | if (fi == NULL) | 822 | if (fi == NULL) |
823 | goto failure; | 823 | goto failure; |
824 | fib_info_cnt++; | ||
824 | if (cfg->fc_mx) { | 825 | if (cfg->fc_mx) { |
825 | fi->fib_metrics = kzalloc(sizeof(u32) * RTAX_MAX, GFP_KERNEL); | 826 | fi->fib_metrics = kzalloc(sizeof(u32) * RTAX_MAX, GFP_KERNEL); |
826 | if (!fi->fib_metrics) | 827 | if (!fi->fib_metrics) |
827 | goto failure; | 828 | goto failure; |
828 | } else | 829 | } else |
829 | fi->fib_metrics = (u32 *) dst_default_metrics; | 830 | fi->fib_metrics = (u32 *) dst_default_metrics; |
830 | fib_info_cnt++; | ||
831 | 831 | ||
832 | fi->fib_net = hold_net(net); | 832 | fi->fib_net = hold_net(net); |
833 | fi->fib_protocol = cfg->fc_protocol; | 833 | fi->fib_protocol = cfg->fc_protocol; |