Skip to content

Commit 174914e

Browse files
committed
Merge tag 'v7.1-rc6-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client fixes from Steve French: - fix uninitialized variable in smb2_writev_callback() - detect short folioq copy in cifs_copy_folioq_to_iter() * tag 'v7.1-rc6-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: smb: client: fix uninitialized variable in smb2_writev_callback smb: client: detect short folioq copy in cifs_copy_folioq_to_iter()
2 parents 9d87d0f + 9d24911 commit 174914e

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

fs/smb/client/smb2ops.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4706,9 +4706,15 @@ cifs_copy_folioq_to_iter(struct folio_queue *folioq, size_t data_size,
47064706
{
47074707
for (; folioq; folioq = folioq->next) {
47084708
for (int s = 0; s < folioq_count(folioq); s++) {
4709-
struct folio *folio = folioq_folio(folioq, s);
4710-
size_t fsize = folio_size(folio);
4711-
size_t n, len = umin(fsize - skip, data_size);
4709+
struct folio *folio;
4710+
size_t fsize, n, len;
4711+
4712+
if (data_size == 0)
4713+
return 0;
4714+
4715+
folio = folioq_folio(folioq, s);
4716+
fsize = folio_size(folio);
4717+
len = umin(fsize - skip, data_size);
47124718

47134719
n = copy_folio_to_iter(folio, skip, len, iter);
47144720
if (n != len) {
@@ -4721,6 +4727,12 @@ cifs_copy_folioq_to_iter(struct folio_queue *folioq, size_t data_size,
47214727
}
47224728
}
47234729

4730+
if (data_size != 0) {
4731+
cifs_dbg(VFS, "%s: short copy, %zu bytes missing\n",
4732+
__func__, data_size);
4733+
return smb_EIO2(smb_eio_trace_rx_copy_to_iter, 0, data_size);
4734+
}
4735+
47244736
return 0;
47254737
}
47264738

fs/smb/client/smb2pdu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4955,7 +4955,7 @@ smb2_writev_callback(struct TCP_Server_Info *server, struct mid_q_entry *mid)
49554955
unsigned int rreq_debug_id = wdata->rreq->debug_id;
49564956
unsigned int subreq_debug_index = wdata->subreq.debug_index;
49574957
ssize_t result = 0;
4958-
size_t written;
4958+
size_t written = 0;
49594959

49604960
WARN_ONCE(wdata->server != server,
49614961
"wdata server %p != mid server %p",

0 commit comments

Comments
 (0)