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 5C230A0C48; Wed, 16 Jun 2021 08:53:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 43BA440683; Wed, 16 Jun 2021 08:53:26 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 33FE040140 for ; Wed, 16 Jun 2021 08:53:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623826403; 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; bh=Jbsdu680M/h8b52Ozir4F2EI/idkWzxHLLqnwrF2mWQ=; b=L39gy7B2nI+dZNXTYgxOn1jgG4tn6HJL47LblpspcXTWB8ofjpgGx96mYxkSGbFkzry7Xj KCrb7UH7RWJAbcDhN98RAy97vBa0TbUMD2RfnRxl8EapDku1Vlt3zMgbQqHt0tyNSi7tEY L8nEbH6SfziYUv2TlW63ZvtbRzrlFKg= 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-405-qBYYa3VxOfavH7Uj8mKvnA-1; Wed, 16 Jun 2021 02:53:22 -0400 X-MC-Unique: qBYYa3VxOfavH7Uj8mKvnA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7EB86101F000; Wed, 16 Jun 2021 06:53:20 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.193.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F9A260C13; Wed, 16 Jun 2021 06:53:17 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: grive@u256.net, stable@dpdk.org, Owen Hilyard , Jerin Jacob Date: Wed, 16 Jun 2021 08:52:57 +0200 Message-Id: <20210616065257.16044-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH] bus/pci: fix leak for unbound devices 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" For devices not bound to any Linux kernel module, we leak a pci object since it is never added to the PCI bus device list. Fixes: c79a1c67465d ("bus/pci: optimize bus scan") Cc: stable@dpdk.org Reported-by: Owen Hilyard Signed-off-by: David Marchand --- drivers/bus/pci/linux/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 0dc99e9cb2..5ea76bc867 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -331,7 +331,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr) else dev->kdrv = RTE_PCI_KDRV_UNKNOWN; } else { - dev->kdrv = RTE_PCI_KDRV_NONE; + free(dev); return 0; } /* device is valid, add in list (sorted) */ -- 2.23.0