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 90748A00BE; Mon, 20 Dec 2021 13:41:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1537B40040; Mon, 20 Dec 2021 13:41:12 +0100 (CET) Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by mails.dpdk.org (Postfix) with ESMTP id 9C0A54003C for ; Mon, 20 Dec 2021 13:41:10 +0100 (CET) Received: by mail-pj1-f51.google.com with SMTP id iy13so3790903pjb.5 for ; Mon, 20 Dec 2021 04:41:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eii4lj+LvkzC8g/Mj2ArR5OLB7m0yOdd5BiZKMHTDAo=; b=gVV56pprfvLEf1EK0p+c2mxLJNQEYVx+UKSrrlbgIBv9Ds1gG096IFHy712T3Df+P3 tvUlx58TqeTFVAssR7KhC9I9gM7DHiYsM2k9RNdJ4oJ2F3/qM5KE+qfPlPbA/qDwSJwv 36UWqDjqBY2XcK3/atpZk2vM8H7evITj0q8msvmvDZx+3jvBYivxelYF+OWVZhPS/G7E +ho48bUhx9wU5mlq1FI13bI8YKUHtR8Z0x6upBX0A4Y9RDaYRYEWDrNCiop4AGw1SgoU EvzGDXYanYDIkaZlwsM6YTZOz3n/K10Cl3GeRCt4qtyNXJSNLFMzehcA9uJuxtns1b9C 4tFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eii4lj+LvkzC8g/Mj2ArR5OLB7m0yOdd5BiZKMHTDAo=; b=4Uxdzjrudrx/6x/XcjLxEi79Aw+tHkriuIEYHxBKztkTbMcFFESIILdCKmkngHLR8m 2pT8rExOHUIyxJ11QHCoPfCk+aVb2W7EF7hWrv6Hl52cqQPsREFB0Oa2fITijmimTk41 nxcYJsJ/SqmrRcuVLtNIupyylafXRfUjW0ZF/Q7gPjLBrspvL/FzZQrbSiHxdWLKqorS t1GMSSMDb6QMIagodexvutuomdLJLRc/f6CYfLnjs8dRMsqLbuKjLQMYJf0ewH+KYzCJ rAFMWXsy8otAKgJVezBJUNtwz5g0eLxNZ0vi27XJCV2uglwntMNiKEeeiMxQOWc2v1Ty IB8Q== X-Gm-Message-State: AOAM533yjcqWRExg7GxcS0oktUVL0HmS/+7/NoVVyUJPG6mD+VB5Tz9n cknvQHhgPRcKwO1AqdC7ezJCuItD+wKBmg== X-Google-Smtp-Source: ABdhPJzZu1gQlFGjulpfyJlZDa3FJQ9wmkg9zJYXCgFbSWghCgRLPZP0e5g1LiOXGvVMP0MCn9St4A== X-Received: by 2002:a17:90b:4f4c:: with SMTP id pj12mr12959686pjb.121.1640004069639; Mon, 20 Dec 2021 04:41:09 -0800 (PST) Received: from localhost.localdomain ([157.255.44.219]) by smtp.gmail.com with ESMTPSA id r10sm17486987pff.120.2021.12.20.04.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 04:41:09 -0800 (PST) From: Harold Huang To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, chenbo.xia@intel.com Subject: [PATCH] net/virtio: unregister virtio user memery event to fix memory leak problem Date: Mon, 20 Dec 2021 20:41:00 +0800 Message-Id: <20211220124100.1307675-1-baymaxhuang@gmail.com> X-Mailer: git-send-email 2.27.0 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 memery is not released and creating a new virtio user dev could be failed becase 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