]>
Commit | Line | Data |
---|---|---|
ad834691 GKH |
1 | From bdc54d8e3cb4a41dddcabfd86d9eb3aa5f622b75 Mon Sep 17 00:00:00 2001 |
2 | From: Trond Myklebust <trond.myklebust@primarydata.com> | |
3 | Date: Sat, 16 Jul 2016 11:47:00 -0400 | |
4 | Subject: SUNRPC: Fix infinite looping in rpc_clnt_iterate_for_each_xprt | |
5 | ||
6 | From: Trond Myklebust <trond.myklebust@primarydata.com> | |
7 | ||
8 | commit bdc54d8e3cb4a41dddcabfd86d9eb3aa5f622b75 upstream. | |
9 | ||
10 | If there were less than 2 entries in the multipath list, then | |
11 | xprt_iter_next_entry_multiple() would never advance beyond the | |
12 | first entry, which is correct for round robin behaviour, but not | |
13 | for the list iteration. | |
14 | ||
15 | The end result would be infinite looping in rpc_clnt_iterate_for_each_xprt() | |
16 | as we would never see the xprt == NULL condition fulfilled. | |
17 | ||
18 | Reported-by: Oleg Drokin <green@linuxhacker.ru> | |
19 | Fixes: 80b14d5e61ca ("SUNRPC: Add a structure to track multiple transports") | |
20 | Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> | |
21 | Cc: Jason L Tibbitts III <tibbs@math.uh.edu> | |
22 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
23 | ||
24 | --- | |
25 | net/sunrpc/xprtmultipath.c | 8 +++----- | |
26 | 1 file changed, 3 insertions(+), 5 deletions(-) | |
27 | ||
28 | --- a/net/sunrpc/xprtmultipath.c | |
29 | +++ b/net/sunrpc/xprtmultipath.c | |
30 | @@ -271,14 +271,12 @@ struct rpc_xprt *xprt_iter_next_entry_mu | |
31 | xprt_switch_find_xprt_t find_next) | |
32 | { | |
33 | struct rpc_xprt_switch *xps = rcu_dereference(xpi->xpi_xpswitch); | |
34 | - struct list_head *head; | |
35 | ||
36 | if (xps == NULL) | |
37 | return NULL; | |
38 | - head = &xps->xps_xprt_list; | |
39 | - if (xps->xps_nxprts < 2) | |
40 | - return xprt_switch_find_first_entry(head); | |
41 | - return xprt_switch_set_next_cursor(head, &xpi->xpi_cursor, find_next); | |
42 | + return xprt_switch_set_next_cursor(&xps->xps_xprt_list, | |
43 | + &xpi->xpi_cursor, | |
44 | + find_next); | |
45 | } | |
46 | ||
47 | static |