Skip to content

Commit

Permalink
CIFS: Fix cifs_do_create error hadnling
Browse files Browse the repository at this point in the history
Commit d2c1271 caused a regression
in cifs_do_create error handling. Fix this by closing a file handle
in the case of a get_inode_info(_unix) error. Also remove unnecessary
checks for newinode being NULL.

Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
  • Loading branch information
Pavel Shilovsky authored and Steve French committed Aug 20, 2012
1 parent 985e4ff commit ea7b488
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions fs/cifs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,19 +356,12 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
cifs_create_set_dentry:
if (rc != 0) {
cFYI(1, "Create worked, get_inode_info failed rc = %d", rc);
CIFSSMBClose(xid, tcon, *fileHandle);
goto out;
}
d_drop(direntry);
d_add(direntry, newinode);

/* ENOENT for create? How weird... */
rc = -ENOENT;
if (!newinode) {
CIFSSMBClose(xid, tcon, *fileHandle);
goto out;
}
rc = 0;

out:
kfree(buf);
kfree(full_path);
Expand Down

0 comments on commit ea7b488

Please sign in to comment.