batman-adv: Fix netlink dumping of BLA claims
authorSven Eckelmann <sven@narfation.org>
Sat, 24 Feb 2018 11:03:36 +0000 (12:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 May 2018 05:50:31 +0000 (07:50 +0200)
commit50b1c6b227433eea392cc8e9715e886034643850
tree722d32df691c94b83a3b3679946c62c8baf1407c
parentd31ae952b198d038ccf6dc95cb00ebdf9127d08a
batman-adv: Fix netlink dumping of BLA claims

[ Upstream commit b0264ecdfeab5f889b02ec54af7ca8cc1c245e2f ]

The function batadv_bla_claim_dump_bucket must be able to handle
non-complete dumps of a single bucket. It tries to do that by saving the
latest dumped index in *idx_skip to inform the caller about the current
state.

But the caller only assumes that buckets were not completely dumped when
the return code is non-zero. This function must therefore also return a
non-zero index when the dumping of an entry failed. Otherwise the caller
will just skip all remaining buckets.

And the function must also reset *idx_skip back to zero when it finished a
bucket. Otherwise it will skip the same number of entries in the next
bucket as the previous one had.

Fixes: 04f3f5bf1883 ("batman-adv: add B.A.T.M.A.N. Dump BLA claims via netlink")
Reported-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/batman-adv/bridge_loop_avoidance.c