<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/net/batman-adv, branch v4.6.3</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v4.6.3</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v4.6.3'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2016-06-08T01:23:39+00:00</updated>
<entry>
<title>batman-adv: Fix double neigh_node_put in batadv_v_ogm_route_update</title>
<updated>2016-06-08T01:23:39+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2016-05-21T09:48:17+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=f38db9379af750cf0d6ecf957af129100dc62a9e'/>
<id>urn:sha1:f38db9379af750cf0d6ecf957af129100dc62a9e</id>
<content type='text'>
The router is put down twice when it was non-NULL and either orig_ifinfo is
NULL afterwards or batman-adv receives a packet with the same sequence
number. This will end up in a use-after-free when the batadv_neigh_node is
removed because the reference counter ended up too early at 0.

This patch is skipping netdev and is being sent directly to stable in
accordance with David S. Miller[1].

The reason is that this patch applies only on linux-4.6 and not on
linux-4.7/net because it was "accidentally" fixed by a refactoring
commit (more details in [2]).

It addresses a reference imbalance which systematically leads to a
use-after-free and then a kernel crash.

[1] https://www.mail-archive.com/b.a.t.m.a.n@lists.open-mesh.org/msg15258.html
[2] https://www.mail-archive.com/b.a.t.m.a.n@lists.open-mesh.org/msg15252.html


Fixes: 9323158ef9f4 ("batman-adv: OGMv2 - implement originators logic")
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Antonio Quartulli &lt;a@unstable.cc&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>batman-adv: Fix reference counting of hardif_neigh_node object for neigh_node</title>
<updated>2016-04-29T11:46:11+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2016-03-11T15:44:06+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=abe59c65225ccd63a5964e2f2a73dd2995b948e7'/>
<id>urn:sha1:abe59c65225ccd63a5964e2f2a73dd2995b948e7</id>
<content type='text'>
The batadv_neigh_node was specific to a batadv_hardif_neigh_node and held
an implicit reference to it. But this reference was never stored in form of
a pointer in the batadv_neigh_node itself. Instead
batadv_neigh_node_release depends on a consistent state of
hard_iface-&gt;neigh_list and that batadv_hardif_neigh_get always returns the
batadv_hardif_neigh_node object which it has a reference for. But
batadv_hardif_neigh_get cannot guarantee that because it is working only
with rcu_read_lock on this list. It can therefore happen that a neigh_addr
is in this list twice or that batadv_hardif_neigh_get cannot find the
batadv_hardif_neigh_node for an neigh_addr due to some other list
operations taking place at the same time.

Instead add a batadv_hardif_neigh_node pointer directly in
batadv_neigh_node which will be used for the reference counter decremented
on release of batadv_neigh_node.

Fixes: cef63419f7db ("batman-adv: add list of unique single hop neighbors per hard-interface")
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Marek Lindner &lt;mareklindner@neomailbox.ch&gt;
Signed-off-by: Antonio Quartulli &lt;a@unstable.cc&gt;
</content>
</entry>
<entry>
<title>batman-adv: Fix reference counting of vlan object for tt_local_entry</title>
<updated>2016-04-29T11:46:11+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2016-03-11T15:44:05+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=a33d970d0b54b09746d5540af8271fad4eb10229'/>
<id>urn:sha1:a33d970d0b54b09746d5540af8271fad4eb10229</id>
<content type='text'>
The batadv_tt_local_entry was specific to a batadv_softif_vlan and held an
implicit reference to it. But this reference was never stored in form of a
pointer in the tt_local_entry itself. Instead batadv_tt_local_remove,
batadv_tt_local_table_free and batadv_tt_local_purge_pending_clients depend
on a consistent state of bat_priv-&gt;softif_vlan_list and that
batadv_softif_vlan_get always returns the batadv_softif_vlan object which
it has a reference for. But batadv_softif_vlan_get cannot guarantee that
because it is working only with rcu_read_lock on this list. It can
therefore happen that an vid is in this list twice or that
batadv_softif_vlan_get cannot find the batadv_softif_vlan for an vid due to
some other list operations taking place at the same time.

Instead add a batadv_softif_vlan pointer directly in batadv_tt_local_entry
which will be used for the reference counter decremented on release of
batadv_tt_local_entry.

Fixes: 35df3b298fc8 ("batman-adv: fix TT VLAN inconsistency on VLAN re-add")
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Acked-by: Antonio Quartulli &lt;a@unstable.cc&gt;
Signed-off-by: Marek Lindner &lt;mareklindner@neomailbox.ch&gt;
Signed-off-by: Antonio Quartulli &lt;a@unstable.cc&gt;
</content>
</entry>
<entry>
<title>batman-adv: B.A.T.M.A.N V - make sure iface is reactivated upon NETDEV_UP event</title>
<updated>2016-04-29T11:46:11+00:00</updated>
<author>
<name>Antonio Quartulli</name>
<email>a@unstable.cc</email>
</author>
<published>2016-04-14T01:37:05+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=b6cf5d499fddbfcffe751e81fb9f1a07d6348026'/>
<id>urn:sha1:b6cf5d499fddbfcffe751e81fb9f1a07d6348026</id>
<content type='text'>
At the moment there is no explicit reactivation of an hard-interface
upon NETDEV_UP event. In case of B.A.T.M.A.N. IV the interface is
reactivated as soon as the next OGM is scheduled for sending, but this
mechanism does not work with B.A.T.M.A.N. V. The latter does not rely
on the same scheduling mechanism as its predecessor and for this reason
the hard-interface remains deactivated forever after being brought down
once.

This patch fixes the reactivation mechanism by adding a new routing API
which explicitly allows each algorithm to perform any needed operation
upon interface re-activation.

Such API is optional and is implemented by B.A.T.M.A.N. V only and it
just takes care of setting the iface status to ACTIVE

Signed-off-by: Antonio Quartulli &lt;a@unstable.cc&gt;
Signed-off-by: Marek Lindner &lt;mareklindner@neomailbox.ch&gt;
</content>
</entry>
<entry>
<title>batman-adv: fix DAT candidate selection (must use vid)</title>
<updated>2016-04-29T11:46:10+00:00</updated>
<author>
<name>Antonio Quartulli</name>
<email>a@unstable.cc</email>
</author>
<published>2016-03-12T10:12:59+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=2871734e85e920503d49b3a8bc0afbe0773b6036'/>
<id>urn:sha1:2871734e85e920503d49b3a8bc0afbe0773b6036</id>
<content type='text'>
Now that DAT is VLAN aware, it must use the VID when
computing the DHT address of the candidate nodes where
an entry is going to be stored/retrieved.

Fixes: be1db4f6615b ("batman-adv: make the Distributed ARP Table vlan aware")
Signed-off-by: Antonio Quartulli &lt;a@unstable.cc&gt;
[sven@narfation.org: fix conflicts with current version]
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Marek Lindner &lt;mareklindner@neomailbox.ch&gt;
</content>
</entry>
<entry>
<title>batman-adv: Fix broadcast/ogm queue limit on a removed interface</title>
<updated>2016-04-24T07:41:56+00:00</updated>
<author>
<name>Linus Lüssing</name>
<email>linus.luessing@c0d3.blue</email>
</author>
<published>2016-03-11T13:04:49+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=c4fdb6cff2aa0ae740c5f19b6f745cbbe786d42f'/>
<id>urn:sha1:c4fdb6cff2aa0ae740c5f19b6f745cbbe786d42f</id>
<content type='text'>
When removing a single interface while a broadcast or ogm packet is
still pending then we will free the forward packet without releasing the
queue slots again.

This patch is supposed to fix this issue.

Fixes: 6d5808d4ae1b ("batman-adv: Add missing hardif_free_ref in forw_packet_free")
Signed-off-by: Linus Lüssing &lt;linus.luessing@c0d3.blue&gt;
[sven@narfation.org: fix conflicts with current version]
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Marek Lindner &lt;mareklindner@neomailbox.ch&gt;
Signed-off-by: Antonio Quartulli &lt;a@unstable.cc&gt;
</content>
</entry>
<entry>
<title>batman-adv: Reduce refcnt of removed router when updating route</title>
<updated>2016-04-24T07:41:25+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2016-03-20T11:27:53+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=d1a65f1741bfd9c69f9e4e2ad447a89b6810427d'/>
<id>urn:sha1:d1a65f1741bfd9c69f9e4e2ad447a89b6810427d</id>
<content type='text'>
_batadv_update_route rcu_derefences orig_ifinfo-&gt;router outside of a
spinlock protected region to print some information messages to the debug
log. But this pointer is not checked again when the new pointer is assigned
in the spinlock protected region. Thus is can happen that the value of
orig_ifinfo-&gt;router changed in the meantime and thus the reference counter
of the wrong router gets reduced after the spinlock protected region.

Just rcu_dereferencing the value of orig_ifinfo-&gt;router inside the spinlock
protected region (which also set the new pointer) is enough to get the
correct old router object.

Fixes: e1a5382f978b ("batman-adv: Make orig_node-&gt;router an rcu protected pointer")
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Marek Lindner &lt;mareklindner@neomailbox.ch&gt;
Signed-off-by: Antonio Quartulli &lt;a@unstable.cc&gt;
</content>
</entry>
<entry>
<title>batman-adv: Deactivate TO_BE_ACTIVATED hardif on shutdown</title>
<updated>2016-04-24T07:40:23+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2016-03-19T12:55:21+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=f2d23861b818d08bcd15cc1612ae94aa33b3931c'/>
<id>urn:sha1:f2d23861b818d08bcd15cc1612ae94aa33b3931c</id>
<content type='text'>
The shutdown of an batman-adv interface can happen with one of its slave
interfaces still being in the BATADV_IF_TO_BE_ACTIVATED state. A possible
reason for it is that the routing algorithm BATMAN_V was selected and
batadv_schedule_bat_ogm was not yet called for this interface. This slave
interface still has to be set to BATADV_IF_INACTIVE or the batman-adv
interface will never reduce its usage counter and thus never gets shutdown.

This problem can be simulated via:

    $ modprobe dummy
    $ modprobe batman-adv routing_algo=BATMAN_V
    $ ip link add bat0 type batadv
    $ ip link set dummy0 master bat0
    $ ip link set dummy0 up
    $ ip link del bat0
    unregister_netdevice: waiting for bat0 to become free. Usage count = 3

Reported-by: Matthias Schiffer &lt;mschiffer@universe-factory.net&gt;
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Marek Lindner &lt;mareklindner@neomailbox.ch&gt;
Signed-off-by: Antonio Quartulli &lt;a@unstable.cc&gt;
</content>
</entry>
<entry>
<title>batman-adv: init neigh node last seen field</title>
<updated>2016-04-24T07:39:19+00:00</updated>
<author>
<name>Marek Lindner</name>
<email>mareklindner@neomailbox.ch</email>
</author>
<published>2016-03-11T15:01:09+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=e48474ed8a217b7f80f2a42bc05352406a06cb67'/>
<id>urn:sha1:e48474ed8a217b7f80f2a42bc05352406a06cb67</id>
<content type='text'>
Signed-off-by: Marek Lindner &lt;mareklindner@neomailbox.ch&gt;
[sven@narfation.org: fix conflicts with current version]
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Antonio Quartulli &lt;a@unstable.cc&gt;
</content>
</entry>
<entry>
<title>batman-adv: Check skb size before using encapsulated ETH+VLAN header</title>
<updated>2016-04-24T07:37:21+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2016-02-26T16:56:13+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=c78296665c3d81f040117432ab9e1cb125521b0c'/>
<id>urn:sha1:c78296665c3d81f040117432ab9e1cb125521b0c</id>
<content type='text'>
The encapsulated ethernet and VLAN header may be outside the received
ethernet frame. Thus the skb buffer size has to be checked before it can be
parsed to find out if it encapsulates another batman-adv packet.

Fixes: 420193573f11 ("batman-adv: softif bridge loop avoidance")
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Marek Lindner &lt;mareklindner@neomailbox.ch&gt;
Signed-off-by: Antonio Quartulli &lt;a@unstable.cc&gt;
</content>
</entry>
</feed>
