Skip to content

Commit 367bcbc

Browse files
committed
Merge tag '6.0-rc1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs client fixes from Steve French: - memory leak fix - two small cleanups - trivial strlcpy removal - update missing entry for cifs headers in MAINTAINERS file * tag '6.0-rc1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: move from strlcpy with unused retval to strscpy cifs: Fix memory leak on the deferred close cifs: remove useless parameter 'is_fsctl' from SMB2_ioctl() cifs: remove unused server parameter from calc_smb_size() cifs: missing directory in MAINTAINERS file
2 parents a0a12c3 + 13609a8 commit 367bcbc

File tree

14 files changed

+45
-52
lines changed

14 files changed

+45
-52
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5145,6 +5145,7 @@ T: git git://git.samba.org/sfrench/cifs-2.6.git
51455145
F: Documentation/admin-guide/cifs/
51465146
F: fs/cifs/
51475147
F: fs/smbfs_common/
5148+
F: include/uapi/linux/cifs
51485149

51495150
COMPACTPCI HOTPLUG CORE
51505151
M: Scott Murray <[email protected]>

fs/cifs/cifs_debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void cifs_dump_detail(void *buf, struct TCP_Server_Info *server)
4242
smb->Command, smb->Status.CifsError,
4343
smb->Flags, smb->Flags2, smb->Mid, smb->Pid);
4444
cifs_dbg(VFS, "smb buf %p len %u\n", smb,
45-
server->ops->calc_smb_size(smb, server));
45+
server->ops->calc_smb_size(smb));
4646
#endif /* CONFIG_CIFS_DEBUG2 */
4747
}
4848

fs/cifs/cifsglob.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ struct smb_version_operations {
417417
int (*close_dir)(const unsigned int, struct cifs_tcon *,
418418
struct cifs_fid *);
419419
/* calculate a size of SMB message */
420-
unsigned int (*calc_smb_size)(void *buf, struct TCP_Server_Info *ptcpi);
420+
unsigned int (*calc_smb_size)(void *buf);
421421
/* check for STATUS_PENDING and process the response if yes */
422422
bool (*is_status_pending)(char *buf, struct TCP_Server_Info *server);
423423
/* check for STATUS_NETWORK_SESSION_EXPIRED */

fs/cifs/cifsproto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ extern int cifs_get_writable_path(struct cifs_tcon *tcon, const char *name,
151151
extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *, bool);
152152
extern int cifs_get_readable_path(struct cifs_tcon *tcon, const char *name,
153153
struct cifsFileInfo **ret_file);
154-
extern unsigned int smbCalcSize(void *buf, struct TCP_Server_Info *server);
154+
extern unsigned int smbCalcSize(void *buf);
155155
extern int decode_negTokenInit(unsigned char *security_blob, int length,
156156
struct TCP_Server_Info *server);
157157
extern int cifs_convert_address(struct sockaddr *dst, const char *src, int len);

fs/cifs/cifsroot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static int __init cifs_root_setup(char *line)
5959
pr_err("Root-CIFS: UNC path too long\n");
6060
return 1;
6161
}
62-
strlcpy(root_dev, line, len);
62+
strscpy(root_dev, line, len);
6363
srvaddr = parse_srvaddr(&line[2], s);
6464
if (*s) {
6565
int n = snprintf(root_opts,

fs/cifs/connect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3994,7 +3994,7 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
39943994
}
39953995
bcc_ptr += length + 1;
39963996
bytes_left -= (length + 1);
3997-
strlcpy(tcon->treeName, tree, sizeof(tcon->treeName));
3997+
strscpy(tcon->treeName, tree, sizeof(tcon->treeName));
39983998

39993999
/* mostly informational -- no need to fail on error here */
40004000
kfree(tcon->nativeFileSystem);

fs/cifs/misc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ checkSMB(char *buf, unsigned int total_read, struct TCP_Server_Info *server)
354354
/* otherwise, there is enough to get to the BCC */
355355
if (check_smb_hdr(smb))
356356
return -EIO;
357-
clc_len = smbCalcSize(smb, server);
357+
clc_len = smbCalcSize(smb);
358358

359359
if (4 + rfclen != total_read) {
360360
cifs_dbg(VFS, "Length read does not match RFC1001 length %d\n",
@@ -737,6 +737,8 @@ cifs_close_deferred_file(struct cifsInodeInfo *cifs_inode)
737737
list_for_each_entry(cfile, &cifs_inode->openFileList, flist) {
738738
if (delayed_work_pending(&cfile->deferred)) {
739739
if (cancel_delayed_work(&cfile->deferred)) {
740+
cifs_del_deferred_close(cfile);
741+
740742
tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);
741743
if (tmp_list == NULL)
742744
break;
@@ -766,6 +768,8 @@ cifs_close_all_deferred_files(struct cifs_tcon *tcon)
766768
list_for_each_entry(cfile, &tcon->openFileList, tlist) {
767769
if (delayed_work_pending(&cfile->deferred)) {
768770
if (cancel_delayed_work(&cfile->deferred)) {
771+
cifs_del_deferred_close(cfile);
772+
769773
tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);
770774
if (tmp_list == NULL)
771775
break;
@@ -799,6 +803,8 @@ cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, const char *path)
799803
if (strstr(full_path, path)) {
800804
if (delayed_work_pending(&cfile->deferred)) {
801805
if (cancel_delayed_work(&cfile->deferred)) {
806+
cifs_del_deferred_close(cfile);
807+
802808
tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);
803809
if (tmp_list == NULL)
804810
break;

fs/cifs/netmisc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ map_and_check_smb_error(struct mid_q_entry *mid, bool logErr)
909909
* portion, the number of word parameters and the data portion of the message
910910
*/
911911
unsigned int
912-
smbCalcSize(void *buf, struct TCP_Server_Info *server)
912+
smbCalcSize(void *buf)
913913
{
914914
struct smb_hdr *ptr = buf;
915915
return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) +

fs/cifs/readdir.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,7 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos,
806806

807807
end_of_smb = cfile->srch_inf.ntwrk_buf_start +
808808
server->ops->calc_smb_size(
809-
cfile->srch_inf.ntwrk_buf_start,
810-
server);
809+
cfile->srch_inf.ntwrk_buf_start);
811810

812811
cur_ent = cfile->srch_inf.srch_entries_start;
813812
first_entry_in_buffer = cfile->srch_inf.index_of_last_entry
@@ -1161,8 +1160,7 @@ int cifs_readdir(struct file *file, struct dir_context *ctx)
11611160
cifs_dbg(FYI, "loop through %d times filling dir for net buf %p\n",
11621161
num_to_fill, cifsFile->srch_inf.ntwrk_buf_start);
11631162
max_len = tcon->ses->server->ops->calc_smb_size(
1164-
cifsFile->srch_inf.ntwrk_buf_start,
1165-
tcon->ses->server);
1163+
cifsFile->srch_inf.ntwrk_buf_start);
11661164
end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + max_len;
11671165

11681166
tmp_buf = kmalloc(UNICODE_NAME_MAX, GFP_KERNEL);

fs/cifs/smb2file.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms,
6161
nr_ioctl_req.Reserved = 0;
6262
rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid,
6363
fid->volatile_fid, FSCTL_LMR_REQUEST_RESILIENCY,
64-
true /* is_fsctl */,
6564
(char *)&nr_ioctl_req, sizeof(nr_ioctl_req),
6665
CIFSMaxBufSize, NULL, NULL /* no return info */);
6766
if (rc == -EOPNOTSUPP) {

0 commit comments

Comments
 (0)