1 From: Sven Eckelmann <sven@narfation.org>
2 Date: Sat, 24 Feb 2018 12:03:37 +0100
3 Subject: [PATCH] batman-adv: Fix netlink dumping of BLA backbones
5 The function batadv_bla_backbone_dump_bucket must be able to handle
6 non-complete dumps of a single bucket. It tries to do that by saving the
7 latest dumped index in *idx_skip to inform the caller about the current
10 But the caller only assumes that buckets were not completely dumped when
11 the return code is non-zero. This function must therefore also return a
12 non-zero index when the dumping of an entry failed. Otherwise the caller
13 will just skip all remaining buckets.
15 And the function must also reset *idx_skip back to zero when it finished a
16 bucket. Otherwise it will skip the same number of entries in the next
17 bucket as the previous one had.
19 Fixes: 7f609cab5123 ("batman-adv: add backbone table netlink support")
20 Reported-by: Linus Lüssing <linus.luessing@c0d3.blue>
21 Signed-off-by: Sven Eckelmann <sven@narfation.org>
22 Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
24 Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/29e4759e49f06014b84791397ebe1b22546edd2d
26 net/batman-adv/bridge_loop_avoidance.c | 11 +++++++----
27 1 file changed, 7 insertions(+), 4 deletions(-)
29 diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
30 index 4784469cadd4364b6239ce9ff0d1c7cc254de439..aecf34503e95d9aa723449ddbf0bb3035336b878 100644
31 --- a/net/batman-adv/bridge_loop_avoidance.c
32 +++ b/net/batman-adv/bridge_loop_avoidance.c
33 @@ -2382,22 +2382,25 @@ batadv_bla_backbone_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq,
35 struct batadv_bla_backbone_gw *backbone_gw;
40 hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) {
41 if (idx++ < *idx_skip)
43 - if (batadv_bla_backbone_dump_entry(msg, portid, seq,
44 - primary_if, backbone_gw)) {
46 + ret = batadv_bla_backbone_dump_entry(msg, portid, seq,
47 + primary_if, backbone_gw);