Skip to content

Commit fce672d

Browse files
ecsvsimonwunderlich
authored andcommitted
batman-adv: Fix netlink dumping of BLA backbones
The function batadv_bla_backbone_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: ea4152e ("batman-adv: add backbone table netlink support") Reported-by: Linus Lüssing <[email protected]> Signed-off-by: Sven Eckelmann <[email protected]> Signed-off-by: Simon Wunderlich <[email protected]>
1 parent b0264ec commit fce672d

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
@@ -2394,22 +2394,25 @@ batadv_bla_backbone_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq,
23942394
{
23952395
struct batadv_bla_backbone_gw *backbone_gw;
23962396
int idx = 0;
2397+
int ret = 0;
23972398

23982399
rcu_read_lock();
23992400
hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) {
24002401
if (idx++ < *idx_skip)
24012402
continue;
2402-
if (batadv_bla_backbone_dump_entry(msg, portid, seq,
2403-
primary_if, backbone_gw)) {
2403+
2404+
ret = batadv_bla_backbone_dump_entry(msg, portid, seq,
2405+
primary_if, backbone_gw);
2406+
if (ret) {
24042407
*idx_skip = idx - 1;
24052408
goto unlock;
24062409
}
24072410
}
24082411

2409-
*idx_skip = idx;
2412+
*idx_skip = 0;
24102413
unlock:
24112414
rcu_read_unlock();
2412-
return 0;
2415+
return ret;
24132416
}
24142417

24152418
/**

0 commit comments

Comments
 (0)