Skip to contentSkip to conversation

ipmr_base: Do not reset index in mr_table_dump

PATCH In review David Ahern 2 participants 2 messages May 2, 2019 – May 4, 2019

Subsystems (3)
lore
Share & tools
lore

David Ahern

author maintainer
#0 lore raw

PATCH 1/1 ipmr_base: Do not reset index in mr_table_dump

From: David Ahern <[email protected]>

e is the counter used to save the location of a dump when an skb is filled. Once the walk of the table is complete, mr_table_dump needs to return without resetting that index to 0. Dump of a specific table is looping because of the reset because there is no way to indicate the walk of the table is done.

Move the reset to the caller so the dump of each table starts at 0, but the loop counter is maintained if a dump fills an skb.

Fixes e1cedae1ba6b0 ("ipmr: Refactor mr_rtm_dumproute")
---
 net/ipv4/ipmr_base.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv4/ipmr_base.c +1 -2
index 3e614cc824f7..3a1af50bd0a5 100644
@@ -335,8 +335,6 @@ int mr_table_dump(struct mr_table *mrt, struct sk_buff *skb,
 	}
 	spin_unlock_bh(lock);
 	err = 0;
-	e = 0;
-
 out:
 	cb->args[1] = e;
 	return err;
@@ -374,6 +372,7 @@ int mr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb,
 		err = mr_table_dump(mrt, skb, cb, fill, lock, filter);
 		if (err < 0)
 			break;
+		cb->args[1] = 0;
 next_table:
 		t++;
 	}
Signature · 1 line
2.11.0
maintainer
#1 lore raw

From: David Ahern <[email protected]>
Date: Thu, 2 May 2019 15:14:15 -0700

Quoted 8 lines

From: David Ahern <[email protected]>

e is the counter used to save the location of a dump when an skb is filled. Once the walk of the table is complete, mr_table_dump needs to return without resetting that index to 0. Dump of a specific table is looping because of the reset because there is no way to indicate the walk of the table is done.

Quoted 5 lines

Move the reset to the caller so the dump of each table starts at 0, but the loop counter is maintained if a dump fills an skb.

Fixes e1cedae1ba6b0 ("ipmr: Refactor mr_rtm_dumproute")

Applied and queued up for -stable.