Skip to content

Commit

Permalink
s390/crash: add missing iterator advance in copy_oldmem_page()
Browse files Browse the repository at this point in the history
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 <egorenar@linux.ibm.com>
Tested-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
  • Loading branch information
Alexander Gordeev committed Jun 23, 2022
1 parent a111daf commit cc02e6e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/s390/kernel/crash_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn, size_t csize,
unsigned long src;
int rc;

if (!(iter_is_iovec(iter) || iov_iter_is_kvec(iter)))
return -EINVAL;
/* Multi-segment iterators are not supported */
if (iter->nr_segs > 1)
return -EINVAL;
if (!csize)
return 0;
src = pfn_to_phys(pfn) + offset;
Expand All @@ -228,6 +233,8 @@ ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn, size_t csize,
rc = copy_oldmem_user(iter->iov->iov_base, src, csize);
else
rc = copy_oldmem_kernel(iter->kvec->iov_base, src, csize);
if (!rc)
iov_iter_advance(iter, csize);
return rc;
}

Expand Down

0 comments on commit cc02e6e

Please sign in to comment.