]> git.ipfire.org Git - people/ms/linux.git/blobdiff - fs/ksmbd/vfs.c
Merge branch 'for-6.0/dax' into libnvdimm-fixes
[people/ms/linux.git] / fs / ksmbd / vfs.c
index 05efcdf7a4a73edbed63c9903856951ff061f2a1..78d01033604c6b469f88f1fab62921732c81e6e2 100644 (file)
@@ -481,12 +481,11 @@ int ksmbd_vfs_write(struct ksmbd_work *work, struct ksmbd_file *fp,
                    char *buf, size_t count, loff_t *pos, bool sync,
                    ssize_t *written)
 {
-       struct ksmbd_session *sess = work->sess;
        struct file *filp;
        loff_t  offset = *pos;
        int err = 0;
 
-       if (sess->conn->connection_type) {
+       if (work->conn->connection_type) {
                if (!(fp->daccess & FILE_WRITE_DATA_LE)) {
                        pr_err("no right to write(%pd)\n",
                               fp->filp->f_path.dentry);
@@ -963,7 +962,7 @@ ssize_t ksmbd_vfs_getxattr(struct user_namespace *user_ns,
  */
 int ksmbd_vfs_setxattr(struct user_namespace *user_ns,
                       struct dentry *dentry, const char *attr_name,
-                      const void *attr_value, size_t attr_size, int flags)
+                      void *attr_value, size_t attr_size, int flags)
 {
        int err;
 
@@ -1540,6 +1539,11 @@ int ksmbd_vfs_get_sd_xattr(struct ksmbd_conn *conn,
        }
 
        *pntsd = acl.sd_buf;
+       if (acl.sd_size < sizeof(struct smb_ntsd)) {
+               pr_err("sd size is invalid\n");
+               goto out_free;
+       }
+
        (*pntsd)->osidoffset = cpu_to_le32(le32_to_cpu((*pntsd)->osidoffset) -
                                           NDR_NTSD_OFFSETOF);
        (*pntsd)->gsidoffset = cpu_to_le32(le32_to_cpu((*pntsd)->gsidoffset) -