Message ID | 20200225151210.647797-10-mst@redhat.com |
---|---|
State | New |
Headers | show
Return-Path: <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=G9op1Aje; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48RjFk67hmz9sPk for <incoming@patchwork.ozlabs.org>; Wed, 26 Feb 2020 02:16:42 +1100 (AEDT) Received: from localhost ([::1]:58540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>) id 1j6bwu-0004IZ-Mk for incoming@patchwork.ozlabs.org; Tue, 25 Feb 2020 10:16:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55316) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <mst@redhat.com>) id 1j6btf-0007Ju-Px for qemu-devel@nongnu.org; Tue, 25 Feb 2020 10:13:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <mst@redhat.com>) id 1j6bte-00014e-Jw for qemu-devel@nongnu.org; Tue, 25 Feb 2020 10:13:19 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:56520 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <mst@redhat.com>) id 1j6bte-00013k-GV for qemu-devel@nongnu.org; Tue, 25 Feb 2020 10:13:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582643596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NjdfC5cPcTj7xCSppU7CRy3um06hUEk/RHvT4NHcJJM=; b=G9op1Aje6UXyaoN8TH1YIyF8zv9av2w6BgwTCgfCJdmXTFbD1GgrCpLjnJmM3EKLGbaG7c 4/ZV6+GtIhvV7W1ZSH7LghlzDmfnxkSxAmWW65yLOLD/8FQ+NtYyEosxH2o9K2WbgLJ21l V4oTogM05ReIXqU/P275fBgY75ENaeA= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-270-6CU8SYAbNgWIuR3Tsn17MA-1; Tue, 25 Feb 2020 10:13:14 -0500 X-MC-Unique: 6CU8SYAbNgWIuR3Tsn17MA-1 Received: by mail-qt1-f199.google.com with SMTP id u40so15236483qtk.1 for <qemu-devel@nongnu.org>; Tue, 25 Feb 2020 07:13:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=yx/d9Pi1yF7zdpvYgnvi6Hx1i6BxcPVN8IeOoA2COOE=; b=IojKLbM5i+GgyVNkxsD9LN41p2D8TkXfHSoBnmXaPIey1B60BDOvtCyRNpVwjy0Jgb 8QNP98AoG+bmeQqM7j0rb1V/NgWCCj7jHYN3IRpuW+UXJKRV4Mno9YGxWML6jYgmKCsL vTYOx5kKd8zzF+dIrFpLiT4dbL99vkt/0p4d6DuWNPGP4NjdhT+Cq3PPehgBpPtSq6ax dkB5ZcPGZaGS5VWwL63lO0fNuxhiZRBUMgf+SguJ+0PG31FXicx8eCPClnS6v+nA0Ung RmXMhFu/Xz4t8cDDNfk+8ZzTdR1Rjs5dBq5u9R+kWoFgGjZEzvDZNaNPeHSSgV3qmDPx h3qw== X-Gm-Message-State: APjAAAWc+lwshZUSXnoKyDt/G5tlXlQNbnK2UnhqMBeE8ITh2InOh5mu PnSw+F8eBJpc0KqYRh+IgCWjLKVIlRmfPPdNt8GLkd8+omXXgx8NW+vb07YIEt9u1E8Nlve3x1G BwAY2LML8AFI/X+s= X-Received: by 2002:a37:b11:: with SMTP id 17mr2709182qkl.384.1582643594116; Tue, 25 Feb 2020 07:13:14 -0800 (PST) X-Google-Smtp-Source: APXvYqx1Bx8sj51cx6qcGziyMuYuhqzSh00LZNm7YilIUiwjZ2W4paq0tvafub4o2LqgXwOGyPYuTg== X-Received: by 2002:a37:b11:: with SMTP id 17mr2709161qkl.384.1582643593881; Tue, 25 Feb 2020 07:13:13 -0800 (PST) Received: from redhat.com (bzq-79-178-2-214.red.bezeqint.net. [79.178.2.214]) by smtp.gmail.com with ESMTPSA id l8sm7499378qtr.36.2020.02.25.07.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2020 07:13:12 -0800 (PST) Date: Tue, 25 Feb 2020 10:13:08 -0500 From: "Michael S. Tsirkin" <mst@redhat.com> To: qemu-devel@nongnu.org Subject: [PULL 09/32] vhost-user-blk: delete virtioqueues in unrealize to fix memleaks Message-ID: <20200225151210.647797-10-mst@redhat.com> References: <20200225151210.647797-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200225151210.647797-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: Kevin Wolf <kwolf@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, qemu-block@nongnu.org, Pan Nengyuan <pannengyuan@huawei.com>, Max Reitz <mreitz@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Euler Robot <euler.robot@huawei.com> Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org> |
Series |
[PULL,01/32] bios-tables-test: tell people how to update
|
expand
|
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index d8c459c575..2eba8b9db0 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -460,6 +460,9 @@ reconnect: virtio_err: g_free(s->vqs); g_free(s->inflight); + for (i = 0; i < s->num_queues; i++) { + virtio_del_queue(vdev, i); + } virtio_cleanup(vdev); vhost_user_cleanup(&s->vhost_user); } @@ -468,6 +471,7 @@ static void vhost_user_blk_device_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VHostUserBlk *s = VHOST_USER_BLK(dev); + int i; virtio_set_status(vdev, 0); qemu_chr_fe_set_handlers(&s->chardev, NULL, NULL, NULL, @@ -476,6 +480,10 @@ static void vhost_user_blk_device_unrealize(DeviceState *dev, Error **errp) vhost_dev_free_inflight(s->inflight); g_free(s->vqs); g_free(s->inflight); + + for (i = 0; i < s->num_queues; i++) { + virtio_del_queue(vdev, i); + } virtio_cleanup(vdev); vhost_user_cleanup(&s->vhost_user); }