From nobody Sun May 19 14:32:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1628738603; cv=none; d=zohomail.com; s=zohoarc; b=oIlnjJyShh6kHPIGUHOT61axKvhhW74xy8UF1qM+oLy2TACCVPcj/6kP9Rb8P7g5f4r/ouL7JFwBwRzVLE2IhFSu1zKZSJ9lKqqMkWnOJU53cKl3oAme/OWX/KXqNekkrB9LJLPQHMxj9HNJOyN/rFkfjec02Lun+fycc80HF00= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628738603; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=PZDjTEkfXV6BdL3MSaOYqsUzU5m9PtXi7O/m0yy/vVU=; b=EQo9Z8xXy1yJi2dOgdvvS1D+inSOpcWHaENcW7y4VxBENlHl/uHlgZ4TZrGqCcGIf86VSnMLQnI7pfTBacN3C1nW2VriS3FIQiy6xqtPTRDcwpJjRNIqFUI55LT5KNOzwgqwcD7lRsnZr2a9D4UkY0kCcMp3iFe3MiNHgjYJ2gI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1628738603336469.69168753294457; Wed, 11 Aug 2021 20:23:23 -0700 (PDT) Received: from localhost ([::1]:52232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mE1JR-000193-WF for importer@patchew.org; Wed, 11 Aug 2021 23:23:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDzg6-0007U2-De for qemu-devel@nongnu.org; Wed, 11 Aug 2021 21:38:38 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:34690 helo=mellanox.co.il) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDzg3-00071N-Cw for qemu-devel@nongnu.org; Wed, 11 Aug 2021 21:38:38 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yajunw@nvidia.com) with SMTP; 12 Aug 2021 04:38:31 +0300 Received: from gen-l-vrt-294.mtl.labs.mlnx. (gen-l-vrt-294.mtl.labs.mlnx [10.237.7.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 17C1cVL1016940; Thu, 12 Aug 2021 04:38:31 +0300 To: qemu-devel@nongnu.org, mst@redhat.com Cc: Yajun Wu Subject: [PATCH] hw/virtio: Fix leak of host-notifier memory-region Date: Thu, 12 Aug 2021 04:37:26 +0300 Message-Id: <1628732246-34765-1-git-send-email-yajunw@nvidia.com> X-Mailer: git-send-email 1.8.3.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=193.47.165.129; envelope-from=yajunw@nvidia.com; helo=mellanox.co.il X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 11 Aug 2021 23:22:39 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Yajun Wu From: Yajun Wu via X-ZM-MESSAGEID: 1628738604362100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If call virtio_queue_set_host_notifier_mr fails, should free host-notifier memory-region. Signed-off-by: Yajun Wu Reviewed-by: Stefano Garzarella --- hw/virtio/vhost-user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index aec6cc1..3ae5297 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1474,6 +1474,7 @@ static int vhost_user_slave_handle_vring_host_notifie= r(struct vhost_dev *dev, g_free(name); =20 if (virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true)) { + object_unparent(OBJECT(&n->mr)); munmap(addr, page_size); return -1; } --=20 1.8.3.1