Skip to content

Commit 41e7231

Browse files
committed
Merge tag 'v5.2-rc2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "Four small smb3 fixes, one for stable" * tag 'v5.2-rc2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6: CIFS: cifs_read_allocate_pages: don't iterate through whole page array on ENOMEM dfs_cache: fix a wrong use of kfree in flush_cache_ent() fs/cifs/smb2pdu.c: fix buffer free in SMB2_ioctl_free cifs: fix memory leak of pneg_inbuf on -EOPNOTSUPP ioctl case
2 parents d266b3f + 31fad7d commit 41e7231

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

‎fs/cifs/dfs_cache.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static inline void flush_cache_ent(struct dfs_cache_entry *ce)
132132
return;
133133

134134
hlist_del_init_rcu(&ce->ce_hlist);
135-
kfree(ce->ce_path);
135+
kfree_const(ce->ce_path);
136136
free_tgts(ce);
137137
dfs_cache_count--;
138138
call_rcu(&ce->ce_rcu, free_cache_entry);
@@ -422,7 +422,7 @@ alloc_cache_entry(const char *path, const struct dfs_info3_param *refs,
422422

423423
rc = copy_ref_data(refs, numrefs, ce, NULL);
424424
if (rc) {
425-
kfree(ce->ce_path);
425+
kfree_const(ce->ce_path);
426426
kmem_cache_free(dfs_cache_slab, ce);
427427
ce = ERR_PTR(rc);
428428
}

‎fs/cifs/file.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3216,7 +3216,9 @@ cifs_read_allocate_pages(struct cifs_readdata *rdata, unsigned int nr_pages)
32163216
}
32173217

32183218
if (rc) {
3219-
for (i = 0; i < nr_pages; i++) {
3219+
unsigned int nr_page_failed = i;
3220+
3221+
for (i = 0; i < nr_page_failed; i++) {
32203222
put_page(rdata->pages[i]);
32213223
rdata->pages[i] = NULL;
32223224
}

‎fs/cifs/smb2pdu.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,8 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)
10541054
* not supported error. Client should accept it.
10551055
*/
10561056
cifs_dbg(VFS, "Server does not support validate negotiate\n");
1057-
return 0;
1057+
rc = 0;
1058+
goto out_free_inbuf;
10581059
} else if (rc != 0) {
10591060
cifs_dbg(VFS, "validate protocol negotiate failed: %d\n", rc);
10601061
rc = -EIO;
@@ -2619,10 +2620,12 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct smb_rqst *rqst,
26192620
void
26202621
SMB2_ioctl_free(struct smb_rqst *rqst)
26212622
{
2623+
int i;
26222624
if (rqst && rqst->rq_iov) {
26232625
cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */
2624-
if (rqst->rq_iov[1].iov_len)
2625-
kfree(rqst->rq_iov[1].iov_base);
2626+
for (i = 1; i < rqst->rq_nvec; i++)
2627+
if (rqst->rq_iov[i].iov_base != smb2_padding)
2628+
kfree(rqst->rq_iov[i].iov_base);
26262629
}
26272630
}
26282631

0 commit comments

Comments
 (0)