netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* netem: loss model API sizes
@ 2011-12-23 19:16 Stephen Hemminger
  2011-12-23 22:11 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2011-12-23 19:16 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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 <shemminger@vyatta.com>


--- a/net/sched/sch_netem.c	2011-08-01 14:13:55.000000000 -0700
+++ b/net/sched/sch_netem.c	2011-12-22 16:57:35.310210173 -0800
@@ -548,7 +548,7 @@ static int get_loss_clg(struct Qdisc *sc
 		case 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 *sc
 		case 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;
 			}
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: netem: loss model API sizes
  2011-12-23 19:16 netem: loss model API sizes Stephen Hemminger
@ 2011-12-23 22:11 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-12-23 22:11 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Fri, 23 Dec 2011 11:16:30 -0800

> 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 <shemminger@vyatta.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-23 22:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-23 19:16 netem: loss model API sizes Stephen Hemminger
2011-12-23 22:11 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).