@@ -466,6 +466,7 @@ struct tc_netem_corrupt {
};
#define NETEM_DIST_SCALE 8192
+#define NETEM_DIST_MAX 16384
/* DRR */
@@ -321,10 +321,10 @@ static int get_dist_table(struct Qdisc *
struct disttable *d;
int i;
- if (n > 65536)
+ if (n > NETEM_DIST_MAX)
return -EINVAL;
- d = kmalloc(sizeof(*d) + n*sizeof(d->table[0]), GFP_KERNEL);
+ d = vmalloc(sizeof(*d) + n*sizeof(d->table[0]));
if (!d)
return -ENOMEM;
@@ -332,7 +332,7 @@ static int get_dist_table(struct Qdisc *
for (i = 0; i < n; i++)
d->table[i] = data[i];
- kfree(q->delay_dist);
+ vfree(q->delay_dist);
q->delay_dist = d;
return 0;
@@ -559,7 +559,7 @@ static void netem_destroy(struct Qdisc *
qdisc_watchdog_cancel(&q->watchdog);
qdisc_destroy(q->qdisc);
- kfree(q->delay_dist);
+ vfree(q->delay_dist);
}
static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
Fix some issues with distribution table in netem: * Make maximum size visible to user space * Use vmalloc to avoid allocating large physical contiguous memory. (maybe this should use flex array?) Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html