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 6CADDA0C48 for ; Wed, 16 Jun 2021 08:53:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F2EF410DE; Wed, 16 Jun 2021 08:53:28 +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 3646140140 for ; Wed, 16 Jun 2021 08:53:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623826405; 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=bHYNgxmnJwJYyvYjh2yHnRIrKf9tXDlHvmQoWmqssPjV2pLTqIl/YrfR0hG6yENIWZsEAx 4+dF1kVItSe1gUKnm1a/3gO5Np5ooA6yRb7j/EQJvoQDQQrJ7pYqW56xofpheVC+Evxeau rJPOND+dHcgaVTjvY4kHAtqAb0NbJmc= 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-stable] [PATCH] bus/pci: fix leak for unbound devices X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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