Marek Lindner wrote:
On Friday 17 September 2010 19:27:06 Sven Eckelmann wrote:
The return of get_batman_if_by_netdev and get_active_batman_if leaks a pointer from the rcu protected list of interfaces. We must protect it to prevent a too early release of the memory. Those functions must increase the reference counter before rcu_read_unlock or it may be to late to prevent a free.
It seems this patch does not properly deal with bat_priv->primary_if. Please review my revised patch and let me know if you think it is ok.
As said before, this patch should not count primary_if by design (see the commit message). I would say that your changes should be an extra patch.
I will split that stuff and send it as extra patches. Your patch itself has the problem that it increases the refcnt through get_active_batman_if, but doesn't reduce it at the end.
Best regards, Sven