mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
smb3: fix lock ordering potential deadlock in cifs_sync_mid_result
commit 8861fd5180476f45f9e8853db154600469a0284f upstream.
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: stable@vger.kernel.org
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2b8bf690e0
commit
c7a4bca289
@@ -931,12 +931,15 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server)
|
|||||||
list_del_init(&mid->qhead);
|
list_del_init(&mid->qhead);
|
||||||
mid->mid_flags |= MID_DELETED;
|
mid->mid_flags |= MID_DELETED;
|
||||||
}
|
}
|
||||||
|
spin_unlock(&server->mid_lock);
|
||||||
cifs_server_dbg(VFS, "%s: invalid mid state mid=%llu state=%d\n",
|
cifs_server_dbg(VFS, "%s: invalid mid state mid=%llu state=%d\n",
|
||||||
__func__, mid->mid, mid->mid_state);
|
__func__, mid->mid, mid->mid_state);
|
||||||
rc = -EIO;
|
rc = -EIO;
|
||||||
|
goto sync_mid_done;
|
||||||
}
|
}
|
||||||
spin_unlock(&server->mid_lock);
|
spin_unlock(&server->mid_lock);
|
||||||
|
|
||||||
|
sync_mid_done:
|
||||||
release_mid(mid);
|
release_mid(mid);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user