Skip to content

Commit f5a131d

Browse files
kcp-gitgerd-rausch
authored andcommitted
rds: MP-RDS may use an invalid c_path
rds_sendmsg() calls rds_send_mprds_hash() to find a c_path to use to send a message. Suppose the RDS connection is not yet up. In rds_send_mprds_hash(), it does if (conn->c_npaths == 0) wait_event_interruptible(conn->c_hs_waitq, (conn->c_npaths != 0)); If it is interrupted before the connection is set up, rds_send_mprds_hash() will return a non-zero hash value. Hence rds_sendmsg() will use a non-zero c_path to send the message. But if the RDS connection ends up to be non-MP capable, the message will be lost as only the zero c_path can be used. Orabug: 27822369 Signed-off-by: Ka-Cheong Poon <[email protected]> Reviewed-by: Santosh Shilimkar <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent e9e5cc7 commit f5a131d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

net/rds/send.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,10 +1193,15 @@ static int rds_send_mprds_hash(struct rds_sock *rs, struct rds_connection *conn)
11931193
if (conn->c_npaths == 0 && hash != 0) {
11941194
rds_send_ping(conn, 0);
11951195

1196-
if (conn->c_npaths == 0) {
1197-
wait_event_interruptible(conn->c_hs_waitq,
1198-
(conn->c_npaths != 0));
1199-
}
1196+
/* The underlying connection is not up yet. Need to wait
1197+
* until it is up to be sure that the non-zero c_path can be
1198+
* used. But if we are interrupted, we have to use the zero
1199+
* c_path in case the connection ends up being non-MP capable.
1200+
*/
1201+
if (conn->c_npaths == 0)
1202+
if (wait_event_interruptible(conn->c_hs_waitq,
1203+
conn->c_npaths != 0))
1204+
hash = 0;
12001205
if (conn->c_npaths == 1)
12011206
hash = 0;
12021207
}

0 commit comments

Comments
 (0)