diff options
| -rw-r--r-- | net/ipv6/ip6mr.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 1c05fe604d37..23f364a9efb5 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
| @@ -2119,8 +2119,7 @@ static int __ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb, | |||
| 2119 | { | 2119 | { |
| 2120 | int ct; | 2120 | int ct; |
| 2121 | struct rtnexthop *nhp; | 2121 | struct rtnexthop *nhp; |
| 2122 | u8 *b = skb_tail_pointer(skb); | 2122 | struct nlattr *mp_attr; |
| 2123 | struct rtattr *mp_head; | ||
| 2124 | 2123 | ||
| 2125 | /* If cache is unresolved, don't try to parse IIF and OIF */ | 2124 | /* If cache is unresolved, don't try to parse IIF and OIF */ |
| 2126 | if (c->mf6c_parent >= MAXMIFS) | 2125 | if (c->mf6c_parent >= MAXMIFS) |
| @@ -2129,28 +2128,29 @@ static int __ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb, | |||
| 2129 | if (MIF_EXISTS(mrt, c->mf6c_parent) && | 2128 | if (MIF_EXISTS(mrt, c->mf6c_parent) && |
| 2130 | nla_put_u32(skb, RTA_IIF, mrt->vif6_table[c->mf6c_parent].dev->ifindex) < 0) | 2129 | nla_put_u32(skb, RTA_IIF, mrt->vif6_table[c->mf6c_parent].dev->ifindex) < 0) |
| 2131 | return -EMSGSIZE; | 2130 | return -EMSGSIZE; |
| 2132 | 2131 | mp_attr = nla_nest_start(skb, RTA_MULTIPATH); | |
| 2133 | mp_head = (struct rtattr *)skb_put(skb, RTA_LENGTH(0)); | 2132 | if (mp_attr == NULL) |
| 2133 | return -EMSGSIZE; | ||
| 2134 | 2134 | ||
| 2135 | for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { | 2135 | for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { |
| 2136 | if (MIF_EXISTS(mrt, ct) && c->mfc_un.res.ttls[ct] < 255) { | 2136 | if (MIF_EXISTS(mrt, ct) && c->mfc_un.res.ttls[ct] < 255) { |
| 2137 | if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) | 2137 | nhp = nla_reserve_nohdr(skb, sizeof(*nhp)); |
| 2138 | goto rtattr_failure; | 2138 | if (nhp == NULL) { |
| 2139 | nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); | 2139 | nla_nest_cancel(skb, mp_attr); |
| 2140 | return -EMSGSIZE; | ||
| 2141 | } | ||
| 2142 | |||
| 2140 | nhp->rtnh_flags = 0; | 2143 | nhp->rtnh_flags = 0; |
| 2141 | nhp->rtnh_hops = c->mfc_un.res.ttls[ct]; | 2144 | nhp->rtnh_hops = c->mfc_un.res.ttls[ct]; |
| 2142 | nhp->rtnh_ifindex = mrt->vif6_table[ct].dev->ifindex; | 2145 | nhp->rtnh_ifindex = mrt->vif6_table[ct].dev->ifindex; |
| 2143 | nhp->rtnh_len = sizeof(*nhp); | 2146 | nhp->rtnh_len = sizeof(*nhp); |
| 2144 | } | 2147 | } |
| 2145 | } | 2148 | } |
| 2146 | mp_head->rta_type = RTA_MULTIPATH; | 2149 | |
| 2147 | mp_head->rta_len = skb_tail_pointer(skb) - (u8 *)mp_head; | 2150 | nla_nest_end(skb, mp_attr); |
| 2151 | |||
| 2148 | rtm->rtm_type = RTN_MULTICAST; | 2152 | rtm->rtm_type = RTN_MULTICAST; |
| 2149 | return 1; | 2153 | return 1; |
| 2150 | |||
| 2151 | rtattr_failure: | ||
| 2152 | nlmsg_trim(skb, b); | ||
| 2153 | return -EMSGSIZE; | ||
| 2154 | } | 2154 | } |
| 2155 | 2155 | ||
| 2156 | int ip6mr_get_route(struct net *net, | 2156 | int ip6mr_get_route(struct net *net, |
