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 4CD3BA00BE; Mon, 20 Dec 2021 13:49:40 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF5D040040; Mon, 20 Dec 2021 13:49:39 +0100 (CET) Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by mails.dpdk.org (Postfix) with ESMTP id A8E084003C for ; Mon, 20 Dec 2021 13:49:38 +0100 (CET) Received: by mail-pf1-f171.google.com with SMTP id t19so2327552pfg.9 for ; Mon, 20 Dec 2021 04:49:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=4HouyIrEwI6GZiHHZQ/0XNoYGyM7DL7ElLzEv1/NvgM=; b=gIvSnQpBzwPKkkm1vkN9mZlzhxdewBJ3vh4uNwCahR21ux0/6FjPYsEdMcGbVR5w7y A5JhmkRRcCOwLA/lLI1my/naSePEJkKhZuWFyvn0iIH/G2kFPt2nHLL16za7ehzVivjI knvr1p33EuvQkcHIc2FMI7R7gAYS/KTJYgfuw47X9qZU5+vcpdoeev+tdCJ+lV7/Z4Bo sq/nuNRjiNIgP1ZFB28kywMO+tS7quONsk3zAnl5Cbdd5cl8AZfAfNCgkaSRaFQSPJP4 q3ox8o3VPaZ/q2uSSHp/hQSfnr5RB5wGApH4ixndhqnBo6gvAlRWLQXF9LxSTf8tAJyO pw6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4HouyIrEwI6GZiHHZQ/0XNoYGyM7DL7ElLzEv1/NvgM=; b=cgCI3/C7Xg/U25TiK1nL9qSY/4WxBplIEo/bi1+/CmDcpHBAKORVpKtBPfrewRaVUx t9ZvvkHSc1NFPGDXK1Je+4BVIM2ABqdq/eXQp+K+5Kam8zKRvIOVo2c5LG2RQE7Hl/bk d5RuEidnLDtMMwtEnVvqB3/LI232sbNxu+nJMTaOGjWIT/Tr7UOz56c+jUZ30zcUQE7j 6TdrTJlFDdjokI16Ytj8/ow70wexZAQJRV28587O714mUw0UkKjrnSgWDvOScPsjugqU mDiwPyAr0DoGZJBZAL63crgOX/1Sbt0pNTW+sSEJkguolUK5yG01cxDGC7lcjBKC8Ewx QeRQ== X-Gm-Message-State: AOAM530k5Km+hyuglg5ugMl4AwUlTa0Mm7N7wYsa/pJWajPYVZL2BYye OcSntHjH9nLPvlIrKFDPm9qgAkqu05iNxA== X-Google-Smtp-Source: ABdhPJzpuvrqPLI+belUyGZ4npbW9N5bE+f9ixyW2pYnG3Hn7t4COlPCFsDNjpBi99iCvZ8LGD0lpA== X-Received: by 2002:a63:e318:: with SMTP id f24mr14958922pgh.207.1640004577733; Mon, 20 Dec 2021 04:49:37 -0800 (PST) Received: from localhost.localdomain ([157.255.44.216]) by smtp.gmail.com with ESMTPSA id f21sm19222294pfc.191.2021.12.20.04.49.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 04:49:37 -0800 (PST) From: Harold Huang To: dev@dpdk.org Subject: [PATCH v2] net/virtio: unregister virtio user memory event to fix memory leak problem Date: Mon, 20 Dec 2021 20:49:29 +0800 Message-Id: <20211220124929.1309369-1-baymaxhuang@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211220124100.1307675-1-baymaxhuang@gmail.com> References: <20211220124100.1307675-1-baymaxhuang@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 When eth_virtio_dev_init is failed, the registered virtio user memory is not released and creating a new virtio user dev could be failed because the new dev could use the same address pointer and the register virtio user memory to the same address is not allowed. Signed-off-by: Harold Huang --- drivers/net/virtio/virtio_user_ethdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 0271098f0d..16eca2f940 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -666,6 +666,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *vdev) /* previously called by pci probing for physical dev */ if (eth_virtio_dev_init(eth_dev) < 0) { PMD_INIT_LOG(ERR, "eth_virtio_dev_init fails"); + virtio_user_dev_uninit(dev); virtio_user_eth_dev_free(eth_dev); goto end; } -- 2.27.0