]> git.baikalelectronics.ru Git - kernel.git/commit
Staging: batman-adv: count batman_if list queries as reference
authorSven Eckelmann <sven.eckelmann@gmx.de>
Sat, 18 Sep 2010 19:01:20 +0000 (21:01 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Sep 2010 23:29:50 +0000 (16:29 -0700)
commitbd0ae1153f340c17525a0a24ca2e7e01440839ec
tree41fc189a84140a726c5b88b79fc51ebaf9b60099
parente779e4acf204cd207f7abb51724622b9931ecacf
Staging: batman-adv: count batman_if list queries as reference

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.

hardif_add_interface must also increase the reference count for the
returned batman_if to make the behaviour consistent.

Reported-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/batman-adv/TODO
drivers/staging/batman-adv/bat_sysfs.c
drivers/staging/batman-adv/hard-interface.c