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 585F8A00BE; Thu, 23 Dec 2021 05:43:29 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D60864068C; Thu, 23 Dec 2021 05:43:28 +0100 (CET) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id 7A5404067B for ; Thu, 23 Dec 2021 05:43:27 +0100 (CET) Received: by mail-pj1-f46.google.com with SMTP id gj24so4063526pjb.0 for ; Wed, 22 Dec 2021 20:43:27 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=KOYC9PwSa78RKnLum7gnGNRYtq13aL0cWyXmlQObJTE=; b=P0FYa06oAETDoPrC82cLe0580sCwSjTQNhYcuffe1sNME4q2AE5mSoLTs7rR6QQQBK pDyJf+fLDsXgGNIwPjw5gg1t/R4qmKwkheNwNDpGnbLRFaWeJvv11jGJ7L10v28SP80V DUwqkfsiVS3qISKS4Qaqm5jNubcHzxV78M3DdNfrzhkuwaJ0Ip0Md0dVryXfWLP6EVyO cbduTmfbFbklM2eUfVjwyd7DR6estraLr8gkNThtdvmLsoHwpkLzW85PtVD9Hr1QaQsT BXKGF9tKHGot8y4Ckqjis6YfwFBWtUb+uFqDiKhluGz/tOXrNp/ELUeSbCSW4Efak964 O2OQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=KOYC9PwSa78RKnLum7gnGNRYtq13aL0cWyXmlQObJTE=; b=lX2n2Mw2k8KpuDK4F8GPHKQVIJPusCgX4pk4DXl1xTbmkkFd10PgYnrIcNgnJcwIQ/ qG9EoAKjlNUHd98tMkuCYrq/12lR7zkNQI5nKytp3V03XWNVsDCmn2VZkJ8UFE92dECS aPWiRhqQF9yDVM/FvC4tFN78Bkc0bu85Z+1MdbiPYxa7Ef4lWtt+zLBfY10Wb1YdLg4w RnYf9QxSmANFHYgAjWGLtkzVZj6YfKnq6UwHVfrEAk1L9OOyU3fHT0oY9wFVXLoutNxZ 8TnjrCe7SGTd25Dr8Y8L7K+objrpnnGDHBHgdhNeQD+WlN6QIbRzLkTTWldKYiGiLK5w XCbA== X-Gm-Message-State: AOAM530bJG8HDDMx2xGve7H5MEiIsL8LoIz5dEI48QlUllrgsPQyx4T9 dRTpMv49biLZAVmiFCzhxObv1PlVg0IEkg== X-Google-Smtp-Source: ABdhPJwR6ibiEcoLoFGPVHt44RIZHWilYjBRvRp7T+amup1FWolm7lx4x1nBMy25lZIVw7/OW4NRPQ== X-Received: by 2002:a17:902:d2c6:b0:149:b75:b5d6 with SMTP id n6-20020a170902d2c600b001490b75b5d6mr774919plc.99.1640234606371; Wed, 22 Dec 2021 20:43:26 -0800 (PST) Received: from localhost.localdomain ([157.255.44.216]) by smtp.gmail.com with ESMTPSA id b9sm4178685pfm.127.2021.12.22.20.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 20:43:26 -0800 (PST) From: Harold Huang To: dev@dpdk.org Cc: Maxime Coquelin , Chenbo Xia Subject: [PATCH] net/virtio: fix unreleased resource when creating virtio user dev is failed Date: Thu, 23 Dec 2021 12:42:37 +0800 Message-Id: <20211223044237.52037-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 event cb is not released and the backend created tap device is not destroyed. It would cause some residual tap device existed in the host and creating a new vdev could be failed because the new virtio_user_dev could use the same address pointer and register memory event cb to the same address is not allowed. Signed-off-by: Harold Huang --- Compared to patch v3, commit log is changed because this bug could cause residual tap device in the host. 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