aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/ip6_fib.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index b2d1838897c9..db4984e13f2f 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -633,18 +633,17 @@ static bool rt6_qualify_for_ecmp(struct rt6_info *rt)
633static int fib6_commit_metrics(struct dst_entry *dst, 633static int fib6_commit_metrics(struct dst_entry *dst,
634 struct nlattr *mx, int mx_len) 634 struct nlattr *mx, int mx_len)
635{ 635{
636 bool dst_host = dst->flags & DST_HOST;
636 struct nlattr *nla; 637 struct nlattr *nla;
637 int remaining; 638 int remaining;
638 u32 *mp; 639 u32 *mp;
639 640
640 if (dst->flags & DST_HOST) { 641 mp = dst_host ? dst_metrics_write_ptr(dst) :
641 mp = dst_metrics_write_ptr(dst); 642 kzalloc(sizeof(u32) * RTAX_MAX, GFP_ATOMIC);
642 } else { 643 if (unlikely(!mp))
643 mp = kzalloc(sizeof(u32) * RTAX_MAX, GFP_ATOMIC); 644 return -ENOMEM;
644 if (!mp) 645 if (!dst_host)
645 return -ENOMEM;
646 dst_init_metrics(dst, mp, 0); 646 dst_init_metrics(dst, mp, 0);
647 }
648 647
649 nla_for_each_attr(nla, mx, mx_len, remaining) { 648 nla_for_each_attr(nla, mx, mx_len, remaining) {
650 int type = nla_type(nla); 649 int type = nla_type(nla);