cifs: propagate cifs_new_fileinfo() error back to the caller
authorSuresh Jayaraman <sjayaraman@suse.de>
Tue, 11 May 2010 04:16:46 +0000 (09:46 +0530)
committerSteve French <sfrench@us.ibm.com>
Tue, 11 May 2010 15:42:21 +0000 (15:42 +0000)
..otherwise memory allocation errors go undetected.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/dir.c

index bd363df19b3f4d15d3a0e988cb26e5212c052473..86d3c0c82f253bd7129c11fdb3a510b60f48b8b5 100644 (file)
@@ -261,8 +261,14 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
         * cifs_fill_filedata() takes care of setting cifsFileInfo pointer to
         * file->private_data.
         */
-       if (mnt)
-               cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt, oflags);
+       if (mnt) {
+               struct cifsFileInfo *pfile_info;
+
+               pfile_info = cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt,
+                                              oflags);
+               if (pfile_info == NULL)
+                       rc = -ENOMEM;
+       }
 
 posix_open_ret:
        kfree(presp_data);
@@ -476,12 +482,15 @@ cifs_create_set_dentry:
                /* mknod case - do not leave file open */
                CIFSSMBClose(xid, tcon, fileHandle);
        } else if (!(posix_create) && (newinode)) {
+               struct cifsFileInfo *pfile_info;
                /*
                 * cifs_fill_filedata() takes care of setting cifsFileInfo
                 * pointer to file->private_data.
                 */
-               cifs_new_fileinfo(newinode, fileHandle, NULL, nd->path.mnt,
-                                 oflags);
+               pfile_info = cifs_new_fileinfo(newinode, fileHandle, NULL,
+                                              nd->path.mnt, oflags);
+               if (pfile_info == NULL)
+                       rc = -ENOMEM;
        }
 cifs_create_out:
        kfree(buf);