Skip to content

Commit 8861fd5

Browse files
author
Steve French
committed
smb3: fix lock ordering potential deadlock in cifs_sync_mid_result
Coverity spotted that the cifs_sync_mid_result function could deadlock "Thread deadlock (ORDER_REVERSAL) lock_order: Calling spin_lock acquires lock TCP_Server_Info.srv_lock while holding lock TCP_Server_Info.mid_lock" Addresses-Coverity: 1590401 ("Thread deadlock (ORDER_REVERSAL)") Cc: [email protected] Reviewed-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 8094a60 commit 8861fd5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/smb/client/transport.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,12 +909,15 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server)
909909
list_del_init(&mid->qhead);
910910
mid->mid_flags |= MID_DELETED;
911911
}
912+
spin_unlock(&server->mid_lock);
912913
cifs_server_dbg(VFS, "%s: invalid mid state mid=%llu state=%d\n",
913914
__func__, mid->mid, mid->mid_state);
914915
rc = -EIO;
916+
goto sync_mid_done;
915917
}
916918
spin_unlock(&server->mid_lock);
917919

920+
sync_mid_done:
918921
release_mid(mid);
919922
return rc;
920923
}

0 commit comments

Comments
 (0)