Skip to content

Commit b0264ec

Browse files
ecsvsimonwunderlich
authored andcommitted
batman-adv: Fix netlink dumping of BLA claims
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: 04f3f5b ("batman-adv: add B.A.T.M.A.N. Dump BLA claims via netlink") Reported-by: Linus Lüssing <[email protected]> Signed-off-by: Sven Eckelmann <[email protected]> Signed-off-by: Simon Wunderlich <[email protected]>
1 parent 011c935 commit b0264ec

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

net/batman-adv/bridge_loop_avoidance.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,22 +2161,25 @@ batadv_bla_claim_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq,
21612161
{
21622162
struct batadv_bla_claim *claim;
21632163
int idx = 0;
2164+
int ret = 0;
21642165

21652166
rcu_read_lock();
21662167
hlist_for_each_entry_rcu(claim, head, hash_entry) {
21672168
if (idx++ < *idx_skip)
21682169
continue;
2169-
if (batadv_bla_claim_dump_entry(msg, portid, seq,
2170-
primary_if, claim)) {
2170+
2171+
ret = batadv_bla_claim_dump_entry(msg, portid, seq,
2172+
primary_if, claim);
2173+
if (ret) {
21712174
*idx_skip = idx - 1;
21722175
goto unlock;
21732176
}
21742177
}
21752178

2176-
*idx_skip = idx;
2179+
*idx_skip = 0;
21772180
unlock:
21782181
rcu_read_unlock();
2179-
return 0;
2182+
return ret;
21802183
}
21812184

21822185
/**

0 commit comments

Comments
 (0)