netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Si-Wei Liu <si-wei.liu@oracle.com>
To: mst@redhat.com, jasowang@redhat.com, lingshan.zhu@intel.com
Cc: joao.m.martins@oracle.com, boris.ostrovsky@oracle.com,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org
Subject: [PATCH v3 1/2] vhost-vdpa: fix vhost_vdpa_map() on error condition
Date: Sat,  3 Oct 2020 01:02:09 -0400	[thread overview]
Message-ID: <1601701330-16837-2-git-send-email-si-wei.liu@oracle.com> (raw)
In-Reply-To: <1601701330-16837-1-git-send-email-si-wei.liu@oracle.com>

vhost_vdpa_map() should remove the iotlb entry just added
if the corresponding mapping fails to set up properly.

Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend")
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
---
 drivers/vhost/vdpa.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 796fe97..0f27919 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -565,6 +565,9 @@ static int vhost_vdpa_map(struct vhost_vdpa *v,
 			      perm_to_iommu_flags(perm));
 	}
 
+	if (r)
+		vhost_iotlb_del_range(dev->iotlb, iova, iova + size - 1);
+
 	return r;
 }
 
-- 
1.8.3.1


  reply	other threads:[~2020-10-03  5:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03  5:02 [PATCH v3 0/2] vhost-vdpa mapping error path fixes Si-Wei Liu
2020-10-03  5:02 ` Si-Wei Liu [this message]
2020-10-10  1:48   ` [PATCH v3 1/2] vhost-vdpa: fix vhost_vdpa_map() on error condition Jason Wang
2020-10-11  6:45     ` Michael S. Tsirkin
2020-10-03  5:02 ` [PATCH v3 2/2] vhost-vdpa: fix page pinning leakage in error path Si-Wei Liu
2020-10-10  2:27   ` Jason Wang
2020-10-13 23:42     ` si-wei liu
2020-10-14  6:52       ` Michael S. Tsirkin
2020-10-14 11:41         ` Jason Wang
2020-10-15  6:15       ` Jason Wang
2020-10-15 13:11         ` Michael S. Tsirkin
2020-10-15 20:17           ` si-wei liu
2020-10-29 21:53             ` Michael S. Tsirkin
2020-10-29 23:22               ` si-wei liu
2020-11-03  5:34               ` si-wei liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1601701330-16837-2-git-send-email-si-wei.liu@oracle.com \
    --to=si-wei.liu@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jasowang@redhat.com \
    --cc=joao.m.martins@oracle.com \
    --cc=lingshan.zhu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).