Skip to content

Commit

Permalink
Merge pull request #68 from namjaejeon/cifsd-for-next
Browse files Browse the repository at this point in the history
ksmbd-fixes
  • Loading branch information
smfrench authored Aug 21, 2021
2 parents e7a10ed + e70e392 commit 0bffa15
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
5 changes: 5 additions & 0 deletions fs/ksmbd/smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5861,10 +5861,15 @@ int smb2_set_info(struct ksmbd_work *work)
break;
case SMB2_O_INFO_SECURITY:
ksmbd_debug(SMB, "GOT SMB2_O_INFO_SECURITY\n");
if (ksmbd_override_fsids(work)) {
rc = -ENOMEM;
goto err_out;
}
rc = smb2_set_info_sec(fp,
le32_to_cpu(req->AdditionalInformation),
req->Buffer,
le32_to_cpu(req->BufferLength));
ksmbd_revert_fsids(work);
break;
default:
rc = -EOPNOTSUPP;
Expand Down
24 changes: 18 additions & 6 deletions fs/ksmbd/smbacl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,7 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon,
struct smb_fattr fattr = {{0}};
struct inode *inode = d_inode(path->dentry);
struct user_namespace *user_ns = mnt_user_ns(path->mnt);
struct iattr newattrs;

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

inode->i_mode = (inode->i_mode & ~0777) | (fattr.cf_mode & 0777);
if (!uid_eq(fattr.cf_uid, INVALID_UID))
inode->i_uid = fattr.cf_uid;
if (!gid_eq(fattr.cf_gid, INVALID_GID))
inode->i_gid = fattr.cf_gid;
mark_inode_dirty(inode);
newattrs.ia_valid = ATTR_CTIME;
if (!uid_eq(fattr.cf_uid, INVALID_UID)) {
newattrs.ia_valid |= ATTR_UID;
newattrs.ia_uid = fattr.cf_uid;
}
if (!gid_eq(fattr.cf_gid, INVALID_GID)) {
newattrs.ia_valid |= ATTR_GID;
newattrs.ia_gid = fattr.cf_gid;
}
newattrs.ia_valid |= ATTR_MODE;
newattrs.ia_mode = (inode->i_mode & ~0777) | (fattr.cf_mode & 0777);

inode_lock(inode);
rc = notify_change(user_ns, path->dentry, &newattrs, NULL);
inode_unlock(inode);
if (rc)
goto out;

ksmbd_vfs_remove_acl_xattrs(user_ns, path->dentry);
/* Update posix acls */
Expand Down

0 comments on commit 0bffa15

Please sign in to comment.