summary refs log tree commit diff
path: root/fs/cifs
diff options
context:
space:
mode:
authorSuresh Jayaraman <sjayaraman@suse.de>2010-05-11 09:46:46 +0530
committerSteve French <sfrench@us.ibm.com>2010-05-11 15:42:21 +0000
commitfdb3603800e7a65bc3cafdfd5a1797d08f09e582 (patch)
tree86224ad3eaddc15da3306eea8887c15b2341ae3d /fs/cifs
parentfae683f764f91f31ab45512e70cc8cc81d4d157b (diff)
downloadlinux-fdb3603800e7a65bc3cafdfd5a1797d08f09e582.tar.gz
cifs: propagate cifs_new_fileinfo() error back to the caller
..otherwise memory allocation errors go undetected.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/dir.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index bd363df19b3f..86d3c0c82f25 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -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);