diff options
author | Jeff Layton <jlayton@redhat.com> | 2009-04-17 11:45:30 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2009-04-17 17:08:15 -0400 |
commit | fc6f394332ef1bf6ff5fbeaba0f2cd7a3c7971b6 (patch) | |
tree | 86cccb6f28f84355d348bad27fa55d5c377d6660 /fs/cifs/inode.c | |
parent | 22c9d52bc03b880045ab1081890a38f11b272ae7 (diff) |
cifs: when renaming don't try to unlink negative dentry
When attempting to rename a file on a read-only share, the kernel can
call cifs_unlink on a negative dentry, which causes an oops. Only try
to unlink the file if it's a positive dentry.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Tested-by: Shirish Pargaonkar <shirishp@us.ibm.com>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r-- | fs/cifs/inode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 09082ac85185..f36b4e40e443 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1453,7 +1453,8 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry, | |||
1453 | checking the UniqueId via FILE_INTERNAL_INFO */ | 1453 | checking the UniqueId via FILE_INTERNAL_INFO */ |
1454 | 1454 | ||
1455 | unlink_target: | 1455 | unlink_target: |
1456 | if ((rc == -EACCES) || (rc == -EEXIST)) { | 1456 | /* Try unlinking the target dentry if it's not negative */ |
1457 | if (target_dentry->d_inode && (rc == -EACCES || rc == -EEXIST)) { | ||
1457 | tmprc = cifs_unlink(target_dir, target_dentry); | 1458 | tmprc = cifs_unlink(target_dir, target_dentry); |
1458 | if (tmprc) | 1459 | if (tmprc) |
1459 | goto cifs_rename_exit; | 1460 | goto cifs_rename_exit; |