diff options
Diffstat (limited to 'net/sched/act_ife.c')
-rw-r--r-- | net/sched/act_ife.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index 141a06eeb1e5..e87cd81315e1 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c | |||
@@ -53,7 +53,7 @@ int ife_tlv_meta_encode(void *skbdata, u16 attrtype, u16 dlen, const void *dval) | |||
53 | u32 *tlv = (u32 *)(skbdata); | 53 | u32 *tlv = (u32 *)(skbdata); |
54 | u16 totlen = nla_total_size(dlen); /*alignment + hdr */ | 54 | u16 totlen = nla_total_size(dlen); /*alignment + hdr */ |
55 | char *dptr = (char *)tlv + NLA_HDRLEN; | 55 | char *dptr = (char *)tlv + NLA_HDRLEN; |
56 | u32 htlv = attrtype << 16 | totlen; | 56 | u32 htlv = attrtype << 16 | dlen; |
57 | 57 | ||
58 | *tlv = htonl(htlv); | 58 | *tlv = htonl(htlv); |
59 | memset(dptr, 0, totlen - NLA_HDRLEN); | 59 | memset(dptr, 0, totlen - NLA_HDRLEN); |
@@ -135,7 +135,7 @@ EXPORT_SYMBOL_GPL(ife_release_meta_gen); | |||
135 | 135 | ||
136 | int ife_validate_meta_u32(void *val, int len) | 136 | int ife_validate_meta_u32(void *val, int len) |
137 | { | 137 | { |
138 | if (len == 4) | 138 | if (len == sizeof(u32)) |
139 | return 0; | 139 | return 0; |
140 | 140 | ||
141 | return -EINVAL; | 141 | return -EINVAL; |
@@ -144,8 +144,8 @@ EXPORT_SYMBOL_GPL(ife_validate_meta_u32); | |||
144 | 144 | ||
145 | int ife_validate_meta_u16(void *val, int len) | 145 | int ife_validate_meta_u16(void *val, int len) |
146 | { | 146 | { |
147 | /* length will include padding */ | 147 | /* length will not include padding */ |
148 | if (len == NLA_ALIGN(2)) | 148 | if (len == sizeof(u16)) |
149 | return 0; | 149 | return 0; |
150 | 150 | ||
151 | return -EINVAL; | 151 | return -EINVAL; |
@@ -652,12 +652,14 @@ static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a, | |||
652 | u8 *tlvdata = (u8 *)tlv; | 652 | u8 *tlvdata = (u8 *)tlv; |
653 | u16 mtype = tlv->type; | 653 | u16 mtype = tlv->type; |
654 | u16 mlen = tlv->len; | 654 | u16 mlen = tlv->len; |
655 | u16 alen; | ||
655 | 656 | ||
656 | mtype = ntohs(mtype); | 657 | mtype = ntohs(mtype); |
657 | mlen = ntohs(mlen); | 658 | mlen = ntohs(mlen); |
659 | alen = NLA_ALIGN(mlen); | ||
658 | 660 | ||
659 | if (find_decode_metaid(skb, ife, mtype, (mlen - 4), | 661 | if (find_decode_metaid(skb, ife, mtype, (mlen - NLA_HDRLEN), |
660 | (void *)(tlvdata + 4))) { | 662 | (void *)(tlvdata + NLA_HDRLEN))) { |
661 | /* abuse overlimits to count when we receive metadata | 663 | /* abuse overlimits to count when we receive metadata |
662 | * but dont have an ops for it | 664 | * but dont have an ops for it |
663 | */ | 665 | */ |
@@ -666,8 +668,8 @@ static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a, | |||
666 | ife->tcf_qstats.overlimits++; | 668 | ife->tcf_qstats.overlimits++; |
667 | } | 669 | } |
668 | 670 | ||
669 | tlvdata += mlen; | 671 | tlvdata += alen; |
670 | ifehdrln -= mlen; | 672 | ifehdrln -= alen; |
671 | tlv = (struct meta_tlvhdr *)tlvdata; | 673 | tlv = (struct meta_tlvhdr *)tlvdata; |
672 | } | 674 | } |
673 | 675 | ||