diff options
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 b8d18171cca3..ec3a9ce281a6 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -1083,15 +1083,17 @@ struct fib_info *fib_create_info(struct fib_config *cfg, | |||
1083 | fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); | 1083 | fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); |
1084 | if (!fi) | 1084 | if (!fi) |
1085 | goto failure; | 1085 | goto failure; |
1086 | fib_info_cnt++; | ||
1087 | if (cfg->fc_mx) { | 1086 | if (cfg->fc_mx) { |
1088 | fi->fib_metrics = kzalloc(sizeof(*fi->fib_metrics), GFP_KERNEL); | 1087 | fi->fib_metrics = kzalloc(sizeof(*fi->fib_metrics), GFP_KERNEL); |
1089 | if (!fi->fib_metrics) | 1088 | if (unlikely(!fi->fib_metrics)) { |
1090 | goto failure; | 1089 | kfree(fi); |
1090 | return ERR_PTR(err); | ||
1091 | } | ||
1091 | atomic_set(&fi->fib_metrics->refcnt, 1); | 1092 | atomic_set(&fi->fib_metrics->refcnt, 1); |
1092 | } else | 1093 | } else { |
1093 | fi->fib_metrics = (struct dst_metrics *)&dst_default_metrics; | 1094 | fi->fib_metrics = (struct dst_metrics *)&dst_default_metrics; |
1094 | 1095 | } | |
1096 | fib_info_cnt++; | ||
1095 | fi->fib_net = net; | 1097 | fi->fib_net = net; |
1096 | fi->fib_protocol = cfg->fc_protocol; | 1098 | fi->fib_protocol = cfg->fc_protocol; |
1097 | fi->fib_scope = cfg->fc_scope; | 1099 | fi->fib_scope = cfg->fc_scope; |