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>
This commit is contained in:
Suresh Jayaraman 2010-05-11 09:46:46 +05:30 committed by Steve French
parent fae683f764
commit fdb3603800

View 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 * cifs_fill_filedata() takes care of setting cifsFileInfo pointer to
* file->private_data. * file->private_data.
*/ */
if (mnt) if (mnt) {
cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt, oflags); struct cifsFileInfo *pfile_info;
pfile_info = cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt,
oflags);
if (pfile_info == NULL)
rc = -ENOMEM;
}
posix_open_ret: posix_open_ret:
kfree(presp_data); kfree(presp_data);
@ -476,12 +482,15 @@ cifs_create_set_dentry:
/* mknod case - do not leave file open */ /* mknod case - do not leave file open */
CIFSSMBClose(xid, tcon, fileHandle); CIFSSMBClose(xid, tcon, fileHandle);
} else if (!(posix_create) && (newinode)) { } else if (!(posix_create) && (newinode)) {
struct cifsFileInfo *pfile_info;
/* /*
* cifs_fill_filedata() takes care of setting cifsFileInfo * cifs_fill_filedata() takes care of setting cifsFileInfo
* pointer to file->private_data. * pointer to file->private_data.
*/ */
cifs_new_fileinfo(newinode, fileHandle, NULL, nd->path.mnt, pfile_info = cifs_new_fileinfo(newinode, fileHandle, NULL,
oflags); nd->path.mnt, oflags);
if (pfile_info == NULL)
rc = -ENOMEM;
} }
cifs_create_out: cifs_create_out:
kfree(buf); kfree(buf);