]> git.baikalelectronics.ru Git - kernel.git/commit
tipc: fix infinite loop when dumping link monitor summary
authorTung Nguyen <tung.q.nguyen@dektech.com.au>
Tue, 17 Apr 2018 19:58:27 +0000 (21:58 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Apr 2018 17:48:43 +0000 (13:48 -0400)
commit88d778bf4e41f5d6f2b2dfbfc17620833b392574
tree4814069cc75b778297fe5ff5f16e53f39c167e90
parent5ae2591bc8eb4a96a041005bbc08b2a54b62b281
tipc: fix infinite loop when dumping link monitor summary

When configuring the number of used bearers to MAX_BEARER and issuing
command "tipc link monitor summary", the command enters infinite loop
in user space.

This issue happens because function tipc_nl_node_dump_monitor() returns
the wrong 'prev_bearer' value when all potential monitors have been
scanned.

The correct behavior is to always try to scan all monitors until either
the netlink message is full, in which case we return the bearer identity
of the affected monitor, or we continue through the whole bearer array
until we can return MAX_BEARERS. This solution also caters for the case
where there may be gaps in the bearer array.

Signed-off-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/monitor.c
net/tipc/node.c