IPoIB: Fix memory leak in the neigh table deletion flow
authorShlomo Pongratz <shlomop@mellanox.com>
Wed, 29 Aug 2012 15:14:33 +0000 (15:14 +0000)
committerRoland Dreier <roland@purestorage.com>
Wed, 12 Sep 2012 16:05:03 +0000 (09:05 -0700)
commit66172c09938bfc4efdcf9b5e0246a85b9b76dd54
tree05b77629b993215b0cbc478b5941fdf5cc1e1d05
parentfea7a08acb13524b47711625eebea40a0ede69a0
IPoIB: Fix memory leak in the neigh table deletion flow

If the neighbours hash table is empty when unloading the module, then
ipoib_flush_neighs(), the cleanup routine, isn't called and the
memory used for the hash table itself leaked.

To fix this, ipoib_flush_neighs() is allways called, and another
completion object is added to signal when the table is freed.

Once invoked, ipoib_flush_neighs() flushes all the neighbours (if
there are any), calls the the hash table RCU free routine, which now
signals completion of the deletion process, and waits for the last
neighbour to be freed.

Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/ulp/ipoib/ipoib.h
drivers/infiniband/ulp/ipoib/ipoib_main.c