From nobody Sun May 19 19:01:02 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=1629077651; cv=none; d=zohomail.com; s=zohoarc; b=Yjb2+a1FifsejEJFQ1+WPaIatFDV5Jy/9OAt+fagHb19Qvb4dhunzUqDQIM8Hkrw3nxnvL5Sye3hsgGW/USWf9wHDwUDdAuFODDcTWWTFNKwKpWMxK3WIZll6um3HZBKlPCz9DqLpS55j1GCYf/XZUvhUi6JYqYiYuwsRMg3+rQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629077651; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=lXKD74UlsbSh94k0d5I7AMkHwFDU6PQJpGZBJGj1GVI=; b=nr3j811F+wO9FBYNPLBhM6k+tK1XJYwq3XVcvAvaRbKWnoccXuNGYttq61FZt14kJ3pkkOe5/DiZ2zfsQP4HX6bKrOglUGNHh768OlNm+KMNVt2yWsEmgEHTztXnAkttKqdbOqe0+wyMlw1N1M6oUTBRCVdYJRUZQUeBrA/Kj2E= 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 1629077650741668.0844292600516; Sun, 15 Aug 2021 18:34:10 -0700 (PDT) Received: from localhost ([::1]:60052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mFRVw-00039Y-Q7 for importer@patchew.org; Sun, 15 Aug 2021 21:34:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mFRV6-0002St-SN for qemu-devel@nongnu.org; Sun, 15 Aug 2021 21:33:16 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:48335 helo=mellanox.co.il) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mFRV4-0005np-CN for qemu-devel@nongnu.org; Sun, 15 Aug 2021 21:33:16 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yajunw@nvidia.com) with SMTP; 16 Aug 2021 04:33:06 +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 17G1X6kv016017; Mon, 16 Aug 2021 04:33:06 +0300 To: qemu-devel@nongnu.org, mst@redhat.com Cc: Yajun Wu Subject: [PATCH v2] hw/virtio: Fix leak of host-notifier memory-region Date: Mon, 16 Aug 2021 04:32:35 +0300 Message-Id: <1629077555-19907-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-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: 1629077654012100001 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. Fixes: 44866521bd ("vhost-user: support registering external host notifiers= ") Signed-off-by: Yajun Wu --- 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