Skip to content

Commit b8f4296

Browse files
committed
Merge tag '5.15-rc2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "Six small cifs/smb3 fixes, two for stable: - important fix for deferred close (found by a git functional test) related to attribute caching on close. - four (two cosmetic, two more serious) small fixes for problems pointed out by smatch via Dan Carpenter - fix for comment formatting problems pointed out by W=1" * tag '5.15-rc2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: fix incorrect check for null pointer in header_assemble smb3: correct server pointer dereferencing check to be more consistent smb3: correct smb3 ACL security descriptor cifs: Clear modified attribute bit from inode flags cifs: Deal with some warnings from W=1 cifs: fix a sign extension bug
2 parents 8573616 + 9ed38fd commit b8f4296

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

fs/cifs/connect.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,9 +2389,10 @@ cifs_match_super(struct super_block *sb, void *data)
23892389
spin_lock(&cifs_tcp_ses_lock);
23902390
cifs_sb = CIFS_SB(sb);
23912391
tlink = cifs_get_tlink(cifs_sb_master_tlink(cifs_sb));
2392-
if (IS_ERR(tlink)) {
2392+
if (tlink == NULL) {
2393+
/* can not match superblock if tlink were ever null */
23932394
spin_unlock(&cifs_tcp_ses_lock);
2394-
return rc;
2395+
return 0;
23952396
}
23962397
tcon = tlink_tcon(tlink);
23972398
ses = tcon->ses;

fs/cifs/file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ int cifs_close(struct inode *inode, struct file *file)
884884
cinode->lease_granted &&
885885
!test_bit(CIFS_INO_CLOSE_ON_LOCK, &cinode->flags) &&
886886
dclose) {
887-
if (test_bit(CIFS_INO_MODIFIED_ATTR, &cinode->flags)) {
887+
if (test_and_clear_bit(CIFS_INO_MODIFIED_ATTR, &cinode->flags)) {
888888
inode->i_ctime = inode->i_mtime = current_time(inode);
889889
cifs_fscache_update_inode_cookie(inode);
890890
}
@@ -3113,7 +3113,7 @@ static void collect_uncached_write_data(struct cifs_aio_ctx *ctx)
31133113
struct cifs_tcon *tcon;
31143114
struct cifs_sb_info *cifs_sb;
31153115
struct dentry *dentry = ctx->cfile->dentry;
3116-
int rc;
3116+
ssize_t rc;
31173117

31183118
tcon = tlink_tcon(ctx->cfile->tlink);
31193119
cifs_sb = CIFS_SB(dentry->d_sb);

fs/cifs/misc.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
264264

265265
/* Uid is not converted */
266266
buffer->Uid = treeCon->ses->Suid;
267-
buffer->Mid = get_next_mid(treeCon->ses->server);
267+
if (treeCon->ses->server)
268+
buffer->Mid = get_next_mid(treeCon->ses->server);
268269
}
269270
if (treeCon->Flags & SMB_SHARE_IS_IN_DFS)
270271
buffer->Flags2 |= SMBFLG2_DFS;
@@ -590,6 +591,7 @@ void cifs_put_writer(struct cifsInodeInfo *cinode)
590591

591592
/**
592593
* cifs_queue_oplock_break - queue the oplock break handler for cfile
594+
* @cfile: The file to break the oplock on
593595
*
594596
* This function is called from the demultiplex thread when it
595597
* receives an oplock break for @cfile.
@@ -1065,6 +1067,9 @@ setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw)
10651067

10661068
/**
10671069
* cifs_alloc_hash - allocate hash and hash context together
1070+
* @name: The name of the crypto hash algo
1071+
* @shash: Where to put the pointer to the hash algo
1072+
* @sdesc: Where to put the pointer to the hash descriptor
10681073
*
10691074
* The caller has to make sure @sdesc is initialized to either NULL or
10701075
* a valid context. Both can be freed via cifs_free_hash().
@@ -1103,6 +1108,8 @@ cifs_alloc_hash(const char *name,
11031108

11041109
/**
11051110
* cifs_free_hash - free hash and hash context together
1111+
* @shash: Where to find the pointer to the hash algo
1112+
* @sdesc: Where to find the pointer to the hash descriptor
11061113
*
11071114
* Freeing a NULL hash or context is safe.
11081115
*/
@@ -1118,8 +1125,10 @@ cifs_free_hash(struct crypto_shash **shash, struct sdesc **sdesc)
11181125

11191126
/**
11201127
* rqst_page_get_length - obtain the length and offset for a page in smb_rqst
1121-
* Input: rqst - a smb_rqst, page - a page index for rqst
1122-
* Output: *len - the length for this page, *offset - the offset for this page
1128+
* @rqst: The request descriptor
1129+
* @page: The index of the page to query
1130+
* @len: Where to store the length for this page:
1131+
* @offset: Where to store the offset for this page
11231132
*/
11241133
void rqst_page_get_length(struct smb_rqst *rqst, unsigned int page,
11251134
unsigned int *len, unsigned int *offset)
@@ -1152,6 +1161,8 @@ void extract_unc_hostname(const char *unc, const char **h, size_t *len)
11521161

11531162
/**
11541163
* copy_path_name - copy src path to dst, possibly truncating
1164+
* @dst: The destination buffer
1165+
* @src: The source name
11551166
*
11561167
* returns number of bytes written (including trailing nul)
11571168
*/

fs/cifs/smb2pdu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,7 +2397,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
23972397
buf->sd.OffsetDacl = cpu_to_le32(ptr - (__u8 *)&buf->sd);
23982398
/* Ship the ACL for now. we will copy it into buf later. */
23992399
aclptr = ptr;
2400-
ptr += sizeof(struct cifs_acl);
2400+
ptr += sizeof(struct smb3_acl);
24012401

24022402
/* create one ACE to hold the mode embedded in reserved special SID */
24032403
acelen = setup_special_mode_ACE((struct cifs_ace *)ptr, (__u64)mode);
@@ -2422,7 +2422,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
24222422
acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */
24232423
acl.AclSize = cpu_to_le16(acl_size);
24242424
acl.AceCount = cpu_to_le16(ace_count);
2425-
memcpy(aclptr, &acl, sizeof(struct cifs_acl));
2425+
memcpy(aclptr, &acl, sizeof(struct smb3_acl));
24262426

24272427
buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd);
24282428
*len = roundup(ptr - (__u8 *)buf, 8);

0 commit comments

Comments
 (0)