netem: loss model API sizes
Subsystems (4)
The new netem loss model is configured with nested netlink messages. This code is being overly strict about sizes, and is easily confused by padding (or possible future expansion). Also message for gemodel is incorrect.
Signed-off-by Stephen Hemminger <[email protected]>
net/sched/sch_netem.c +3 -3
@@ -548,7 +548,7 @@ static int get_loss_clg(struct Qdisc *sccase NETEM_LOSS_GI : {const struct tc_netem_gimodel *gi =nla_data (la); -if (nla_len (la) !=sizeof (struct tc_netem_gimodel )) { +if (nla_len (la) <sizeof (struct tc_netem_gimodel )) {pr_info ("netem: incorrect gi model size\n" );return -EINVAL ; }
@@ -567,8 +567,8 @@ static int get_loss_clg(struct Qdisc *sccase NETEM_LOSS_GE : {const struct tc_netem_gemodel *ge =nla_data (la); -if (nla_len (la) !=sizeof (struct tc_netem_gemodel )) { -pr_info ("netem: incorrect gi model size\n" ); +if (nla_len (la) <sizeof (struct tc_netem_gemodel )) { +pr_info ("netem: incorrect ge model size\n" );return -EINVAL ; }
From: Stephen Hemminger <[email protected]>
Date: Fri, 23 Dec 2011 11:16:30 -0800
Quoted 6 lines
The new netem loss model is configured with nested netlink messages. This code is being overly strict about sizes, and is easily confused by padding (or possible future expansion). Also message for gemodel is incorrect.
Signed-off-by Stephen Hemminger <[email protected]>
Applied.