]> Pileus Git - ~andy/linux/commitdiff
[CIFS] Add null malloc response check in notify experimental code
authorSteve French <sfrench@us.ibm.com>
Wed, 12 Oct 2005 03:03:18 +0000 (20:03 -0700)
committerSteve French <sfrench@us.ibm.com>
Wed, 12 Oct 2005 03:03:18 +0000 (20:03 -0700)
Signed-off-by: Steve French (sfrench@us.ibm.com)
fs/cifs/cifs_debug.c
fs/cifs/cifssmb.c

index f4054d695f81f7cc3899b43a6b5149f5e2a3ac89..22a444a3fe4c2fb9325a0fdaa2e4eb09d3707670 100644 (file)
@@ -217,7 +217,7 @@ cifs_stats_write(struct file *file, const char __user *buffer,
         if (rc)
                 return rc;
 
-        if (c == '1' || c == 'y' || c == 'Y') {
+        if (c == '1' || c == 'y' || c == 'Y' || c == '0') {
                read_lock(&GlobalSMBSeslock);
                list_for_each(tmp, &GlobalTreeConnectionList) {
                        tcon = list_entry(tmp, struct cifsTconInfo,
index 41996a240149dd4c2978d137c0a3432d288f5076..9312bfc5668202218f59efda0028f92ac5761f40 100644 (file)
@@ -4294,20 +4294,26 @@ int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon,
                cFYI(1, ("Error in Notify = %d", rc));
        } else {
                /* Add file to outstanding requests */
+               /* BB change to kmem cache alloc */     
                dnotify_req = (struct dir_notify_req *) kmalloc(
-                                               sizeof(struct dir_notify_req), GFP_KERNEL);
-               dnotify_req->Pid = pSMB->hdr.Pid;
-               dnotify_req->PidHigh = pSMB->hdr.PidHigh;
-               dnotify_req->Mid = pSMB->hdr.Mid;
-               dnotify_req->Tid = pSMB->hdr.Tid;
-               dnotify_req->Uid = pSMB->hdr.Uid;
-               dnotify_req->netfid = netfid;
-               dnotify_req->pfile = pfile;
-               dnotify_req->filter = filter;
-               dnotify_req->multishot = multishot;
-               spin_lock(&GlobalMid_Lock);
-               list_add_tail(&dnotify_req->lhead, &GlobalDnotifyReqList);
-               spin_unlock(&GlobalMid_Lock);
+                                               sizeof(struct dir_notify_req),
+                                                GFP_KERNEL);
+               if(dnotify_req) {
+                       dnotify_req->Pid = pSMB->hdr.Pid;
+                       dnotify_req->PidHigh = pSMB->hdr.PidHigh;
+                       dnotify_req->Mid = pSMB->hdr.Mid;
+                       dnotify_req->Tid = pSMB->hdr.Tid;
+                       dnotify_req->Uid = pSMB->hdr.Uid;
+                       dnotify_req->netfid = netfid;
+                       dnotify_req->pfile = pfile;
+                       dnotify_req->filter = filter;
+                       dnotify_req->multishot = multishot;
+                       spin_lock(&GlobalMid_Lock);
+                       list_add_tail(&dnotify_req->lhead, 
+                                       &GlobalDnotifyReqList);
+                       spin_unlock(&GlobalMid_Lock);
+               } else 
+                       rc = -ENOMEM;
        }
        cifs_buf_release(pSMB);
        return rc;