Skip to content

Commit 524630d

Browse files
Sagi GrimbergNicholas Bellinger
authored andcommitted
iser-target: Fix possible use-after-free
iser connection termination process happens in 2 stages: - isert_wait_conn: - resumes rdma disconnect - wait for session commands - wait for flush completions (post a marked wr to signal we are done) - wait for logout completion - queue work for connection cleanup (depends on disconnected/timewait events) - isert_free_conn - last reference put on the connection In case we are terminating during IOs, we might be posting send/recv requests after we posted the last work request which might lead to a use-after-free condition in isert_handle_wc. After we posted the last wr in isert_wait_conn we are guaranteed that no successful completions will follow (meaning no new work request posts may happen) but other flush errors might still come. So before we put the last reference on the connection, we repeat the process of posting a marked work request (isert_wait4flush) in order to make sure all pending completions were flushed. Signed-off-by: Sagi Grimberg <[email protected]> Signed-off-by: Jenny Falkovich <[email protected]> Cc: [email protected] # 3.10+ Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent 2f1b6b7 commit 524630d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/infiniband/ulp/isert/ib_isert.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3392,6 +3392,7 @@ static void isert_free_conn(struct iscsi_conn *conn)
33923392
{
33933393
struct isert_conn *isert_conn = conn->context;
33943394

3395+
isert_wait4flush(isert_conn);
33953396
isert_put_conn(isert_conn);
33963397
}
33973398

0 commit comments

Comments
 (0)