Skip to content

Commit 7476b04

Browse files
committed
Merge tag '5.17-rc5-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "Six small smb3 client fixes, three for stable: - fix for snapshot mount option - two ACL related fixes - use after free race fix - fix for confusing warning message logged with older dialects" * tag '5.17-rc5-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: fix confusing unneeded warning message on smb2.1 and earlier cifs: modefromsids must add an ACE for authenticated users cifs: fix double free race when mount fails in cifs_get_root() cifs: do not use uninitialized data in the owner/group sid cifs: fix set of group SID via NTSD xattrs smb3: fix snapshot mount option
2 parents 9195e5e + 53923e0 commit 7476b04

5 files changed

Lines changed: 17 additions & 10 deletions

File tree

fs/cifs/cifsacl.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,9 @@ static void populate_new_aces(char *nacl_base,
949949
pnntace = (struct cifs_ace *) (nacl_base + nsize);
950950
nsize += setup_special_mode_ACE(pnntace, nmode);
951951
num_aces++;
952+
pnntace = (struct cifs_ace *) (nacl_base + nsize);
953+
nsize += setup_authusers_ACE(pnntace);
954+
num_aces++;
952955
goto set_size;
953956
}
954957

@@ -1297,7 +1300,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
12971300

12981301
if (uid_valid(uid)) { /* chown */
12991302
uid_t id;
1300-
nowner_sid_ptr = kmalloc(sizeof(struct cifs_sid),
1303+
nowner_sid_ptr = kzalloc(sizeof(struct cifs_sid),
13011304
GFP_KERNEL);
13021305
if (!nowner_sid_ptr) {
13031306
rc = -ENOMEM;
@@ -1326,7 +1329,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
13261329
}
13271330
if (gid_valid(gid)) { /* chgrp */
13281331
gid_t id;
1329-
ngroup_sid_ptr = kmalloc(sizeof(struct cifs_sid),
1332+
ngroup_sid_ptr = kzalloc(sizeof(struct cifs_sid),
13301333
GFP_KERNEL);
13311334
if (!ngroup_sid_ptr) {
13321335
rc = -ENOMEM;
@@ -1613,7 +1616,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
16131616
nsecdesclen = secdesclen;
16141617
if (pnmode && *pnmode != NO_CHANGE_64) { /* chmod */
16151618
if (mode_from_sid)
1616-
nsecdesclen += sizeof(struct cifs_ace);
1619+
nsecdesclen += 2 * sizeof(struct cifs_ace);
16171620
else /* cifsacl */
16181621
nsecdesclen += 5 * sizeof(struct cifs_ace);
16191622
} else { /* chown */

fs/cifs/cifsfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,
919919

920920
out_super:
921921
deactivate_locked_super(sb);
922+
return root;
922923
out:
923924
if (cifs_sb) {
924925
kfree(cifs_sb->prepath);

fs/cifs/fs_context.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const struct fs_parameter_spec smb3_fs_parameters[] = {
149149
fsparam_u32("echo_interval", Opt_echo_interval),
150150
fsparam_u32("max_credits", Opt_max_credits),
151151
fsparam_u32("handletimeout", Opt_handletimeout),
152-
fsparam_u32("snapshot", Opt_snapshot),
152+
fsparam_u64("snapshot", Opt_snapshot),
153153
fsparam_u32("max_channels", Opt_max_channels),
154154

155155
/* Mount options which take string value */
@@ -1078,7 +1078,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
10781078
ctx->echo_interval = result.uint_32;
10791079
break;
10801080
case Opt_snapshot:
1081-
ctx->snapshot_time = result.uint_32;
1081+
ctx->snapshot_time = result.uint_64;
10821082
break;
10831083
case Opt_max_credits:
10841084
if (result.uint_32 < 20 || result.uint_32 > 60000) {

fs/cifs/sess.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,6 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses)
127127
struct cifs_server_iface *ifaces = NULL;
128128
size_t iface_count;
129129

130-
if (ses->server->dialect < SMB30_PROT_ID) {
131-
cifs_dbg(VFS, "multichannel is not supported on this protocol version, use 3.0 or above\n");
132-
return 0;
133-
}
134-
135130
spin_lock(&ses->chan_lock);
136131

137132
new_chan_count = old_chan_count = ses->chan_count;
@@ -145,6 +140,12 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses)
145140
return 0;
146141
}
147142

143+
if (ses->server->dialect < SMB30_PROT_ID) {
144+
spin_unlock(&ses->chan_lock);
145+
cifs_dbg(VFS, "multichannel is not supported on this protocol version, use 3.0 or above\n");
146+
return 0;
147+
}
148+
148149
if (!(ses->server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) {
149150
ses->chan_max = 1;
150151
spin_unlock(&ses->chan_lock);

fs/cifs/xattr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,13 @@ static int cifs_xattr_set(const struct xattr_handler *handler,
175175
switch (handler->flags) {
176176
case XATTR_CIFS_NTSD_FULL:
177177
aclflags = (CIFS_ACL_OWNER |
178+
CIFS_ACL_GROUP |
178179
CIFS_ACL_DACL |
179180
CIFS_ACL_SACL);
180181
break;
181182
case XATTR_CIFS_NTSD:
182183
aclflags = (CIFS_ACL_OWNER |
184+
CIFS_ACL_GROUP |
183185
CIFS_ACL_DACL);
184186
break;
185187
case XATTR_CIFS_ACL:

0 commit comments

Comments
 (0)