Commit de036dca authored by Volker Lendecke's avatar Volker Lendecke Committed by Steve French

cifs: Fix uninitialized memory reads for oparms.mode

Use a struct assignment with implicit member initialization
Signed-off-by: default avatarVolker Lendecke <vl@samba.org>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 5574920c
...@@ -181,12 +181,13 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, ...@@ -181,12 +181,13 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
rqst[0].rq_iov = open_iov; rqst[0].rq_iov = open_iov;
rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE; rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_FILE); .tcon = tcon,
oparms.desired_access = FILE_READ_ATTRIBUTES; .create_options = cifs_create_options(cifs_sb, CREATE_NOT_FILE),
oparms.disposition = FILE_OPEN; .desired_access = FILE_READ_ATTRIBUTES,
oparms.fid = pfid; .disposition = FILE_OPEN,
oparms.reconnect = false; .fid = pfid,
};
rc = SMB2_open_init(tcon, server, rc = SMB2_open_init(tcon, server,
&rqst[0], &oplock, &oparms, utf16_path); &rqst[0], &oplock, &oparms, utf16_path);
......
...@@ -1428,14 +1428,15 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, ...@@ -1428,14 +1428,15 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
tcon = tlink_tcon(tlink); tcon = tlink_tcon(tlink);
xid = get_xid(); xid = get_xid();
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = READ_CONTROL; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, 0); .desired_access = READ_CONTROL,
oparms.disposition = FILE_OPEN; .create_options = cifs_create_options(cifs_sb, 0),
oparms.path = path; .disposition = FILE_OPEN,
oparms.fid = &fid; .path = path,
oparms.reconnect = false; .fid = &fid,
};
rc = CIFS_open(xid, &oparms, &oplock, NULL); rc = CIFS_open(xid, &oparms, &oplock, NULL);
if (!rc) { if (!rc) {
...@@ -1494,14 +1495,15 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, ...@@ -1494,14 +1495,15 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
else else
access_flags = WRITE_DAC; access_flags = WRITE_DAC;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = access_flags; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, 0); .desired_access = access_flags,
oparms.disposition = FILE_OPEN; .create_options = cifs_create_options(cifs_sb, 0),
oparms.path = path; .disposition = FILE_OPEN,
oparms.fid = &fid; .path = path,
oparms.reconnect = false; .fid = &fid,
};
rc = CIFS_open(xid, &oparms, &oplock, NULL); rc = CIFS_open(xid, &oparms, &oplock, NULL);
if (rc) { if (rc) {
......
...@@ -5372,14 +5372,15 @@ CIFSSMBSetPathInfoFB(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -5372,14 +5372,15 @@ CIFSSMBSetPathInfoFB(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_fid fid; struct cifs_fid fid;
int rc; int rc;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = GENERIC_WRITE; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, 0); .desired_access = GENERIC_WRITE,
oparms.disposition = FILE_OPEN; .create_options = cifs_create_options(cifs_sb, 0),
oparms.path = fileName; .disposition = FILE_OPEN,
oparms.fid = &fid; .path = fileName,
oparms.reconnect = false; .fid = &fid,
};
rc = CIFS_open(xid, &oparms, &oplock, NULL); rc = CIFS_open(xid, &oparms, &oplock, NULL);
if (rc) if (rc)
......
...@@ -304,15 +304,16 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned ...@@ -304,15 +304,16 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
if (!tcon->unix_ext && (mode & S_IWUGO) == 0) if (!tcon->unix_ext && (mode & S_IWUGO) == 0)
create_options |= CREATE_OPTION_READONLY; create_options |= CREATE_OPTION_READONLY;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = desired_access; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, create_options); .desired_access = desired_access,
oparms.disposition = disposition; .create_options = cifs_create_options(cifs_sb, create_options),
oparms.path = full_path; .disposition = disposition,
oparms.fid = fid; .path = full_path,
oparms.reconnect = false; .fid = fid,
oparms.mode = mode; .mode = mode,
};
rc = server->ops->open(xid, &oparms, oplock, buf); rc = server->ops->open(xid, &oparms, oplock, buf);
if (rc) { if (rc) {
cifs_dbg(FYI, "cifs_create returned 0x%x\n", rc); cifs_dbg(FYI, "cifs_create returned 0x%x\n", rc);
......
...@@ -260,14 +260,15 @@ static int cifs_nt_open(const char *full_path, struct inode *inode, struct cifs_ ...@@ -260,14 +260,15 @@ static int cifs_nt_open(const char *full_path, struct inode *inode, struct cifs_
if (f_flags & O_DIRECT) if (f_flags & O_DIRECT)
create_options |= CREATE_NO_BUFFER; create_options |= CREATE_NO_BUFFER;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = desired_access; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, create_options); .desired_access = desired_access,
oparms.disposition = disposition; .create_options = cifs_create_options(cifs_sb, create_options),
oparms.path = full_path; .disposition = disposition,
oparms.fid = fid; .path = full_path,
oparms.reconnect = false; .fid = fid,
};
rc = server->ops->open(xid, &oparms, oplock, buf); rc = server->ops->open(xid, &oparms, oplock, buf);
if (rc) if (rc)
...@@ -848,14 +849,16 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) ...@@ -848,14 +849,16 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
if (server->ops->get_lease_key) if (server->ops->get_lease_key)
server->ops->get_lease_key(inode, &cfile->fid); server->ops->get_lease_key(inode, &cfile->fid);
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = desired_access; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, create_options); .desired_access = desired_access,
oparms.disposition = disposition; .create_options = cifs_create_options(cifs_sb, create_options),
oparms.path = full_path; .disposition = disposition,
oparms.fid = &cfile->fid; .path = full_path,
oparms.reconnect = true; .fid = &cfile->fid,
.reconnect = true,
};
/* /*
* Can not refresh inode by passing in file_info buf to be returned by * Can not refresh inode by passing in file_info buf to be returned by
......
...@@ -508,14 +508,15 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path, ...@@ -508,14 +508,15 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
return PTR_ERR(tlink); return PTR_ERR(tlink);
tcon = tlink_tcon(tlink); tcon = tlink_tcon(tlink);
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = GENERIC_READ; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR); .desired_access = GENERIC_READ,
oparms.disposition = FILE_OPEN; .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR),
oparms.path = path; .disposition = FILE_OPEN,
oparms.fid = &fid; .path = path,
oparms.reconnect = false; .fid = &fid,
};
if (tcon->ses->server->oplocks) if (tcon->ses->server->oplocks)
oplock = REQ_OPLOCK; oplock = REQ_OPLOCK;
...@@ -1518,14 +1519,15 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, ...@@ -1518,14 +1519,15 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
goto out; goto out;
} }
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = DELETE | FILE_WRITE_ATTRIBUTES; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR); .desired_access = DELETE | FILE_WRITE_ATTRIBUTES,
oparms.disposition = FILE_OPEN; .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR),
oparms.path = full_path; .disposition = FILE_OPEN,
oparms.fid = &fid; .path = full_path,
oparms.reconnect = false; .fid = &fid,
};
rc = CIFS_open(xid, &oparms, &oplock, NULL); rc = CIFS_open(xid, &oparms, &oplock, NULL);
if (rc != 0) if (rc != 0)
...@@ -2112,15 +2114,16 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry, ...@@ -2112,15 +2114,16 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry,
if (to_dentry->d_parent != from_dentry->d_parent) if (to_dentry->d_parent != from_dentry->d_parent)
goto do_rename_exit; goto do_rename_exit;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
/* open the file to be renamed -- we need DELETE perms */ .cifs_sb = cifs_sb,
oparms.desired_access = DELETE; /* open the file to be renamed -- we need DELETE perms */
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR); .desired_access = DELETE,
oparms.disposition = FILE_OPEN; .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR),
oparms.path = from_path; .disposition = FILE_OPEN,
oparms.fid = &fid; .path = from_path,
oparms.reconnect = false; .fid = &fid,
};
rc = CIFS_open(xid, &oparms, &oplock, NULL); rc = CIFS_open(xid, &oparms, &oplock, NULL);
if (rc == 0) { if (rc == 0) {
......
...@@ -271,14 +271,15 @@ cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, ...@@ -271,14 +271,15 @@ cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
int buf_type = CIFS_NO_BUFFER; int buf_type = CIFS_NO_BUFFER;
FILE_ALL_INFO file_info; FILE_ALL_INFO file_info;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = GENERIC_READ; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR); .desired_access = GENERIC_READ,
oparms.disposition = FILE_OPEN; .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR),
oparms.path = path; .disposition = FILE_OPEN,
oparms.fid = &fid; .path = path,
oparms.reconnect = false; .fid = &fid,
};
rc = CIFS_open(xid, &oparms, &oplock, &file_info); rc = CIFS_open(xid, &oparms, &oplock, &file_info);
if (rc) if (rc)
...@@ -313,14 +314,15 @@ cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, ...@@ -313,14 +314,15 @@ cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
struct cifs_open_parms oparms; struct cifs_open_parms oparms;
struct cifs_io_parms io_parms = {0}; struct cifs_io_parms io_parms = {0};
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = GENERIC_WRITE; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR); .desired_access = GENERIC_WRITE,
oparms.disposition = FILE_CREATE; .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR),
oparms.path = path; .disposition = FILE_CREATE,
oparms.fid = &fid; .path = path,
oparms.reconnect = false; .fid = &fid,
};
rc = CIFS_open(xid, &oparms, &oplock, NULL); rc = CIFS_open(xid, &oparms, &oplock, NULL);
if (rc) if (rc)
...@@ -355,13 +357,14 @@ smb3_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, ...@@ -355,13 +357,14 @@ smb3_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
__u8 oplock = SMB2_OPLOCK_LEVEL_NONE; __u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
struct smb2_file_all_info *pfile_info = NULL; struct smb2_file_all_info *pfile_info = NULL;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = GENERIC_READ; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR); .desired_access = GENERIC_READ,
oparms.disposition = FILE_OPEN; .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR),
oparms.fid = &fid; .disposition = FILE_OPEN,
oparms.reconnect = false; .fid = &fid,
};
utf16_path = cifs_convert_path_to_utf16(path, cifs_sb); utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
if (utf16_path == NULL) if (utf16_path == NULL)
...@@ -421,14 +424,15 @@ smb3_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, ...@@ -421,14 +424,15 @@ smb3_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
if (!utf16_path) if (!utf16_path)
return -ENOMEM; return -ENOMEM;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = GENERIC_WRITE; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR); .desired_access = GENERIC_WRITE,
oparms.disposition = FILE_CREATE; .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR),
oparms.fid = &fid; .disposition = FILE_CREATE,
oparms.reconnect = false; .fid = &fid,
oparms.mode = 0644; .mode = 0644,
};
rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL,
NULL, NULL); NULL, NULL);
......
...@@ -576,14 +576,15 @@ static int cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -576,14 +576,15 @@ static int cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
if (!(le32_to_cpu(fi.Attributes) & ATTR_REPARSE)) if (!(le32_to_cpu(fi.Attributes) & ATTR_REPARSE))
return 0; return 0;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = FILE_READ_ATTRIBUTES; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, 0); .desired_access = FILE_READ_ATTRIBUTES,
oparms.disposition = FILE_OPEN; .create_options = cifs_create_options(cifs_sb, 0),
oparms.path = full_path; .disposition = FILE_OPEN,
oparms.fid = &fid; .path = full_path,
oparms.reconnect = false; .fid = &fid,
};
/* Need to check if this is a symbolic link or not */ /* Need to check if this is a symbolic link or not */
tmprc = CIFS_open(xid, &oparms, &oplock, NULL); tmprc = CIFS_open(xid, &oparms, &oplock, NULL);
...@@ -823,14 +824,15 @@ smb_set_file_info(struct inode *inode, const char *full_path, ...@@ -823,14 +824,15 @@ smb_set_file_info(struct inode *inode, const char *full_path,
goto out; goto out;
} }
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = SYNCHRONIZE | FILE_WRITE_ATTRIBUTES; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR); .desired_access = SYNCHRONIZE | FILE_WRITE_ATTRIBUTES,
oparms.disposition = FILE_OPEN; .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR),
oparms.path = full_path; .disposition = FILE_OPEN,
oparms.fid = &fid; .path = full_path,
oparms.reconnect = false; .fid = &fid,
};
cifs_dbg(FYI, "calling SetFileInfo since SetPathInfo for times not supported by this server\n"); cifs_dbg(FYI, "calling SetFileInfo since SetPathInfo for times not supported by this server\n");
rc = CIFS_open(xid, &oparms, &oplock, NULL); rc = CIFS_open(xid, &oparms, &oplock, NULL);
...@@ -998,15 +1000,16 @@ cifs_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -998,15 +1000,16 @@ cifs_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
goto out; goto out;
} }
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = FILE_READ_ATTRIBUTES; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, .desired_access = FILE_READ_ATTRIBUTES,
OPEN_REPARSE_POINT); .create_options = cifs_create_options(cifs_sb,
oparms.disposition = FILE_OPEN; OPEN_REPARSE_POINT),
oparms.path = full_path; .disposition = FILE_OPEN,
oparms.fid = &fid; .path = full_path,
oparms.reconnect = false; .fid = &fid,
};
rc = CIFS_open(xid, &oparms, &oplock, NULL); rc = CIFS_open(xid, &oparms, &oplock, NULL);
if (rc) if (rc)
...@@ -1115,15 +1118,16 @@ cifs_make_node(unsigned int xid, struct inode *inode, ...@@ -1115,15 +1118,16 @@ cifs_make_node(unsigned int xid, struct inode *inode,
cifs_dbg(FYI, "sfu compat create special file\n"); cifs_dbg(FYI, "sfu compat create special file\n");
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = GENERIC_WRITE; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR | .desired_access = GENERIC_WRITE,
CREATE_OPTION_SPECIAL); .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR |
oparms.disposition = FILE_CREATE; CREATE_OPTION_SPECIAL),
oparms.path = full_path; .disposition = FILE_CREATE,
oparms.fid = &fid; .path = full_path,
oparms.reconnect = false; .fid = &fid,
};
if (tcon->ses->server->oplocks) if (tcon->ses->server->oplocks)
oplock = REQ_OPLOCK; oplock = REQ_OPLOCK;
......
...@@ -105,14 +105,15 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -105,14 +105,15 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
goto finished; goto finished;
} }
vars->oparms.tcon = tcon; vars->oparms = (struct cifs_open_parms) {
vars->oparms.desired_access = desired_access; .tcon = tcon,
vars->oparms.disposition = create_disposition; .desired_access = desired_access,
vars->oparms.create_options = cifs_create_options(cifs_sb, create_options); .disposition = create_disposition,
vars->oparms.fid = &fid; .create_options = cifs_create_options(cifs_sb, create_options),
vars->oparms.reconnect = false; .fid = &fid,
vars->oparms.mode = mode; .mode = mode,
vars->oparms.cifs_sb = cifs_sb; .cifs_sb = cifs_sb,
};
rqst[num_rqst].rq_iov = &vars->open_iov[0]; rqst[num_rqst].rq_iov = &vars->open_iov[0];
rqst[num_rqst].rq_nvec = SMB2_CREATE_IOV_SIZE; rqst[num_rqst].rq_nvec = SMB2_CREATE_IOV_SIZE;
......
...@@ -772,12 +772,13 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -772,12 +772,13 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_open_parms oparms; struct cifs_open_parms oparms;
struct cifs_fid fid; struct cifs_fid fid;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.desired_access = FILE_READ_ATTRIBUTES; .tcon = tcon,
oparms.disposition = FILE_OPEN; .desired_access = FILE_READ_ATTRIBUTES,
oparms.create_options = cifs_create_options(cifs_sb, 0); .disposition = FILE_OPEN,
oparms.fid = &fid; .create_options = cifs_create_options(cifs_sb, 0),
oparms.reconnect = false; .fid = &fid,
};
rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL, rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL,
NULL, NULL); NULL, NULL);
...@@ -817,12 +818,13 @@ smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -817,12 +818,13 @@ smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
if (!utf16_path) if (!utf16_path)
return -ENOMEM; return -ENOMEM;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.desired_access = FILE_READ_ATTRIBUTES; .tcon = tcon,
oparms.disposition = FILE_OPEN; .desired_access = FILE_READ_ATTRIBUTES,
oparms.create_options = cifs_create_options(cifs_sb, 0); .disposition = FILE_OPEN,
oparms.fid = &fid; .create_options = cifs_create_options(cifs_sb, 0),
oparms.reconnect = false; .fid = &fid,
};
rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL,
&err_iov, &err_buftype); &err_iov, &err_buftype);
...@@ -1098,13 +1100,13 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -1098,13 +1100,13 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
rqst[0].rq_iov = open_iov; rqst[0].rq_iov = open_iov;
rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE; rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
memset(&oparms, 0, sizeof(oparms)); oparms = (struct cifs_open_parms) {
oparms.tcon = tcon; .tcon = tcon,
oparms.desired_access = FILE_WRITE_EA; .desired_access = FILE_WRITE_EA,
oparms.disposition = FILE_OPEN; .disposition = FILE_OPEN,
oparms.create_options = cifs_create_options(cifs_sb, 0); .create_options = cifs_create_options(cifs_sb, 0),
oparms.fid = &fid; .fid = &fid,
oparms.reconnect = false; };
rc = SMB2_open_init(tcon, server, rc = SMB2_open_init(tcon, server,
&rqst[0], &oplock, &oparms, utf16_path); &rqst[0], &oplock, &oparms, utf16_path);
...@@ -1454,12 +1456,12 @@ smb2_ioctl_query_info(const unsigned int xid, ...@@ -1454,12 +1456,12 @@ smb2_ioctl_query_info(const unsigned int xid,
rqst[0].rq_iov = &vars->open_iov[0]; rqst[0].rq_iov = &vars->open_iov[0];
rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE; rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
memset(&oparms, 0, sizeof(oparms)); oparms = (struct cifs_open_parms) {
oparms.tcon = tcon; .tcon = tcon,
oparms.disposition = FILE_OPEN; .disposition = FILE_OPEN,
oparms.create_options = cifs_create_options(cifs_sb, create_options); .create_options = cifs_create_options(cifs_sb, create_options),
oparms.fid = &fid; .fid = &fid,
oparms.reconnect = false; };
if (qi.flags & PASSTHRU_FSCTL) { if (qi.flags & PASSTHRU_FSCTL) {
switch (qi.info_type & FSCTL_DEVICE_ACCESS_MASK) { switch (qi.info_type & FSCTL_DEVICE_ACCESS_MASK) {
...@@ -2089,12 +2091,13 @@ smb3_notify(const unsigned int xid, struct file *pfile, ...@@ -2089,12 +2091,13 @@ smb3_notify(const unsigned int xid, struct file *pfile,
} }
tcon = cifs_sb_master_tcon(cifs_sb); tcon = cifs_sb_master_tcon(cifs_sb);
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA; .tcon = tcon,
oparms.disposition = FILE_OPEN; .desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA,
oparms.create_options = cifs_create_options(cifs_sb, 0); .disposition = FILE_OPEN,
oparms.fid = &fid; .create_options = cifs_create_options(cifs_sb, 0),
oparms.reconnect = false; .fid = &fid,
};
rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, NULL, rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, NULL,
NULL); NULL);
...@@ -2160,12 +2163,13 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -2160,12 +2163,13 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
rqst[0].rq_iov = open_iov; rqst[0].rq_iov = open_iov;
rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE; rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA; .tcon = tcon,
oparms.disposition = FILE_OPEN; .desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA,
oparms.create_options = cifs_create_options(cifs_sb, 0); .disposition = FILE_OPEN,
oparms.fid = fid; .create_options = cifs_create_options(cifs_sb, 0),
oparms.reconnect = false; .fid = fid,
};
rc = SMB2_open_init(tcon, server, rc = SMB2_open_init(tcon, server,
&rqst[0], &oplock, &oparms, utf16_path); &rqst[0], &oplock, &oparms, utf16_path);
...@@ -2491,12 +2495,13 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -2491,12 +2495,13 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
rqst[0].rq_iov = open_iov; rqst[0].rq_iov = open_iov;
rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE; rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.desired_access = desired_access; .tcon = tcon,
oparms.disposition = FILE_OPEN; .desired_access = desired_access,
oparms.create_options = cifs_create_options(cifs_sb, 0); .disposition = FILE_OPEN,
oparms.fid = &fid; .create_options = cifs_create_options(cifs_sb, 0),
oparms.reconnect = false; .fid = &fid,
};
rc = SMB2_open_init(tcon, server, rc = SMB2_open_init(tcon, server,
&rqst[0], &oplock, &oparms, utf16_path); &rqst[0], &oplock, &oparms, utf16_path);
...@@ -2624,12 +2629,13 @@ smb311_queryfs(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -2624,12 +2629,13 @@ smb311_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
if (!tcon->posix_extensions) if (!tcon->posix_extensions)
return smb2_queryfs(xid, tcon, cifs_sb, buf); return smb2_queryfs(xid, tcon, cifs_sb, buf);
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.desired_access = FILE_READ_ATTRIBUTES; .tcon = tcon,
oparms.disposition = FILE_OPEN; .desired_access = FILE_READ_ATTRIBUTES,
oparms.create_options = cifs_create_options(cifs_sb, 0); .disposition = FILE_OPEN,
oparms.fid = &fid; .create_options = cifs_create_options(cifs_sb, 0),
oparms.reconnect = false; .fid = &fid,
};
rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL, rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL,
NULL, NULL); NULL, NULL);
...@@ -2917,13 +2923,13 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -2917,13 +2923,13 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
rqst[0].rq_iov = open_iov; rqst[0].rq_iov = open_iov;
rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE; rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
memset(&oparms, 0, sizeof(oparms)); oparms = (struct cifs_open_parms) {
oparms.tcon = tcon; .tcon = tcon,
oparms.desired_access = FILE_READ_ATTRIBUTES; .desired_access = FILE_READ_ATTRIBUTES,
oparms.disposition = FILE_OPEN; .disposition = FILE_OPEN,
oparms.create_options = cifs_create_options(cifs_sb, create_options); .create_options = cifs_create_options(cifs_sb, create_options),
oparms.fid = &fid; .fid = &fid,
oparms.reconnect = false; };
rc = SMB2_open_init(tcon, server, rc = SMB2_open_init(tcon, server,
&rqst[0], &oplock, &oparms, utf16_path); &rqst[0], &oplock, &oparms, utf16_path);
...@@ -3057,13 +3063,13 @@ smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -3057,13 +3063,13 @@ smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
rqst[0].rq_iov = open_iov; rqst[0].rq_iov = open_iov;
rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE; rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
memset(&oparms, 0, sizeof(oparms)); oparms = (struct cifs_open_parms) {
oparms.tcon = tcon; .tcon = tcon,
oparms.desired_access = FILE_READ_ATTRIBUTES; .desired_access = FILE_READ_ATTRIBUTES,
oparms.disposition = FILE_OPEN; .disposition = FILE_OPEN,
oparms.create_options = cifs_create_options(cifs_sb, OPEN_REPARSE_POINT); .create_options = cifs_create_options(cifs_sb, OPEN_REPARSE_POINT),
oparms.fid = &fid; .fid = &fid,
oparms.reconnect = false; };
rc = SMB2_open_init(tcon, server, rc = SMB2_open_init(tcon, server,
&rqst[0], &oplock, &oparms, utf16_path); &rqst[0], &oplock, &oparms, utf16_path);
...@@ -3197,17 +3203,20 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb, ...@@ -3197,17 +3203,20 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
return ERR_PTR(rc); return ERR_PTR(rc);
} }
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.desired_access = READ_CONTROL; .tcon = tcon,
oparms.disposition = FILE_OPEN; .desired_access = READ_CONTROL,
/* .disposition = FILE_OPEN,
* When querying an ACL, even if the file is a symlink we want to open /*
* the source not the target, and so the protocol requires that the * When querying an ACL, even if the file is a symlink
* client specify this flag when opening a reparse point * we want to open the source not the target, and so
*/ * the protocol requires that the client specify this
oparms.create_options = cifs_create_options(cifs_sb, 0) | OPEN_REPARSE_POINT; * flag when opening a reparse point
oparms.fid = &fid; */
oparms.reconnect = false; .create_options = cifs_create_options(cifs_sb, 0) |
OPEN_REPARSE_POINT,
.fid = &fid,
};
if (info & SACL_SECINFO) if (info & SACL_SECINFO)
oparms.desired_access |= SYSTEM_SECURITY; oparms.desired_access |= SYSTEM_SECURITY;
...@@ -3266,13 +3275,14 @@ set_smb2_acl(struct cifs_ntsd *pnntsd, __u32 acllen, ...@@ -3266,13 +3275,14 @@ set_smb2_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
return rc; return rc;
} }
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.desired_access = access_flags; .tcon = tcon,
oparms.create_options = cifs_create_options(cifs_sb, 0); .desired_access = access_flags,
oparms.disposition = FILE_OPEN; .create_options = cifs_create_options(cifs_sb, 0),
oparms.path = path; .disposition = FILE_OPEN,
oparms.fid = &fid; .path = path,
oparms.reconnect = false; .fid = &fid,
};
rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL,
NULL, NULL); NULL, NULL);
...@@ -5139,15 +5149,16 @@ smb2_make_node(unsigned int xid, struct inode *inode, ...@@ -5139,15 +5149,16 @@ smb2_make_node(unsigned int xid, struct inode *inode,
cifs_dbg(FYI, "sfu compat create special file\n"); cifs_dbg(FYI, "sfu compat create special file\n");
oparms.tcon = tcon; oparms = (struct cifs_open_parms) {
oparms.cifs_sb = cifs_sb; .tcon = tcon,
oparms.desired_access = GENERIC_WRITE; .cifs_sb = cifs_sb,
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR | .desired_access = GENERIC_WRITE,
CREATE_OPTION_SPECIAL); .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR |
oparms.disposition = FILE_CREATE; CREATE_OPTION_SPECIAL),
oparms.path = full_path; .disposition = FILE_CREATE,
oparms.fid = &fid; .path = full_path,
oparms.reconnect = false; .fid = &fid,
};
if (tcon->ses->server->oplocks) if (tcon->ses->server->oplocks)
oplock = REQ_OPLOCK; oplock = REQ_OPLOCK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment