]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r302667
authortruckman <truckman@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 18 Jul 2016 06:09:52 +0000 (06:09 +0000)
committertruckman <truckman@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 18 Jul 2016 06:09:52 +0000 (06:09 +0000)
commitf95790cf43d33f6feb61c88f81ae3dd300457c5f
tree3038545c120d0bdefa08a76b41030f37d4841949
parent018d1ef4fcc3b09b41f5209a5a9394c23a058ce0
MFC r302667

Fix problems in the FQ-PIE AQM cleanup code that could leak memory or
cause a crash.

Because dummynet calls pie_cleanup() while holding a mutex, pie_cleanup()
is not able to use callout_drain() to make sure that all callouts are
finished before it returns, and callout_stop() is not sufficient to make
that guarantee.  After pie_cleanup() returns, dummynet will free a
structure that any remaining callouts will want to access.

Fix these problems by allocating a separate structure to contain the
data used by the callouts.  In pie_cleanup(), call callout_reset_sbt()
to replace the normal callout with a cleanup callout that does the cleanup
work for each sub-queue.  The instance of the cleanup callout that
destroys the last flow will also free the extra allocated block of memory.
Protect the reference count manipulation in the cleanup callout with
DN_BH_WLOCK() to be consistent with all of the other usage of the reference
count where this lock is held by the dummynet code.

Submitted by: Rasool Al-Saadi <ralsaadi@swin.edu.au>
Differential Revision: https://reviews.freebsd.org/D7174

git-svn-id: svn://svn.freebsd.org/base/stable/10@302987 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/netpfil/ipfw/dn_sched_fq_pie.c