diff options
author | Martin Pelikan <pelikan@cvs.openbsd.org> | 2014-06-30 12:47:24 +0000 |
---|---|---|
committer | Martin Pelikan <pelikan@cvs.openbsd.org> | 2014-06-30 12:47:24 +0000 |
commit | 1efcd0cd94d84d1164c7f2aeb7c93bb54ce8141f (patch) | |
tree | 1e7309bb66459cd67be8011c3617ba98a2058101 /sys | |
parent | d42f60da686db34f0a9ce50f75b518047e82e3c2 (diff) |
Attach HFSC after it's been completely initialized.
This fixes the "integer divide fault trap" bug caused by the second malloc
skipping a beat and leaving the amount of allocated queues equal to zero.
tested by me, ok henning mikeb
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/hfsc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/net/hfsc.c b/sys/net/hfsc.c index 7cd6633e79c..2a5b755cf84 100644 --- a/sys/net/hfsc.c +++ b/sys/net/hfsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hfsc.c,v 1.9 2014/04/19 15:58:12 henning Exp $ */ +/* $OpenBSD: hfsc.c,v 1.10 2014/06/30 12:47:23 pelikan Exp $ */ /* * Copyright (c) 2012-2013 Henning Brauer <henning@openbsd.org> @@ -164,14 +164,14 @@ hfsc_attach(struct ifnet *ifp) if (ifp->if_snd.ifq_hfsc != NULL) return (0); - hif = malloc(sizeof(struct hfsc_if), M_DEVBUF, M_WAITOK|M_ZERO); + hif = malloc(sizeof(struct hfsc_if), M_DEVBUF, M_WAITOK | M_ZERO); hif->hif_eligible = hfsc_ellist_alloc(); - hif->hif_ifq = &ifp->if_snd; - ifp->if_snd.ifq_hfsc = hif; - hif->hif_class_tbl = malloc(tblsize, M_DEVBUF, M_WAITOK | M_ZERO); hif->hif_allocated = HFSC_DEFAULT_CLASSES; + hif->hif_ifq = &ifp->if_snd; + ifp->if_snd.ifq_hfsc = hif; + timeout_set(&hif->hif_defer, hfsc_deferred, ifp); /* XXX HRTIMER don't schedule it yet, only when some packets wait. */ timeout_add(&hif->hif_defer, 1); |