Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag '6.10-rc3-smb3-server-fixes' of git://git.samba.org/ksmbd

Pull smb server fixes from Steve French:
"Two small smb3 server fixes:

- set xatttr fix

- pathname parsing check fix"

* tag '6.10-rc3-smb3-server-fixes' of git://git.samba.org/ksmbd:
ksmbd: fix missing use of get_write in in smb2_set_ea()
ksmbd: move leading slash check to smb2_get_name()

+25 -20
+10 -12
fs/smb/server/smb2pdu.c
··· 630 630 return name; 631 631 } 632 632 633 + if (*name == '\\') { 634 + pr_err("not allow directory name included leading slash\n"); 635 + kfree(name); 636 + return ERR_PTR(-EINVAL); 637 + } 638 + 633 639 ksmbd_conv_path_to_unix(name); 634 640 ksmbd_strip_last_slash(name); 635 641 return name; ··· 2367 2361 if (rc > 0) { 2368 2362 rc = ksmbd_vfs_remove_xattr(idmap, 2369 2363 path, 2370 - attr_name); 2364 + attr_name, 2365 + get_write); 2371 2366 2372 2367 if (rc < 0) { 2373 2368 ksmbd_debug(SMB, ··· 2383 2376 } else { 2384 2377 rc = ksmbd_vfs_setxattr(idmap, path, attr_name, value, 2385 2378 le16_to_cpu(eabuf->EaValueLength), 2386 - 0, true); 2379 + 0, get_write); 2387 2380 if (rc < 0) { 2388 2381 ksmbd_debug(SMB, 2389 2382 "ksmbd_vfs_setxattr is failed(%d)\n", ··· 2475 2468 !strncmp(&name[XATTR_USER_PREFIX_LEN], STREAM_PREFIX, 2476 2469 STREAM_PREFIX_LEN)) { 2477 2470 err = ksmbd_vfs_remove_xattr(idmap, path, 2478 - name); 2471 + name, true); 2479 2472 if (err) 2480 2473 ksmbd_debug(SMB, "remove xattr failed : %s\n", 2481 2474 name); ··· 2849 2842 } 2850 2843 2851 2844 if (req->NameLength) { 2852 - if ((req->CreateOptions & FILE_DIRECTORY_FILE_LE) && 2853 - *(char *)req->Buffer == '\\') { 2854 - pr_err("not allow directory name included leading slash\n"); 2855 - rc = -EINVAL; 2856 - goto err_out2; 2857 - } 2858 - 2859 2845 name = smb2_get_name((char *)req + le16_to_cpu(req->NameOffset), 2860 2846 le16_to_cpu(req->NameLength), 2861 2847 work->conn->local_nls); 2862 2848 if (IS_ERR(name)) { 2863 2849 rc = PTR_ERR(name); 2864 - if (rc != -ENOMEM) 2865 - rc = -ENOENT; 2866 2850 name = NULL; 2867 2851 goto err_out2; 2868 2852 }
+11 -6
fs/smb/server/vfs.c
··· 1058 1058 } 1059 1059 1060 1060 int ksmbd_vfs_remove_xattr(struct mnt_idmap *idmap, 1061 - const struct path *path, char *attr_name) 1061 + const struct path *path, char *attr_name, 1062 + bool get_write) 1062 1063 { 1063 1064 int err; 1064 1065 1065 - err = mnt_want_write(path->mnt); 1066 - if (err) 1067 - return err; 1066 + if (get_write == true) { 1067 + err = mnt_want_write(path->mnt); 1068 + if (err) 1069 + return err; 1070 + } 1068 1071 1069 1072 err = vfs_removexattr(idmap, path->dentry, attr_name); 1070 - mnt_drop_write(path->mnt); 1073 + 1074 + if (get_write == true) 1075 + mnt_drop_write(path->mnt); 1071 1076 1072 1077 return err; 1073 1078 } ··· 1385 1380 ksmbd_debug(SMB, "%s, len %zd\n", name, strlen(name)); 1386 1381 1387 1382 if (!strncmp(name, XATTR_NAME_SD, XATTR_NAME_SD_LEN)) { 1388 - err = ksmbd_vfs_remove_xattr(idmap, path, name); 1383 + err = ksmbd_vfs_remove_xattr(idmap, path, name, true); 1389 1384 if (err) 1390 1385 ksmbd_debug(SMB, "remove xattr failed : %s\n", name); 1391 1386 }
+2 -1
fs/smb/server/vfs.h
··· 114 114 int ksmbd_vfs_xattr_stream_name(char *stream_name, char **xattr_stream_name, 115 115 size_t *xattr_stream_name_size, int s_type); 116 116 int ksmbd_vfs_remove_xattr(struct mnt_idmap *idmap, 117 - const struct path *path, char *attr_name); 117 + const struct path *path, char *attr_name, 118 + bool get_write); 118 119 int ksmbd_vfs_kern_path_locked(struct ksmbd_work *work, char *name, 119 120 unsigned int flags, struct path *parent_path, 120 121 struct path *path, bool caseless);
+2 -1
fs/smb/server/vfs_cache.c
··· 254 254 ci->m_flags &= ~S_DEL_ON_CLS_STREAM; 255 255 err = ksmbd_vfs_remove_xattr(file_mnt_idmap(filp), 256 256 &filp->f_path, 257 - fp->stream.name); 257 + fp->stream.name, 258 + true); 258 259 if (err) 259 260 pr_err("remove xattr failed : %s\n", 260 261 fp->stream.name);