Skip to content

Commit 5ec83b2

Browse files
committed
Merge tag '4.17-rc1-SMB3-CIFS' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "Various SMB3/CIFS fixes. There are three more security related fixes in progress that are not included in this set but they are still being tested and reviewed, so sending this unrelated set of smaller fixes now" * tag '4.17-rc1-SMB3-CIFS' of git://git.samba.org/sfrench/cifs-2.6: CIFS: fix typo in cifs_dbg cifs: do not allow creating sockets except with SMB1 posix exensions cifs: smbd: Dump SMB packet when configured cifs: smbd: Check for iov length on sending the last iov fs: cifs: Adding new return type vm_fault_t cifs: smb2ops: Fix NULL check in smb2_query_symlink
2 parents d54b5c1 + 596632d commit 5ec83b2

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

fs/cifs/cifs_debug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ do { \
5454
pr_debug_ ## ratefunc("%s: " \
5555
fmt, __FILE__, ##__VA_ARGS__); \
5656
} else if ((type) & VFS) { \
57-
pr_err_ ## ratefunc("CuIFS VFS: " \
57+
pr_err_ ## ratefunc("CIFS VFS: " \
5858
fmt, ##__VA_ARGS__); \
5959
} else if ((type) & NOISY && (NOISY != 0)) { \
6060
pr_debug_ ## ratefunc(fmt, ##__VA_ARGS__); \

fs/cifs/dir.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,9 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
684684
goto mknod_out;
685685
}
686686

687+
if (!S_ISCHR(mode) && !S_ISBLK(mode))
688+
goto mknod_out;
689+
687690
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL))
688691
goto mknod_out;
689692

@@ -692,10 +695,8 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
692695

693696
buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
694697
if (buf == NULL) {
695-
kfree(full_path);
696698
rc = -ENOMEM;
697-
free_xid(xid);
698-
return rc;
699+
goto mknod_out;
699700
}
700701

701702
if (backup_cred(cifs_sb))
@@ -742,7 +743,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
742743
pdev->minor = cpu_to_le64(MINOR(device_number));
743744
rc = tcon->ses->server->ops->sync_write(xid, &fid, &io_parms,
744745
&bytes_written, iov, 1);
745-
} /* else if (S_ISFIFO) */
746+
}
746747
tcon->ses->server->ops->close(xid, tcon, &fid);
747748
d_drop(direntry);
748749

fs/cifs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3462,7 +3462,7 @@ cifs_read(struct file *file, char *read_data, size_t read_size, loff_t *offset)
34623462
* If the page is mmap'ed into a process' page tables, then we need to make
34633463
* sure that it doesn't change while being written back.
34643464
*/
3465-
static int
3465+
static vm_fault_t
34663466
cifs_page_mkwrite(struct vm_fault *vmf)
34673467
{
34683468
struct page *page = vmf->page;

fs/cifs/smb2ops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
14521452
struct cifs_open_parms oparms;
14531453
struct cifs_fid fid;
14541454
struct kvec err_iov = {NULL, 0};
1455-
struct smb2_err_rsp *err_buf = NULL;
1455+
struct smb2_err_rsp *err_buf;
14561456
struct smb2_symlink_err_rsp *symlink;
14571457
unsigned int sub_len;
14581458
unsigned int sub_offset;
@@ -1476,7 +1476,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
14761476

14771477
rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, &err_iov);
14781478

1479-
if (!rc || !err_buf) {
1479+
if (!rc || !err_iov.iov_base) {
14801480
kfree(utf16_path);
14811481
return -ENOENT;
14821482
}

fs/cifs/smbdirect.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ static int smbd_post_send(struct smbd_connection *info,
10281028
for (i = 0; i < request->num_sge; i++) {
10291029
log_rdma_send(INFO,
10301030
"rdma_request sge[%d] addr=%llu length=%u\n",
1031-
i, request->sge[0].addr, request->sge[0].length);
1031+
i, request->sge[i].addr, request->sge[i].length);
10321032
ib_dma_sync_single_for_device(
10331033
info->id->device,
10341034
request->sge[i].addr,
@@ -2139,6 +2139,10 @@ int smbd_send(struct smbd_connection *info, struct smb_rqst *rqst)
21392139
goto done;
21402140
}
21412141

2142+
cifs_dbg(FYI, "Sending smb (RDMA): smb_len=%u\n", buflen);
2143+
for (i = 0; i < rqst->rq_nvec-1; i++)
2144+
dump_smb(iov[i].iov_base, iov[i].iov_len);
2145+
21422146
remaining_data_length = buflen;
21432147

21442148
log_write(INFO, "rqst->rq_nvec=%d rqst->rq_npages=%d rq_pagesz=%d "
@@ -2194,6 +2198,8 @@ int smbd_send(struct smbd_connection *info, struct smb_rqst *rqst)
21942198
goto done;
21952199
}
21962200
i++;
2201+
if (i == rqst->rq_nvec)
2202+
break;
21972203
}
21982204
start = i;
21992205
buflen = 0;

0 commit comments

Comments
 (0)