Skip to content

Commit

Permalink
cifs: propagate cifs_new_fileinfo() error back to the caller
Browse files Browse the repository at this point in the history
..otherwise memory allocation errors go undetected.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
  • Loading branch information
Suresh Jayaraman authored and Steve French committed May 11, 2010
1 parent fae683f commit fdb3603
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions fs/cifs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -476,12 +482,15 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
/* 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);
Expand Down

0 comments on commit fdb3603

Please sign in to comment.