Comment 8 for bug 1561589

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/18763
Committed: http://github.org/Juniper/contrail-vrouter/commit/2cef39d7d18db1d2c6bc7d9e0c49b996387198a4
Submitter: Zuul
Branch: master

commit 2cef39d7d18db1d2c6bc7d9e0c49b996387198a4
Author: Anand H. Krishnan <email address hidden>
Date: Thu Mar 24 21:06:04 2016 +0530

Fix memory corruption at the time of unloading

Every alloc and free of memory in vRouter is accounted for by the memory
statistics subsystem of vRouter. While unloading the module, we are
freeing malloc statistics memory before packet drop statstics memory is
freed. While we do update the memory statistics only if the memory
statistics block pointer is not null, we do not seem to be zeroing the
pointer that holds the address of the memory block post release. Hence,
reverse the order of release and NULL-ify the memory statistics pointer.

Also, unregister the net device notifier before going ahead and freeing
the memory that the vhost driver keeps. If the notifier is not unregistered
first, it can potentially access freed memory that vhost driver maintains.

Change-Id: I79c4cdec4f0501e61abf38698e44e461a90c370b
Closes-BUG: #1561589