From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D438EA0C47; Mon, 26 Jul 2021 14:54:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6343440F35; Mon, 26 Jul 2021 14:54:14 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 5AE7D40DDA for ; Mon, 26 Jul 2021 14:54:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627304051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zxbclxPHrtt4CNDqecX/LDQ0e04sTcoWCwVc5dxB/P4=; b=JfsOXmcaMQBgGrqvf8Jqrb6AeYog8EM4wSht3RwJHVVgAXj+tB+cy6DYMKM0lr04xgjia7 6ri6TYacxIESqkheMPC/p95inOKRV7YP3Eh6azqLW14286Tm/8F3Pl1qnE6pSRNNiqjt9o FY3ebAKrt06wfOQZONdQDU/3VZn3I2s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-366-4msoTr3jOT6Xt7AzMcuezw-1; Mon, 26 Jul 2021 08:54:08 -0400 X-MC-Unique: 4msoTr3jOT6Xt7AzMcuezw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 36869190A7A9; Mon, 26 Jul 2021 12:54:07 +0000 (UTC) Received: from [10.36.110.10] (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E1725C1CF; Mon, 26 Jul 2021 12:54:06 +0000 (UTC) To: Gaoxiang Liu , chenbo.xia@intel.com, dev@dpdk.org, liugaoxiang@huawei.com References: <20210725020315.15010-1-clgx0086@163.com> <20210726115951.92-1-clgx0086@163.com> From: Maxime Coquelin Message-ID: <0eb4df0a-2577-692f-5099-009778af19c9@redhat.com> Date: Mon, 26 Jul 2021 14:54:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210726115951.92-1-clgx0086@163.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] net/virtio: fix memory leak of interrupt handle X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 7/26/21 1:59 PM, Gaoxiang Liu wrote: > Free memory of interrupt handle in virtio_user_dev_uninit() to > avoid memory leak. > when virtio user dev closes, the "intr_handle" memory is not freed > that is allocated in virtio_user_fill_intr_handle(). > > Fixes: 3d4fb6fd2505 <"net/virtio-user: support Rx interrupt"> > > Signed-off-by: Gaoxiang Liu > --- > drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c > index 1cd1e95f4..16c58710d 100644 > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > @@ -654,6 +654,13 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, > void > virtio_user_dev_uninit(struct virtio_user_dev *dev) > { > + struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->hw.port_id]; > + > + if (eth_dev->intr_handle) { > + free(eth_dev->intr_handle); > + eth_dev->intr_handle = NULL; > + } > + > virtio_user_stop_device(dev); > > rte_mem_event_callback_unregister(VIRTIO_USER_MEM_EVENT_CLB_NAME, dev); > Reviewed-by: Maxime Coquelin Thanks, Maxime