Skip to content

Commit 4141ddc

Browse files
guijianfengdavem330
authored andcommitted
sctp: retran_path update bug fix
If the current retran_path is the only active one, it should update it to the the next inactive one. Signed-off-by: Gui Jianfeng <[email protected]> Signed-off-by: Vlad Yasevich <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent aed5a83 commit 4141ddc

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

net/sctp/associola.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,9 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
12031203
struct list_head *head = &asoc->peer.transport_addr_list;
12041204
struct list_head *pos;
12051205

1206+
if (asoc->peer.transport_count == 1)
1207+
return;
1208+
12061209
/* Find the next transport in a round-robin fashion. */
12071210
t = asoc->peer.retran_path;
12081211
pos = &t->transports;
@@ -1217,6 +1220,15 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
12171220

12181221
t = list_entry(pos, struct sctp_transport, transports);
12191222

1223+
/* We have exhausted the list, but didn't find any
1224+
* other active transports. If so, use the next
1225+
* transport.
1226+
*/
1227+
if (t == asoc->peer.retran_path) {
1228+
t = next;
1229+
break;
1230+
}
1231+
12201232
/* Try to find an active transport. */
12211233

12221234
if ((t->state == SCTP_ACTIVE) ||
@@ -1229,15 +1241,6 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc)
12291241
if (!next)
12301242
next = t;
12311243
}
1232-
1233-
/* We have exhausted the list, but didn't find any
1234-
* other active transports. If so, use the next
1235-
* transport.
1236-
*/
1237-
if (t == asoc->peer.retran_path) {
1238-
t = next;
1239-
break;
1240-
}
12411244
}
12421245

12431246
asoc->peer.retran_path = t;

0 commit comments

Comments
 (0)