Skip to content

Commit 8b175e2

Browse files
committed
Merge tag '6.15-rc-part1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client updates from Steve French: - Fix for network namespace refcount leak - Multichannel fix and minor multichannel debug message cleanup - Fix potential null ptr reference in SMB3 close - Fix for special file handling when reparse points not supported by server - Two ACL fixes one for stricter ACE validation, one for incorrect perms requested - Three RFC1001 fixes: one for SMB3 mounts on port 139, one for better default hostname, and one for better session response processing - Minor update to email address for MAINTAINERS file - Allow disabling Unicode for access to old SMB1 servers - Three minor cleanups * tag '6.15-rc-part1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: Add new mount option -o nounicode to disable SMB1 UNICODE mode cifs: Set default Netbios RFC1001 server name to hostname in UNC smb: client: Fix netns refcount imbalance causing leaks and use-after-free cifs: add validation check for the fields in smb_aces CIFS: Propagate min offload along with other parameters from primary to secondary channels. cifs: Improve establishing SMB connection with NetBIOS session cifs: Fix establishing NetBIOS session for SMB2+ connection cifs: Fix getting DACL-only xattr system.cifs_acl and system.smb3_acl cifs: Check if server supports reparse points before using them MAINTAINERS: reorder preferred email for Steve French cifs: avoid NULL pointer dereference in dbg call smb: client: Remove redundant check in smb2_is_path_accessible() smb: client: Remove redundant check in cifs_oplock_break() smb: mark the new channel addition log as informational log with cifs_info smb: minor cleanup to remove unused function declaration
2 parents b6dde1e + e14b642 commit 8b175e2

19 files changed

+289
-45
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12905,8 +12905,8 @@ F: tools/testing/selftests/
1290512905
KERNEL SMB3 SERVER (KSMBD)
1290612906
M: Namjae Jeon <linkinjeon@kernel.org>
1290712907
M: Namjae Jeon <linkinjeon@samba.org>
12908-
M: Steve French <sfrench@samba.org>
1290912908
M: Steve French <smfrench@gmail.com>
12909+
M: Steve French <sfrench@samba.org>
1291012910
R: Sergey Senozhatsky <senozhatsky@chromium.org>
1291112911
R: Tom Talpey <tom@talpey.com>
1291212912
L: linux-cifs@vger.kernel.org

fs/smb/client/cifsacl.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,23 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
811811
return;
812812

813813
for (i = 0; i < num_aces; ++i) {
814+
if (end_of_acl - acl_base < acl_size)
815+
break;
816+
814817
ppace[i] = (struct smb_ace *) (acl_base + acl_size);
818+
acl_base = (char *)ppace[i];
819+
acl_size = offsetof(struct smb_ace, sid) +
820+
offsetof(struct smb_sid, sub_auth);
821+
822+
if (end_of_acl - acl_base < acl_size ||
823+
ppace[i]->sid.num_subauth == 0 ||
824+
ppace[i]->sid.num_subauth > SID_MAX_SUB_AUTHORITIES ||
825+
(end_of_acl - acl_base <
826+
acl_size + sizeof(__le32) * ppace[i]->sid.num_subauth) ||
827+
(le16_to_cpu(ppace[i]->size) <
828+
acl_size + sizeof(__le32) * ppace[i]->sid.num_subauth))
829+
break;
830+
815831
#ifdef CONFIG_CIFS_DEBUG2
816832
dump_ace(ppace[i], end_of_acl);
817833
#endif
@@ -855,7 +871,6 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
855871
(void *)ppace[i],
856872
sizeof(struct smb_ace)); */
857873

858-
acl_base = (char *)ppace[i];
859874
acl_size = le16_to_cpu(ppace[i]->size);
860875
}
861876

@@ -1550,7 +1565,7 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
15501565
int rc = 0;
15511566
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
15521567
struct smb_version_operations *ops;
1553-
const u32 info = 0;
1568+
const u32 info = OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO;
15541569

15551570
cifs_dbg(NOISY, "converting ACL to mode for %s\n", path);
15561571

@@ -1604,7 +1619,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
16041619
struct tcon_link *tlink;
16051620
struct smb_version_operations *ops;
16061621
bool mode_from_sid, id_from_sid;
1607-
const u32 info = 0;
1622+
const u32 info = OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO;
16081623
bool posix;
16091624

16101625
tlink = cifs_sb_tlink(cifs_sb);

fs/smb/client/cifsfs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,10 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
637637
cifs_sb->ctx->dir_mode);
638638
if (cifs_sb->ctx->iocharset)
639639
seq_printf(s, ",iocharset=%s", cifs_sb->ctx->iocharset);
640+
if (tcon->ses->unicode == 0)
641+
seq_puts(s, ",nounicode");
642+
else if (tcon->ses->unicode == 1)
643+
seq_puts(s, ",unicode");
640644
if (tcon->seal)
641645
seq_puts(s, ",seal");
642646
else if (tcon->ses->server->ignore_signature)

fs/smb/client/cifsglob.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ struct smb_version_values {
653653
unsigned int cap_unix;
654654
unsigned int cap_nt_find;
655655
unsigned int cap_large_files;
656+
unsigned int cap_unicode;
656657
__u16 signing_enabled;
657658
__u16 signing_required;
658659
size_t create_lease_size;
@@ -1120,6 +1121,7 @@ struct cifs_ses {
11201121
bool sign; /* is signing required? */
11211122
bool domainAuto:1;
11221123
bool expired_pwd; /* track if access denied or expired pwd so can know if need to update */
1124+
int unicode;
11231125
unsigned int flags;
11241126
__u16 session_flags;
11251127
__u8 smb3signingkey[SMB3_SIGN_KEY_SIZE];

fs/smb/client/cifsproto.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ extern void cifs_small_buf_release(void *);
3131
extern void free_rsp_buf(int, void *);
3232
extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *,
3333
unsigned int /* length */);
34+
extern int smb_send_kvec(struct TCP_Server_Info *server,
35+
struct msghdr *msg,
36+
size_t *sent);
3437
extern unsigned int _get_xid(void);
3538
extern void _free_xid(unsigned int);
3639
#define get_xid() \
@@ -592,7 +595,6 @@ int cifs_async_readv(struct cifs_io_subrequest *rdata);
592595
int cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid);
593596

594597
void cifs_async_writev(struct cifs_io_subrequest *wdata);
595-
void cifs_writev_complete(struct work_struct *work);
596598
int cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
597599
struct cifs_sb_info *cifs_sb,
598600
const unsigned char *path, char *pbuf,

fs/smb/client/cifssmb.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,10 @@ CIFSSMBNegotiate(const unsigned int xid,
437437
return rc;
438438

439439
pSMB->hdr.Mid = get_next_mid(server);
440-
pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS);
440+
pSMB->hdr.Flags2 |= SMBFLG2_ERR_STATUS;
441+
442+
if (ses->unicode != 0)
443+
pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
441444

442445
if (should_set_ext_sec_flag(ses->sectype)) {
443446
cifs_dbg(FYI, "Requesting extended security\n");
@@ -2709,6 +2712,9 @@ int cifs_query_reparse_point(const unsigned int xid,
27092712
if (cap_unix(tcon->ses))
27102713
return -EOPNOTSUPP;
27112714

2715+
if (!(le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS))
2716+
return -EOPNOTSUPP;
2717+
27122718
oparms = (struct cifs_open_parms) {
27132719
.tcon = tcon,
27142720
.cifs_sb = cifs_sb,
@@ -3400,8 +3406,7 @@ CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, __u16 fid,
34003406
/* BB TEST with big acls that might need to be e.g. larger than 16K */
34013407
pSMB->MaxSetupCount = 0;
34023408
pSMB->Fid = fid; /* file handle always le */
3403-
pSMB->AclFlags = cpu_to_le32(CIFS_ACL_OWNER | CIFS_ACL_GROUP |
3404-
CIFS_ACL_DACL | info);
3409+
pSMB->AclFlags = cpu_to_le32(info);
34053410
pSMB->ByteCount = cpu_to_le16(11); /* 3 bytes pad + 8 bytes parm */
34063411
inc_rfc1001_len(pSMB, 11);
34073412
iov[0].iov_base = (char *)pSMB;

0 commit comments

Comments
 (0)