Commit c22180a5 authored by Al Viro's avatar Al Viro Committed by Steve French

ksmbd: constify struct path

... in particular, there should never be a non-const pointers to
any file->f_path.
Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 369c1634
...@@ -159,7 +159,7 @@ int parse_stream_name(char *filename, char **stream_name, int *s_type) ...@@ -159,7 +159,7 @@ int parse_stream_name(char *filename, char **stream_name, int *s_type)
*/ */
char *convert_to_nt_pathname(struct ksmbd_share_config *share, char *convert_to_nt_pathname(struct ksmbd_share_config *share,
struct path *path) const struct path *path)
{ {
char *pathname, *ab_pathname, *nt_pathname; char *pathname, *ab_pathname, *nt_pathname;
int share_path_len = share->path_sz; int share_path_len = share->path_sz;
......
...@@ -15,7 +15,7 @@ int match_pattern(const char *str, size_t len, const char *pattern); ...@@ -15,7 +15,7 @@ int match_pattern(const char *str, size_t len, const char *pattern);
int ksmbd_validate_filename(char *filename); int ksmbd_validate_filename(char *filename);
int parse_stream_name(char *filename, char **stream_name, int *s_type); int parse_stream_name(char *filename, char **stream_name, int *s_type);
char *convert_to_nt_pathname(struct ksmbd_share_config *share, char *convert_to_nt_pathname(struct ksmbd_share_config *share,
struct path *path); const struct path *path);
int get_nlink(struct kstat *st); int get_nlink(struct kstat *st);
void ksmbd_conv_path_to_unix(char *path); void ksmbd_conv_path_to_unix(char *path);
void ksmbd_strip_last_slash(char *path); void ksmbd_strip_last_slash(char *path);
......
...@@ -2185,7 +2185,7 @@ static noinline int create_smb2_pipe(struct ksmbd_work *work) ...@@ -2185,7 +2185,7 @@ static noinline int create_smb2_pipe(struct ksmbd_work *work)
* Return: 0 on success, otherwise error * Return: 0 on success, otherwise error
*/ */
static int smb2_set_ea(struct smb2_ea_info *eabuf, unsigned int buf_len, static int smb2_set_ea(struct smb2_ea_info *eabuf, unsigned int buf_len,
struct path *path) const struct path *path)
{ {
struct user_namespace *user_ns = mnt_user_ns(path->mnt); struct user_namespace *user_ns = mnt_user_ns(path->mnt);
char *attr_name = NULL, *value; char *attr_name = NULL, *value;
...@@ -2272,7 +2272,7 @@ static int smb2_set_ea(struct smb2_ea_info *eabuf, unsigned int buf_len, ...@@ -2272,7 +2272,7 @@ static int smb2_set_ea(struct smb2_ea_info *eabuf, unsigned int buf_len,
return rc; return rc;
} }
static noinline int smb2_set_stream_name_xattr(struct path *path, static noinline int smb2_set_stream_name_xattr(const struct path *path,
struct ksmbd_file *fp, struct ksmbd_file *fp,
char *stream_name, int s_type) char *stream_name, int s_type)
{ {
...@@ -2311,7 +2311,7 @@ static noinline int smb2_set_stream_name_xattr(struct path *path, ...@@ -2311,7 +2311,7 @@ static noinline int smb2_set_stream_name_xattr(struct path *path,
return 0; return 0;
} }
static int smb2_remove_smb_xattrs(struct path *path) static int smb2_remove_smb_xattrs(const struct path *path)
{ {
struct user_namespace *user_ns = mnt_user_ns(path->mnt); struct user_namespace *user_ns = mnt_user_ns(path->mnt);
char *name, *xattr_list = NULL; char *name, *xattr_list = NULL;
...@@ -2345,7 +2345,7 @@ static int smb2_remove_smb_xattrs(struct path *path) ...@@ -2345,7 +2345,7 @@ static int smb2_remove_smb_xattrs(struct path *path)
return err; return err;
} }
static int smb2_create_truncate(struct path *path) static int smb2_create_truncate(const struct path *path)
{ {
int rc = vfs_truncate(path, 0); int rc = vfs_truncate(path, 0);
...@@ -2364,7 +2364,7 @@ static int smb2_create_truncate(struct path *path) ...@@ -2364,7 +2364,7 @@ static int smb2_create_truncate(struct path *path)
return rc; return rc;
} }
static void smb2_new_xattrs(struct ksmbd_tree_connect *tcon, struct path *path, static void smb2_new_xattrs(struct ksmbd_tree_connect *tcon, const struct path *path,
struct ksmbd_file *fp) struct ksmbd_file *fp)
{ {
struct xattr_dos_attrib da = {0}; struct xattr_dos_attrib da = {0};
...@@ -2387,7 +2387,7 @@ static void smb2_new_xattrs(struct ksmbd_tree_connect *tcon, struct path *path, ...@@ -2387,7 +2387,7 @@ static void smb2_new_xattrs(struct ksmbd_tree_connect *tcon, struct path *path,
} }
static void smb2_update_xattrs(struct ksmbd_tree_connect *tcon, static void smb2_update_xattrs(struct ksmbd_tree_connect *tcon,
struct path *path, struct ksmbd_file *fp) const struct path *path, struct ksmbd_file *fp)
{ {
struct xattr_dos_attrib da; struct xattr_dos_attrib da;
int rc; int rc;
...@@ -2447,7 +2447,7 @@ static int smb2_creat(struct ksmbd_work *work, struct path *path, char *name, ...@@ -2447,7 +2447,7 @@ static int smb2_creat(struct ksmbd_work *work, struct path *path, char *name,
static int smb2_create_sd_buffer(struct ksmbd_work *work, static int smb2_create_sd_buffer(struct ksmbd_work *work,
struct smb2_create_req *req, struct smb2_create_req *req,
struct path *path) const struct path *path)
{ {
struct create_context *context; struct create_context *context;
struct create_sd_buf_req *sd_buf; struct create_sd_buf_req *sd_buf;
...@@ -4157,7 +4157,7 @@ static int smb2_get_ea(struct ksmbd_work *work, struct ksmbd_file *fp, ...@@ -4157,7 +4157,7 @@ static int smb2_get_ea(struct ksmbd_work *work, struct ksmbd_file *fp,
int rc, name_len, value_len, xattr_list_len, idx; int rc, name_len, value_len, xattr_list_len, idx;
ssize_t buf_free_len, alignment_bytes, next_offset, rsp_data_cnt = 0; ssize_t buf_free_len, alignment_bytes, next_offset, rsp_data_cnt = 0;
struct smb2_ea_info_req *ea_req = NULL; struct smb2_ea_info_req *ea_req = NULL;
struct path *path; const struct path *path;
struct user_namespace *user_ns = file_mnt_user_ns(fp->filp); struct user_namespace *user_ns = file_mnt_user_ns(fp->filp);
if (!(fp->daccess & FILE_READ_EA_LE)) { if (!(fp->daccess & FILE_READ_EA_LE)) {
...@@ -4494,7 +4494,7 @@ static void get_file_stream_info(struct ksmbd_work *work, ...@@ -4494,7 +4494,7 @@ static void get_file_stream_info(struct ksmbd_work *work,
struct smb2_file_stream_info *file_info; struct smb2_file_stream_info *file_info;
char *stream_name, *xattr_list = NULL, *stream_buf; char *stream_name, *xattr_list = NULL, *stream_buf;
struct kstat stat; struct kstat stat;
struct path *path = &fp->filp->f_path; const struct path *path = &fp->filp->f_path;
ssize_t xattr_list_len; ssize_t xattr_list_len;
int nbytes = 0, streamlen, stream_name_len, next, idx = 0; int nbytes = 0, streamlen, stream_name_len, next, idx = 0;
int buf_free_len; int buf_free_len;
......
...@@ -991,7 +991,7 @@ static void smb_set_ace(struct smb_ace *ace, const struct smb_sid *sid, u8 type, ...@@ -991,7 +991,7 @@ static void smb_set_ace(struct smb_ace *ace, const struct smb_sid *sid, u8 type,
} }
int smb_inherit_dacl(struct ksmbd_conn *conn, int smb_inherit_dacl(struct ksmbd_conn *conn,
struct path *path, const struct path *path,
unsigned int uid, unsigned int gid) unsigned int uid, unsigned int gid)
{ {
const struct smb_sid *psid, *creator = NULL; const struct smb_sid *psid, *creator = NULL;
...@@ -1185,7 +1185,7 @@ bool smb_inherit_flags(int flags, bool is_dir) ...@@ -1185,7 +1185,7 @@ bool smb_inherit_flags(int flags, bool is_dir)
return false; return false;
} }
int smb_check_perm_dacl(struct ksmbd_conn *conn, struct path *path, int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
__le32 *pdaccess, int uid) __le32 *pdaccess, int uid)
{ {
struct user_namespace *user_ns = mnt_user_ns(path->mnt); struct user_namespace *user_ns = mnt_user_ns(path->mnt);
...@@ -1352,7 +1352,7 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, struct path *path, ...@@ -1352,7 +1352,7 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, struct path *path,
} }
int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon, int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon,
struct path *path, struct smb_ntsd *pntsd, int ntsd_len, const struct path *path, struct smb_ntsd *pntsd, int ntsd_len,
bool type_check) bool type_check)
{ {
int rc; int rc;
......
...@@ -201,12 +201,12 @@ void posix_state_to_acl(struct posix_acl_state *state, ...@@ -201,12 +201,12 @@ void posix_state_to_acl(struct posix_acl_state *state,
struct posix_acl_entry *pace); struct posix_acl_entry *pace);
int compare_sids(const struct smb_sid *ctsid, const struct smb_sid *cwsid); int compare_sids(const struct smb_sid *ctsid, const struct smb_sid *cwsid);
bool smb_inherit_flags(int flags, bool is_dir); bool smb_inherit_flags(int flags, bool is_dir);
int smb_inherit_dacl(struct ksmbd_conn *conn, struct path *path, int smb_inherit_dacl(struct ksmbd_conn *conn, const struct path *path,
unsigned int uid, unsigned int gid); unsigned int uid, unsigned int gid);
int smb_check_perm_dacl(struct ksmbd_conn *conn, struct path *path, int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
__le32 *pdaccess, int uid); __le32 *pdaccess, int uid);
int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon, int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon,
struct path *path, struct smb_ntsd *pntsd, int ntsd_len, const struct path *path, struct smb_ntsd *pntsd, int ntsd_len,
bool type_check); bool type_check);
void id_to_sid(unsigned int cid, uint sidtype, struct smb_sid *ssid); void id_to_sid(unsigned int cid, uint sidtype, struct smb_sid *ssid);
void ksmbd_init_domain(u32 *sub_auth); void ksmbd_init_domain(u32 *sub_auth);
......
...@@ -541,7 +541,7 @@ int ksmbd_vfs_write(struct ksmbd_work *work, struct ksmbd_file *fp, ...@@ -541,7 +541,7 @@ int ksmbd_vfs_write(struct ksmbd_work *work, struct ksmbd_file *fp,
* *
* Return: 0 on success, otherwise error * Return: 0 on success, otherwise error
*/ */
int ksmbd_vfs_getattr(struct path *path, struct kstat *stat) int ksmbd_vfs_getattr(const struct path *path, struct kstat *stat)
{ {
int err; int err;
...@@ -1166,7 +1166,7 @@ static int __caseless_lookup(struct dir_context *ctx, const char *name, ...@@ -1166,7 +1166,7 @@ static int __caseless_lookup(struct dir_context *ctx, const char *name,
* *
* Return: 0 on success, otherwise error * Return: 0 on success, otherwise error
*/ */
static int ksmbd_vfs_lookup_in_dir(struct path *dir, char *name, size_t namelen) static int ksmbd_vfs_lookup_in_dir(const struct path *dir, char *name, size_t namelen)
{ {
int ret; int ret;
struct file *dfilp; struct file *dfilp;
......
...@@ -85,7 +85,7 @@ int ksmbd_vfs_fsync(struct ksmbd_work *work, u64 fid, u64 p_id); ...@@ -85,7 +85,7 @@ int ksmbd_vfs_fsync(struct ksmbd_work *work, u64 fid, u64 p_id);
int ksmbd_vfs_remove_file(struct ksmbd_work *work, char *name); int ksmbd_vfs_remove_file(struct ksmbd_work *work, char *name);
int ksmbd_vfs_link(struct ksmbd_work *work, int ksmbd_vfs_link(struct ksmbd_work *work,
const char *oldname, const char *newname); const char *oldname, const char *newname);
int ksmbd_vfs_getattr(struct path *path, struct kstat *stat); int ksmbd_vfs_getattr(const struct path *path, struct kstat *stat);
int ksmbd_vfs_fp_rename(struct ksmbd_work *work, struct ksmbd_file *fp, int ksmbd_vfs_fp_rename(struct ksmbd_work *work, struct ksmbd_file *fp,
char *newname); char *newname);
int ksmbd_vfs_truncate(struct ksmbd_work *work, int ksmbd_vfs_truncate(struct ksmbd_work *work,
......
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