diff options
author | Steve French <sfrench@us.ibm.com> | 2010-04-22 15:21:55 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-04-22 15:21:55 -0400 |
commit | fa588e0c57048b3d4bfcd772d80dc0615f83fd35 (patch) | |
tree | a357298481dc4a8ab7f00998b065b9fee7e36d20 /fs/cifs/file.c | |
parent | 2c964d1f7c87eb71f7902111cd7c8fbba225e4b6 (diff) |
[CIFS] Allow null nd (as nfs server uses) on create
While creating a file on a server which supports unix extensions
such as Samba, if a file is being created which does not supply
nameidata (i.e. nd is null), cifs client can oops when calling
cifs_posix_open.
Signed-off-by: Shirish Pargaonkar <shirishp@us.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 2ba4c41be972..5f1f7682256b 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -298,10 +298,12 @@ int cifs_open(struct inode *inode, struct file *file) | |||
298 | (CIFS_UNIX_POSIX_PATH_OPS_CAP & | 298 | (CIFS_UNIX_POSIX_PATH_OPS_CAP & |
299 | le64_to_cpu(tcon->fsUnixInfo.Capability))) { | 299 | le64_to_cpu(tcon->fsUnixInfo.Capability))) { |
300 | int oflags = (int) cifs_posix_convert_flags(file->f_flags); | 300 | int oflags = (int) cifs_posix_convert_flags(file->f_flags); |
301 | oflags |= SMB_O_CREAT; | ||
301 | /* can not refresh inode info since size could be stale */ | 302 | /* can not refresh inode info since size could be stale */ |
302 | rc = cifs_posix_open(full_path, &inode, file->f_path.mnt, | 303 | rc = cifs_posix_open(full_path, &inode, file->f_path.mnt, |
303 | cifs_sb->mnt_file_mode /* ignored */, | 304 | inode->i_sb, |
304 | oflags, &oplock, &netfid, xid); | 305 | cifs_sb->mnt_file_mode /* ignored */, |
306 | oflags, &oplock, &netfid, xid); | ||
305 | if (rc == 0) { | 307 | if (rc == 0) { |
306 | cFYI(1, "posix open succeeded"); | 308 | cFYI(1, "posix open succeeded"); |
307 | /* no need for special case handling of setting mode | 309 | /* no need for special case handling of setting mode |
@@ -513,8 +515,9 @@ reopen_error_exit: | |||
513 | int oflags = (int) cifs_posix_convert_flags(file->f_flags); | 515 | int oflags = (int) cifs_posix_convert_flags(file->f_flags); |
514 | /* can not refresh inode info since size could be stale */ | 516 | /* can not refresh inode info since size could be stale */ |
515 | rc = cifs_posix_open(full_path, NULL, file->f_path.mnt, | 517 | rc = cifs_posix_open(full_path, NULL, file->f_path.mnt, |
516 | cifs_sb->mnt_file_mode /* ignored */, | 518 | inode->i_sb, |
517 | oflags, &oplock, &netfid, xid); | 519 | cifs_sb->mnt_file_mode /* ignored */, |
520 | oflags, &oplock, &netfid, xid); | ||
518 | if (rc == 0) { | 521 | if (rc == 0) { |
519 | cFYI(1, "posix reopen succeeded"); | 522 | cFYI(1, "posix reopen succeeded"); |
520 | goto reopen_success; | 523 | goto reopen_success; |