diff options
| author | Suresh Jayaraman <sjayaraman@suse.de> | 2010-05-11 00:16:46 -0400 |
|---|---|---|
| committer | Steve French <sfrench@us.ibm.com> | 2010-05-11 11:42:21 -0400 |
| commit | fdb3603800e7a65bc3cafdfd5a1797d08f09e582 (patch) | |
| tree | 86224ad3eaddc15da3306eea8887c15b2341ae3d | |
| parent | fae683f764f91f31ab45512e70cc8cc81d4d157b (diff) | |
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>
| -rw-r--r-- | fs/cifs/dir.c | 17 |
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, | |||
| 261 | * cifs_fill_filedata() takes care of setting cifsFileInfo pointer to | 261 | * cifs_fill_filedata() takes care of setting cifsFileInfo pointer to |
| 262 | * file->private_data. | 262 | * file->private_data. |
| 263 | */ | 263 | */ |
| 264 | if (mnt) | 264 | if (mnt) { |
| 265 | cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt, oflags); | 265 | struct cifsFileInfo *pfile_info; |
| 266 | |||
| 267 | pfile_info = cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt, | ||
| 268 | oflags); | ||
| 269 | if (pfile_info == NULL) | ||
| 270 | rc = -ENOMEM; | ||
| 271 | } | ||
| 266 | 272 | ||
| 267 | posix_open_ret: | 273 | posix_open_ret: |
| 268 | kfree(presp_data); | 274 | kfree(presp_data); |
| @@ -476,12 +482,15 @@ cifs_create_set_dentry: | |||
| 476 | /* mknod case - do not leave file open */ | 482 | /* mknod case - do not leave file open */ |
| 477 | CIFSSMBClose(xid, tcon, fileHandle); | 483 | CIFSSMBClose(xid, tcon, fileHandle); |
| 478 | } else if (!(posix_create) && (newinode)) { | 484 | } else if (!(posix_create) && (newinode)) { |
| 485 | struct cifsFileInfo *pfile_info; | ||
| 479 | /* | 486 | /* |
| 480 | * cifs_fill_filedata() takes care of setting cifsFileInfo | 487 | * cifs_fill_filedata() takes care of setting cifsFileInfo |
| 481 | * pointer to file->private_data. | 488 | * pointer to file->private_data. |
| 482 | */ | 489 | */ |
| 483 | cifs_new_fileinfo(newinode, fileHandle, NULL, nd->path.mnt, | 490 | pfile_info = cifs_new_fileinfo(newinode, fileHandle, NULL, |
| 484 | oflags); | 491 | nd->path.mnt, oflags); |
| 492 | if (pfile_info == NULL) | ||
| 493 | rc = -ENOMEM; | ||
| 485 | } | 494 | } |
| 486 | cifs_create_out: | 495 | cifs_create_out: |
| 487 | kfree(buf); | 496 | kfree(buf); |
