Skip to content

Commit 0bffa15

Browse files
authored
Merge pull request #68 from namjaejeon/cifsd-for-next
ksmbd-fixes
2 parents e7a10ed + e70e392 commit 0bffa15

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5861,10 +5861,15 @@ int smb2_set_info(struct ksmbd_work *work)
58615861
break;
58625862
case SMB2_O_INFO_SECURITY:
58635863
ksmbd_debug(SMB, "GOT SMB2_O_INFO_SECURITY\n");
5864+
if (ksmbd_override_fsids(work)) {
5865+
rc = -ENOMEM;
5866+
goto err_out;
5867+
}
58645868
rc = smb2_set_info_sec(fp,
58655869
le32_to_cpu(req->AdditionalInformation),
58665870
req->Buffer,
58675871
le32_to_cpu(req->BufferLength));
5872+
ksmbd_revert_fsids(work);
58685873
break;
58695874
default:
58705875
rc = -EOPNOTSUPP;

fs/ksmbd/smbacl.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,7 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon,
13001300
struct smb_fattr fattr = {{0}};
13011301
struct inode *inode = d_inode(path->dentry);
13021302
struct user_namespace *user_ns = mnt_user_ns(path->mnt);
1303+
struct iattr newattrs;
13031304

13041305
fattr.cf_uid = INVALID_UID;
13051306
fattr.cf_gid = INVALID_GID;
@@ -1309,12 +1310,23 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon,
13091310
if (rc)
13101311
goto out;
13111312

1312-
inode->i_mode = (inode->i_mode & ~0777) | (fattr.cf_mode & 0777);
1313-
if (!uid_eq(fattr.cf_uid, INVALID_UID))
1314-
inode->i_uid = fattr.cf_uid;
1315-
if (!gid_eq(fattr.cf_gid, INVALID_GID))
1316-
inode->i_gid = fattr.cf_gid;
1317-
mark_inode_dirty(inode);
1313+
newattrs.ia_valid = ATTR_CTIME;
1314+
if (!uid_eq(fattr.cf_uid, INVALID_UID)) {
1315+
newattrs.ia_valid |= ATTR_UID;
1316+
newattrs.ia_uid = fattr.cf_uid;
1317+
}
1318+
if (!gid_eq(fattr.cf_gid, INVALID_GID)) {
1319+
newattrs.ia_valid |= ATTR_GID;
1320+
newattrs.ia_gid = fattr.cf_gid;
1321+
}
1322+
newattrs.ia_valid |= ATTR_MODE;
1323+
newattrs.ia_mode = (inode->i_mode & ~0777) | (fattr.cf_mode & 0777);
1324+
1325+
inode_lock(inode);
1326+
rc = notify_change(user_ns, path->dentry, &newattrs, NULL);
1327+
inode_unlock(inode);
1328+
if (rc)
1329+
goto out;
13181330

13191331
ksmbd_vfs_remove_acl_xattrs(user_ns, path->dentry);
13201332
/* Update posix acls */

0 commit comments

Comments
 (0)