Skip to contentSkip to conversation

add missing validation of 'skip_hw/skip_sw'

PATCH In review Davide Caratti 3 participants 6 messages Feb 11, 2020 – Feb 13, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover add missing validation of 'skip_hw/skip_sw'

ensure that all classifiers currently supporting HW offload validate the 'flags' parameter provided by user:

- patch 1/2 fixes cls_matchall
- patch 2/2 fixes cls_flower

Davide Caratti (2):
net/sched: matchall: add missing validation of TCA_MATCHALL_FLAGS net/sched: flower: add missing validation of TCA_FLOWER_FLAGS

 net/sched/cls_flower.c   | 1 +
 net/sched/cls_matchall.c | 1 +
 2 files changed, 2 insertions(+)
Signature · 1 line
2.24.1
#1 lore raw

PATCH 1/2 net/sched: matchall: add missing validation of TCA_MATCHALL_FLAGS

unlike other classifiers that can be offloaded (i.e. users can set flags like 'skip_hw' and 'skip_sw'), 'cls_matchall' doesn't validate the size of netlink attribute 'TCA_MATCHALL_FLAGS' provided by user: add a proper entry to mall_policy.

Fixes b87f7936a932 ("net/sched: Add match-all classifier hw offloading.")
---
 net/sched/cls_matchall.c | 1 +
 1 file changed, 1 insertion(+)
net/sched/cls_matchall.c +1 -0
index 039cc86974f4..610a0b728161 100644
@@ -157,6 +157,7 @@ static void *mall_get(struct tcf_proto *tp, u32 handle)
 static const struct nla_policy mall_policy[TCA_MATCHALL_MAX + 1] = {
 	[TCA_MATCHALL_UNSPEC]		= { .type = NLA_UNSPEC },
 	[TCA_MATCHALL_CLASSID]		= { .type = NLA_U32 },
+	[TCA_MATCHALL_FLAGS]		= { .type = NLA_U32 },
 };
 
 static int mall_set_parms(struct net *net, struct tcf_proto *tp,
Signature · 1 line
2.24.1
#3 lore raw

PATCH 2/2 net/sched: flower: add missing validation of TCA_FLOWER_FLAGS

In reply to Davide Caratti

unlike other classifiers that can be offloaded (i.e. users can set flags like 'skip_hw' and 'skip_sw'), 'cls_flower' doesn't validate the size of netlink attribute 'TCA_FLOWER_FLAGS' provided by user: add a proper entry to fl_policy.

Fixes 5b33f48842fa ("net/flower: Introduce hardware offload support")
---
 net/sched/cls_flower.c | 1 +
 1 file changed, 1 insertion(+)
net/sched/cls_flower.c +1 -0
index f9c0d1e8d380..7e54d2ab5254 100644
@@ -691,6 +691,7 @@ static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = {
 					    .len = 128 / BITS_PER_BYTE },
 	[TCA_FLOWER_KEY_CT_LABELS_MASK]	= { .type = NLA_BINARY,
 					    .len = 128 / BITS_PER_BYTE },
+	[TCA_FLOWER_FLAGS]		= { .type = NLA_U32 },
 };
 
 static const struct nla_policy
Signature · 1 line
2.24.1
maintainer Acked-by on v1 1/2
#2 lore raw

Re: [PATCH net 1/2] net/sched: matchall: add missing validation of TCA_MATCHALL_FLAGS

In reply to Davide Caratti
Quoted 7 lines · Tue, Feb 11, 2020 at 07:33:39PM CET, [email protected] wrote:

unlike other classifiers that can be offloaded (i.e. users can set flags like 'skip_hw' and 'skip_sw'), 'cls_matchall' doesn't validate the size of netlink attribute 'TCA_MATCHALL_FLAGS' provided by user: add a proper entry to mall_policy.

Fixes b87f7936a932 ("net/sched: Add match-all classifier hw offloading.")

I was actually about to send these :)
Thanks

maintainer Acked-by on v1 2/2
#4 lore raw

Re: [PATCH net 2/2] net/sched: flower: add missing validation of TCA_FLOWER_FLAGS

In reply to Davide Caratti
Quoted 7 lines · Tue, Feb 11, 2020 at 07:33:40PM CET, [email protected] wrote:

unlike other classifiers that can be offloaded (i.e. users can set flags like 'skip_hw' and 'skip_sw'), 'cls_flower' doesn't validate the size of netlink attribute 'TCA_FLOWER_FLAGS' provided by user: add a proper entry to fl_policy.

Fixes 5b33f48842fa ("net/flower: Introduce hardware offload support")
maintainer
#5 lore raw
In reply to Davide Caratti

From: Davide Caratti <[email protected]>
Date: Tue, 11 Feb 2020 19:33:38 +0100

Quoted 5 lines

ensure that all classifiers currently supporting HW offload validate the 'flags' parameter provided by user:

- patch 1/2 fixes cls_matchall
- patch 2/2 fixes cls_flower

Series applied and queued up for -stable, thanks.