| .. | .. |
|---|
| 133 | 133 | { |
|---|
| 134 | 134 | const u32 *label = nla_data(attr); |
|---|
| 135 | 135 | |
|---|
| 136 | + if (nla_len(attr) != sizeof(*label)) { |
|---|
| 137 | + NL_SET_ERR_MSG_MOD(extack, "Invalid MPLS label length"); |
|---|
| 138 | + return -EINVAL; |
|---|
| 139 | + } |
|---|
| 140 | + |
|---|
| 136 | 141 | if (*label & ~MPLS_LABEL_MASK || *label == MPLS_LABEL_IMPLNULL) { |
|---|
| 137 | 142 | NL_SET_ERR_MSG_MOD(extack, "MPLS label out of range"); |
|---|
| 138 | 143 | return -EINVAL; |
|---|
| .. | .. |
|---|
| 144 | 149 | static const struct nla_policy mpls_policy[TCA_MPLS_MAX + 1] = { |
|---|
| 145 | 150 | [TCA_MPLS_PARMS] = NLA_POLICY_EXACT_LEN(sizeof(struct tc_mpls)), |
|---|
| 146 | 151 | [TCA_MPLS_PROTO] = { .type = NLA_U16 }, |
|---|
| 147 | | - [TCA_MPLS_LABEL] = NLA_POLICY_VALIDATE_FN(NLA_U32, valid_label), |
|---|
| 152 | + [TCA_MPLS_LABEL] = NLA_POLICY_VALIDATE_FN(NLA_BINARY, |
|---|
| 153 | + valid_label), |
|---|
| 148 | 154 | [TCA_MPLS_TC] = NLA_POLICY_RANGE(NLA_U8, 0, 7), |
|---|
| 149 | 155 | [TCA_MPLS_TTL] = NLA_POLICY_MIN(NLA_U8, 1), |
|---|
| 150 | 156 | [TCA_MPLS_BOS] = NLA_POLICY_RANGE(NLA_U8, 0, 1), |
|---|
| .. | .. |
|---|
| 248 | 254 | |
|---|
| 249 | 255 | if (!exists) { |
|---|
| 250 | 256 | ret = tcf_idr_create(tn, index, est, a, |
|---|
| 251 | | - &act_mpls_ops, bind, true, 0); |
|---|
| 257 | + &act_mpls_ops, bind, true, flags); |
|---|
| 252 | 258 | if (ret) { |
|---|
| 253 | 259 | tcf_idr_cleanup(tn, index); |
|---|
| 254 | 260 | return ret; |
|---|