]> err.no Git - linux-2.6/blobdiff - fs/cifs/connect.c
[CIFS] fix mempool destroy done in wrong order in cifs error path
[linux-2.6] / fs / cifs / connect.c
index 1f4bc71817019728ab9252e8033b9d9f5d2a487d..f4e92661b22306ffa1d019f81a47e501fc374a04 100644 (file)
@@ -1670,7 +1670,7 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo * tcon,
                /* We might be setting the path sep back to a different
                form if we are reconnecting and the server switched its
                posix path capability for this share */ 
-               if(CIFS_SB(sb)->prepathlen > 0)
+               if(sb && (CIFS_SB(sb)->prepathlen > 0))
                        CIFS_SB(sb)->prepath[0] = CIFS_DIR_SEP(CIFS_SB(sb));
        
                cFYI(1,("Negotiate caps 0x%x",(int)cap));
@@ -1721,12 +1721,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                return -EINVAL;
        }
 
-       if (volume_info.username) {
+       if (volume_info.nullauth) {
+               cFYI(1,("null user"));
+               volume_info.username = NULL;
+       } else if (volume_info.username) {
                /* BB fixme parse for domain name here */
                cFYI(1, ("Username: %s ", volume_info.username));
-
-       } else if (volume_info.nullauth) {
-               cFYI(1,("null user"));
        } else {
                cifserror("No username specified");
         /* In userspace mount helper we can get user name from alternate
@@ -2069,8 +2069,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                        srvTcp->tcpStatus = CifsExiting;
                        spin_unlock(&GlobalMid_Lock);
                        if (srvTcp->tsk) {
+                               struct task_struct *tsk;
+                               /* If we could verify that kthread_stop would
+                                  always wake up processes blocked in
+                                  tcp in recv_mesg then we could remove the
+                                  send_sig call */
                                send_sig(SIGKILL,srvTcp->tsk,1);
-                               kthread_stop(srvTcp->tsk);
+                               tsk = srvTcp->tsk;
+                               if(tsk)
+                                       kthread_stop(tsk);
                        }
                }
                 /* If find_unc succeeded then rc == 0 so we can not end */
@@ -2085,8 +2092,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                                        /* if the socketUseCount is now zero */
                                        if ((temp_rc == -ESHUTDOWN) &&
                                           (pSesInfo->server) && (pSesInfo->server->tsk)) {
+                                               struct task_struct *tsk;
                                                send_sig(SIGKILL,pSesInfo->server->tsk,1);
-                                               kthread_stop(pSesInfo->server->tsk);
+                                               tsk = pSesInfo->server->tsk;
+                                               if (tsk)
+                                                       kthread_stop(tsk);
                                        }
                                } else
                                        cFYI(1, ("No session or bad tcon"));
@@ -3334,7 +3344,7 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb)
                                return 0;
                        } else if (rc == -ESHUTDOWN) {
                                cFYI(1,("Waking up socket by sending it signal"));
-                               if(cifsd_task) {
+                               if (cifsd_task) {
                                        send_sig(SIGKILL,cifsd_task,1);
                                        kthread_stop(cifsd_task);
                                }