Skip to content

Commit 4ef4aee

Browse files
dhowellssmfrench
authored andcommitted
cifs: Fix cifs_limit_bvec_subset() to correctly check the maxmimum size
Fix cifs_limit_bvec_subset() so that it limits the span to the maximum specified and won't return with a size greater than max_size. Fixes: d08089f ("cifs: Change the I/O paths to use an iterator rather than a page list") Cc: [email protected] # 6.3 Reported-by: Shyam Prasad N <[email protected]> Reviewed-by: Shyam Prasad N <[email protected]> Signed-off-by: David Howells <[email protected]> cc: Steve French <[email protected]> cc: Rohith Surabattula <[email protected]> cc: Paulo Alcantara <[email protected]> cc: Tom Talpey <[email protected]> cc: Jeff Layton <[email protected]> cc: [email protected] cc: [email protected] Signed-off-by: Steve French <[email protected]>
1 parent 44c026a commit 4ef4aee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/cifs/file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3353,9 +3353,10 @@ static size_t cifs_limit_bvec_subset(const struct iov_iter *iter, size_t max_siz
33533353
while (n && ix < nbv) {
33543354
len = min3(n, bvecs[ix].bv_len - skip, max_size);
33553355
span += len;
3356+
max_size -= len;
33563357
nsegs++;
33573358
ix++;
3358-
if (span >= max_size || nsegs >= max_segs)
3359+
if (max_size == 0 || nsegs >= max_segs)
33593360
break;
33603361
skip = 0;
33613362
n -= len;

0 commit comments

Comments
 (0)