Skip to contentSkip to conversation

net_sched: sch_skbprio: add message validation to skbprio_change()

PATCH In review Eric Dumazet 2 participants 2 messages May 3, 2020

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

PATCH 1/1 net_sched: sch_skbprio: add message validation to skbprio_change()

Do not assume the attribute has the right size.

Fixes aea5f654e6b7 ("net/sched: add skbprio scheduler")
---
 net/sched/sch_skbprio.c | 3 +++
 1 file changed, 3 insertions(+)
net/sched/sch_skbprio.c +3 -0
index 0fb10abf757962c1e3e6feb8c68dedd9a1808f1b..7a5e4c454715617cb57c6db7de7fdaa9e6886d40 100644
@@ -169,6 +169,9 @@ static int skbprio_change(struct Qdisc *sch, struct nlattr *opt,
 {
 	struct tc_skbprio_qopt *ctl = nla_data(opt);
 
+	if (opt->nla_len != nla_attr_size(sizeof(*ctl)))
+		return -EINVAL;
+
 	sch->limit = ctl->limit;
 	return 0;
 }
Signature · 1 line
2.26.2.526.g744177e7f7-goog