Skip to content

Commit 2bf657c

Browse files
NeilBrownOleg Drokin
authored andcommitted
LU-12101 socklnd: fix infinite loop in ksocknal_push()
If the list_for_each_entry() loop in ksocknal_push() ever finds a match, then it will increment 'i', and the outer loop will continue. Once peer_off becomes larger than the number of matches in a given chain, 'peer_ni' will be an invalid pointer, and ksocknal_push_peer() will probably crash when called on it. To abort the outer loop properly, we need to test if "i <= peer_off", which indicates that all patching peers have been found. This bug can easily be reproduced by running lctl --net tcp push Signed-off-by: Mr NeilBrown <[email protected]> Change-Id: I9468214c7e1a0154213586cac0deb61afaa1d53d Reviewed-on: https://review.whamcloud.com/34499 Tested-by: jenkins <[email protected]> Tested-by: Maloo <[email protected]> Reviewed-by: James Simmons <[email protected]> Reviewed-by: Sonia Sharma <[email protected]> Reviewed-by: Oleg Drokin <[email protected]>
1 parent 76ca884 commit 2bf657c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lnet/klnds/socklnd/socklnd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1936,7 +1936,7 @@ ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id)
19361936
}
19371937
read_unlock(&ksocknal_data.ksnd_global_lock);
19381938

1939-
if (i == 0) /* no match */
1939+
if (i <= peer_off) /* no match */
19401940
break;
19411941

19421942
rc = 0;

0 commit comments

Comments
 (0)