Merge tag 'pinctrl-v4.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[sfrench/cifs-2.6.git] / fs / cifs / connect.c
index 7aa08dba4719cde8c88c18bcb5ee4a4ddae733f1..52d71b64c0c6e5f954d408098fc78197898399c7 100644 (file)
@@ -659,7 +659,15 @@ dequeue_mid(struct mid_q_entry *mid, bool malformed)
                mid->mid_state = MID_RESPONSE_RECEIVED;
        else
                mid->mid_state = MID_RESPONSE_MALFORMED;
-       list_del_init(&mid->qhead);
+       /*
+        * Trying to handle/dequeue a mid after the send_recv()
+        * function has finished processing it is a bug.
+        */
+       if (mid->mid_flags & MID_DELETED)
+               printk_once(KERN_WARNING
+                           "trying to dequeue a deleted mid\n");
+       else
+               list_del_init(&mid->qhead);
        spin_unlock(&GlobalMid_Lock);
 }
 
@@ -938,8 +946,7 @@ next_pdu:
                } else {
                        mids[0] = server->ops->find_mid(server, buf);
                        bufs[0] = buf;
-                       if (mids[0])
-                               num_mids = 1;
+                       num_mids = 1;
 
                        if (!mids[0] || !mids[0]->receive)
                                length = standard_receive3(server, mids[0]);