Skip to content

Commit 9e7ffa7

Browse files
committed
cifs: release lock earlier in dequeue_mid error case
In dequeue_mid we can log an error while holding a spinlock, GlobalMid_Lock. Coverity notes that the error logging also grabs a lock so it is cleaner (and a bit safer) to release the GlobalMid_Lock before logging the warning. Addresses-Coverity: 1507573 ("Thread deadlock") Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent bac3539 commit 9e7ffa7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/cifs/connect.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -709,13 +709,14 @@ dequeue_mid(struct mid_q_entry *mid, bool malformed)
709709
* Trying to handle/dequeue a mid after the send_recv()
710710
* function has finished processing it is a bug.
711711
*/
712-
if (mid->mid_flags & MID_DELETED)
712+
if (mid->mid_flags & MID_DELETED) {
713+
spin_unlock(&GlobalMid_Lock);
713714
pr_warn_once("trying to dequeue a deleted mid\n");
714-
else {
715+
} else {
715716
list_del_init(&mid->qhead);
716717
mid->mid_flags |= MID_DELETED;
718+
spin_unlock(&GlobalMid_Lock);
717719
}
718-
spin_unlock(&GlobalMid_Lock);
719720
}
720721

721722
static unsigned int

0 commit comments

Comments
 (0)