Skip to content

Commit 7325a44

Browse files
committed
ksmbd: add mnt_want_write to ksmbd vfs functions
ksmbd is doing write access using vfs helpers. There are the cases that mnt_want_write() is not called in vfs helper. This patch add missing mnt_want_write() to ksmbd vfs functions. Signed-off-by: Namjae Jeon <[email protected]>
1 parent bf069d5 commit 7325a44

File tree

5 files changed

+120
-58
lines changed

5 files changed

+120
-58
lines changed

smb1pdu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,7 +2612,7 @@ int smb_nt_create_andx(struct ksmbd_work *work)
26122612
da.create_time = fp->create_time;
26132613

26142614
err = ksmbd_vfs_set_dos_attrib_xattr(mnt_user_ns(path.mnt),
2615-
path.dentry, &da);
2615+
&path, &da);
26162616
if (err)
26172617
ksmbd_debug(SMB, "failed to store creation time in xattr\n");
26182618
err = 0;
@@ -7359,7 +7359,7 @@ static int create_dir(struct ksmbd_work *work)
73597359
XATTR_DOSINFO_ITIME;
73607360

73617361
err = ksmbd_vfs_set_dos_attrib_xattr(mnt_user_ns(path.mnt),
7362-
path.dentry, &da);
7362+
&path, &da);
73637363
if (err)
73647364
ksmbd_debug(SMB, "failed to store creation time in EA\n");
73657365
path_put(&path);
@@ -7531,7 +7531,7 @@ int smb_mkdir(struct ksmbd_work *work)
75317531
XATTR_DOSINFO_ITIME;
75327532

75337533
err = ksmbd_vfs_set_dos_attrib_xattr(mnt_user_ns(path.mnt),
7534-
path.dentry, &da);
7534+
&path, &da);
75357535
if (err)
75367536
ksmbd_debug(SMB, "failed to store creation time in xattr\n");
75377537
path_put(&path);
@@ -8271,7 +8271,7 @@ int smb_open_andx(struct ksmbd_work *work)
82718271
XATTR_DOSINFO_ITIME;
82728272

82738273
err = ksmbd_vfs_set_dos_attrib_xattr(mnt_user_ns(path.mnt),
8274-
path.dentry, &da);
8274+
&path, &da);
82758275
if (err)
82768276
ksmbd_debug(SMB, "failed to store creation time in xattr\n");
82778277
err = 0;

smb2pdu.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,7 @@ static int smb2_set_ea(struct smb2_ea_info *eabuf, unsigned int buf_len,
23342334
#else
23352335
rc = ksmbd_vfs_setxattr(user_ns,
23362336
#endif
2337-
path->dentry, attr_name, value,
2337+
path, attr_name, value,
23382338
le16_to_cpu(eabuf->EaValueLength), 0);
23392339
if (rc < 0) {
23402340
ksmbd_debug(SMB,
@@ -2400,9 +2400,9 @@ static noinline int smb2_set_stream_name_xattr(const struct path *path,
24002400
}
24012401

24022402
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
2403-
rc = ksmbd_vfs_setxattr(idmap, path->dentry,
2403+
rc = ksmbd_vfs_setxattr(idmap, path,
24042404
#else
2405-
rc = ksmbd_vfs_setxattr(user_ns, path->dentry,
2405+
rc = ksmbd_vfs_setxattr(user_ns, path,
24062406
#endif
24072407
xattr_stream_name, NULL, 0, 0);
24082408
if (rc < 0)
@@ -2490,10 +2490,10 @@ static void smb2_new_xattrs(struct ksmbd_tree_connect *tcon, const struct path *
24902490

24912491
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
24922492
rc = ksmbd_vfs_set_dos_attrib_xattr(mnt_idmap(path->mnt),
2493-
path->dentry, &da);
2493+
path, &da);
24942494
#else
24952495
rc = ksmbd_vfs_set_dos_attrib_xattr(mnt_user_ns(path->mnt),
2496-
path->dentry, &da);
2496+
path, &da);
24972497
#endif
24982498
if (rc)
24992499
ksmbd_debug(SMB, "failed to store file attribute into xattr\n");
@@ -3157,11 +3157,11 @@ int smb2_open(struct ksmbd_work *work)
31573157

31583158
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
31593159
posix_acl_rc = ksmbd_vfs_inherit_posix_acl(idmap,
3160-
path.dentry,
3160+
&path,
31613161
d_inode(path.dentry->d_parent));
31623162
#else
31633163
posix_acl_rc = ksmbd_vfs_inherit_posix_acl(user_ns,
3164-
path.dentry,
3164+
&path,
31653165
d_inode(path.dentry->d_parent));
31663166
#endif
31673167
if (posix_acl_rc)
@@ -3179,10 +3179,10 @@ int smb2_open(struct ksmbd_work *work)
31793179
if (posix_acl_rc)
31803180
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
31813181
ksmbd_vfs_set_init_posix_acl(idmap,
3182-
path.dentry);
3182+
&path);
31833183
#else
31843184
ksmbd_vfs_set_init_posix_acl(user_ns,
3185-
path.dentry);
3185+
&path);
31863186
#endif
31873187

31883188
if (test_share_config_flag(work->tcon->share_conf,
@@ -3235,7 +3235,7 @@ int smb2_open(struct ksmbd_work *work)
32353235
#else
32363236
user_ns,
32373237
#endif
3238-
path.dentry,
3238+
&path,
32393239
pntsd,
32403240
pntsd_size);
32413241
kfree(pntsd);
@@ -5852,7 +5852,7 @@ static int smb2_rename(struct ksmbd_work *work,
58525852
goto out;
58535853

58545854
rc = ksmbd_vfs_setxattr(file_mnt_idmap(fp->filp),
5855-
fp->filp->f_path.dentry,
5855+
&fp->filp->f_path,
58565856
xattr_stream_name,
58575857
NULL, 0, 0);
58585858
if (rc < 0) {
@@ -5955,7 +5955,7 @@ static int smb2_rename(struct ksmbd_work *work,
59555955
#else
59565956
rc = ksmbd_vfs_setxattr(user_ns,
59575957
#endif
5958-
fp->filp->f_path.dentry,
5958+
&fp->filp->f_path,
59595959
xattr_stream_name,
59605960
NULL, 0, 0);
59615961
if (rc < 0) {
@@ -6177,7 +6177,7 @@ static int set_file_basic_info(struct ksmbd_file *fp,
61776177
#else
61786178
rc = ksmbd_vfs_set_dos_attrib_xattr(user_ns,
61796179
#endif
6180-
filp->f_path.dentry, &da);
6180+
&filp->f_path, &da);
61816181
if (rc)
61826182
ksmbd_debug(SMB,
61836183
"failed to restore file attribute in EA\n");
@@ -8125,7 +8125,7 @@ static inline int fsctl_set_sparse(struct ksmbd_work *work, u64 id,
81258125
#else
81268126
ret = ksmbd_vfs_set_dos_attrib_xattr(user_ns,
81278127
#endif
8128-
fp->filp->f_path.dentry, &da);
8128+
&fp->filp->f_path, &da);
81298129
if (ret)
81308130
fp->f_ci->m_fattr = old_fattr;
81318131
}

smbacl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ int smb_inherit_dacl(struct ksmbd_conn *conn,
13011301
#else
13021302
ksmbd_vfs_set_sd_xattr(conn, user_ns,
13031303
#endif
1304-
path->dentry, pntsd, pntsd_size);
1304+
path, pntsd, pntsd_size);
13051305
kfree(pntsd);
13061306
}
13071307

@@ -1551,9 +1551,9 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon,
15511551
newattrs.ia_mode = (inode->i_mode & ~0777) | (fattr.cf_mode & 0777);
15521552

15531553
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
1554-
ksmbd_vfs_remove_acl_xattrs(idmap, path->dentry);
1554+
ksmbd_vfs_remove_acl_xattrs(idmap, path);
15551555
#else
1556-
ksmbd_vfs_remove_acl_xattrs(user_ns, path->dentry);
1556+
ksmbd_vfs_remove_acl_xattrs(user_ns, path);
15571557
#endif
15581558
/* Update posix acls */
15591559
if (IS_ENABLED(CONFIG_FS_POSIX_ACL) && fattr.cf_dacls) {
@@ -1626,7 +1626,7 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon,
16261626
ksmbd_vfs_remove_sd_xattrs(user_ns, path->dentry);
16271627
ksmbd_vfs_set_sd_xattr(conn, user_ns,
16281628
#endif
1629-
path->dentry, pntsd, ntsd_len);
1629+
path, pntsd, ntsd_len);
16301630
}
16311631

16321632
out:

0 commit comments

Comments
 (0)