Skip to content

Commit cc02e6e

Browse files
author
Alexander Gordeev
committed
s390/crash: add missing iterator advance in copy_oldmem_page()
In case old memory was successfully copied the passed iterator should be advanced as well. Currently copy_oldmem_page() is always called with single-segment iterator. Should that ever change - copy_oldmem_user and copy_oldmem_kernel() functions would need a rework to deal with multi-segment iterators. Fixes: 5d8de29 ("vmcore: convert copy_oldmem_page() to take an iov_iter") Reviewed-by: Alexander Egorenkov <[email protected]> Tested-by: Alexander Egorenkov <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent a111daf commit cc02e6e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

arch/s390/kernel/crash_dump.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn, size_t csize,
219219
unsigned long src;
220220
int rc;
221221

222+
if (!(iter_is_iovec(iter) || iov_iter_is_kvec(iter)))
223+
return -EINVAL;
224+
/* Multi-segment iterators are not supported */
225+
if (iter->nr_segs > 1)
226+
return -EINVAL;
222227
if (!csize)
223228
return 0;
224229
src = pfn_to_phys(pfn) + offset;
@@ -228,6 +233,8 @@ ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn, size_t csize,
228233
rc = copy_oldmem_user(iter->iov->iov_base, src, csize);
229234
else
230235
rc = copy_oldmem_kernel(iter->kvec->iov_base, src, csize);
236+
if (!rc)
237+
iov_iter_advance(iter, csize);
231238
return rc;
232239
}
233240

0 commit comments

Comments
 (0)