Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3217991ybl; Mon, 19 Aug 2019 14:25:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxD92AYyzERFGb7VkC/oxtVLwPayw9sxD2ofreF/SoRXxj9C52GJ8CSCJ51NY9NfHXQn+H5 X-Received: by 2002:aa7:8d88:: with SMTP id i8mr26842174pfr.28.1566249909001; Mon, 19 Aug 2019 14:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566249908; cv=none; d=google.com; s=arc-20160816; b=WJmGMhpYLI0YEZSkoGQI5t0o5xooFtf8i3jBwKSNkWhuncbLa/min2V8wef06hS2so k9+URKjMSevxJGBjNwLe43+JoICuG+YiNxCeWjxC+VasXoqVBAq3mKTrTDFiMHz/dSUZ Q7s2FRVKfw4gPH2DV1u/pLCB8FLWM+QdaGecxzabGQXesWiDPYl0ajUfgqIGeBRN0+k+ 6MamImSeYK05VpRyUXLdTDjiTi9Dt5MMueD6VmJ2iHMALhtfR7gHpLUTCfTj4gOs+cNk Dg4CVKD8+x3ht8xk8trFUNMj9Q2bF/xDXk1oqIVpdw4yjO21ECTnb3Dqm4Wo3c9OnyoH XxnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Gdg9WLzC2BstrPGKSpnBlAUnVhZi2bpGUJxZqkUyB/I=; b=NcIx1R17mYeCpXTgMWsCn1i8Xq3JZy5yKB7d97VjtrpT4Smr0C57lseuqRshZMmdob 3QQ0jmdCEgvohsN4N0cBruhyKjAQ9m8la2cc6q7wQ4YGcTQvaw35o86Z3Oq6+cnw5pza Wb1ZPmiWhEKeoIgHTGbc6QQ4qoKmlrnexxzht/27LzFX+W03/M7ZKHmdPRJlL/BjSv6K d3xhKsrpT8PtZN/ZsJomqoXfO7i8VIdRStVyO9jMm2zNKtRsYSFGkhEHnjsp4oePUUgD ko02FRNLtNjazpJ6T9L/P9KPgzQydUSO7yqR6GMgobRjcO3QSfQFtvXPCbazG1r4eEZb r0cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="QFM/RQBD"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y187si10438022pgd.66.2019.08.19.14.24.53; Mon, 19 Aug 2019 14:25:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="QFM/RQBD"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728636AbfHSVXU (ORCPT + 99 others); Mon, 19 Aug 2019 17:23:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:49238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728018AbfHSVXU (ORCPT ); Mon, 19 Aug 2019 17:23:20 -0400 Received: from localhost (unknown [69.71.4.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F2C9922CE8; Mon, 19 Aug 2019 21:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566249799; bh=3Wg6NFHKKpBSbK1JQfpV0Z+KzBTBs501plCy+K3XQBA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QFM/RQBD3NheayW2hoVztJW9PKN5YydTgSEs0J4apIjMwxmAFdhpMSDDx84SYHHeN LCAEWiDHsWe8huixtSjEhqxlohwG5CiqRnmRJ4DCCf2iIzXYkytT6UhlSOlfuQ4ioH 6n84pUKllbGMl0XFxx5cXRd8T4j2FsRxFMuBlQ3M= Date: Mon, 19 Aug 2019 16:23:17 -0500 From: Bjorn Helgaas To: Wenwen Wang Cc: "Rafael J. Wysocki" , Len Brown , "open list:PCI SUBSYSTEM" , "open list:ACPI" , open list Subject: Re: [PATCH] ACPI / PCI: fix a memory leak bug Message-ID: <20190819212317.GU253360@google.com> References: <1565930002-5524-1-git-send-email-wenwen@cs.uga.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1565930002-5524-1-git-send-email-wenwen@cs.uga.edu> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The subject line should give a clue about where the leak is, e.g., ACPI / PCI: fix acpi_pci_irq_enable() memory leak On Thu, Aug 15, 2019 at 11:33:22PM -0500, Wenwen Wang wrote: > In acpi_pci_irq_enable(), 'entry' is allocated by invoking > acpi_pci_irq_lookup(). However, it is not deallocated if > acpi_pci_irq_valid() returns false, leading to a memory leak. To fix this > issue, free 'entry' before returning 0. I think the corresponding kzalloc() is the one in acpi_pci_irq_check_entry(). > Signed-off-by: Wenwen Wang > --- > drivers/acpi/pci_irq.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c > index d2549ae..dea8a60 100644 > --- a/drivers/acpi/pci_irq.c > +++ b/drivers/acpi/pci_irq.c > @@ -449,8 +449,10 @@ int acpi_pci_irq_enable(struct pci_dev *dev) > * No IRQ known to the ACPI subsystem - maybe the BIOS / > * driver reported one, then use it. Exit in any case. > */ > - if (!acpi_pci_irq_valid(dev, pin)) > + if (!acpi_pci_irq_valid(dev, pin)) { > + kfree(entry); > return 0; > + } Looks like we missed this when e237a5518425 ("x86/ACPI/PCI: Recognize that Interrupt Line 255 means "not connected"") was merged. You could add: Fixes: e237a5518425 ("x86/ACPI/PCI: Recognize that Interrupt Line 255 means "not connected"") > if (acpi_isa_register_gsi(dev)) > dev_warn(&dev->dev, "PCI INT %c: no GSI\n", > -- > 2.7.4 >