hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/net/sched/act_mpls.c
....@@ -133,6 +133,11 @@
133133 {
134134 const u32 *label = nla_data(attr);
135135
136
+ if (nla_len(attr) != sizeof(*label)) {
137
+ NL_SET_ERR_MSG_MOD(extack, "Invalid MPLS label length");
138
+ return -EINVAL;
139
+ }
140
+
136141 if (*label & ~MPLS_LABEL_MASK || *label == MPLS_LABEL_IMPLNULL) {
137142 NL_SET_ERR_MSG_MOD(extack, "MPLS label out of range");
138143 return -EINVAL;
....@@ -144,7 +149,8 @@
144149 static const struct nla_policy mpls_policy[TCA_MPLS_MAX + 1] = {
145150 [TCA_MPLS_PARMS] = NLA_POLICY_EXACT_LEN(sizeof(struct tc_mpls)),
146151 [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),
148154 [TCA_MPLS_TC] = NLA_POLICY_RANGE(NLA_U8, 0, 7),
149155 [TCA_MPLS_TTL] = NLA_POLICY_MIN(NLA_U8, 1),
150156 [TCA_MPLS_BOS] = NLA_POLICY_RANGE(NLA_U8, 0, 1),
....@@ -248,7 +254,7 @@
248254
249255 if (!exists) {
250256 ret = tcf_idr_create(tn, index, est, a,
251
- &act_mpls_ops, bind, true, 0);
257
+ &act_mpls_ops, bind, true, flags);
252258 if (ret) {
253259 tcf_idr_cleanup(tn, index);
254260 return ret;