]> git.baikalelectronics.ru Git - kernel.git/commit
vhost-vdpa: fix page pinning leakage in error path
authorSi-Wei Liu <si-wei.liu@oracle.com>
Sat, 3 Oct 2020 05:02:10 +0000 (01:02 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 4 Oct 2020 07:47:02 +0000 (03:47 -0400)
commitc2b65e73f0698c71b70531b5675722698037d5b9
tree390f041ae115d5c9cb71835ca4a07cc8961c58af
parent0ebdfc98ef473fd96a107460a52d7521b6aa7eb5
vhost-vdpa: fix page pinning leakage in error path

Pinned pages are not properly accounted particularly when
mapping error occurs on IOTLB update. Clean up dangling
pinned pages for the error path. As the inflight pinned
pages, specifically for memory region that strides across
multiple chunks, would need more than one free page for
book keeping and accounting. For simplicity, pin pages
for all memory in the IOVA range in one go rather than
have multiple pin_user_pages calls to make up the entire
region. This way it's easier to track and account the
pages already mapped, particularly for clean-up in the
error path.

Fixes: f94b9137d7f7 ("vhost: introduce vDPA-based backend")
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
Link: https://lore.kernel.org/r/1601701330-16837-3-git-send-email-si-wei.liu@oracle.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/vdpa.c