Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1093287ybe; Mon, 2 Sep 2019 14:22:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcfBNPJEAmYOVhQIJpFzK3ymJPc7hoM7rjP7e/NJ8EgwgbAdf/3gU+86M2PJtCpjEArO9l X-Received: by 2002:a17:902:16e:: with SMTP id 101mr17440586plb.139.1567459348688; Mon, 02 Sep 2019 14:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567459348; cv=none; d=google.com; s=arc-20160816; b=FsSKu9PRn6GkE/+Opi8NdAKWxXOAvkMJGZOEKyO1DzREOcuUSQ+bdBfXR4t11Uv5Qn mIuuaeWthTjC87xN2XGwe83EbZRWPsOliSGm4KA4nw8O3vsxDrYO05MbwE5qL3ogln0b HKA1YnRZoxv7V8L2NSoKktu00tLIxmT+3MUESzAAmLdfW+mtWUSLir3Wd/04j8GYT31k m4lDMzlkI9iSMClnEJ1VDPgAmFC3zmufpAAj53SDSiCoCxNRF/v3H46QiN+l55C/7Yl/ 0m+ch3ZZPpAr8v4eMCMyPPnr+TmCDWMWa6OtKylTm35DtIwGJEBICQJhG6KD95Z3g6e+ WGJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=+lpVdJyYQZ7LkgNkMVrzaDCTE1l3PZ7/Lcu/MbmwZUI=; b=je2js+LJVE+7P/UowucW2he5UVA82g+peteA4deZiCQxk1ZDDQk9lRm24boBuhOqBg aauPTyYIAuRgcA4NT0EGgrj4Ud6sMKPJwRRPmHYy6cRoSYSHiaNaP3/zXzzOiK+W2sp2 UPliAN0A57dn6mDmq8fDxTvtu0UPz2fS4+gPDFjGB3tWo1P5xVEBDksHj/nyVy6XYDk5 Vij2SH4DYnkscIGSrkYfSxjaAWYWiS+bKXzskYX7CuGJeZw7iYefoV7b5iw+UaJCvAjF ZW7/RGRF6mdjGAcZlkEFgl97spaMtjHttsb1GqldTm2rW6GLs7BQ92x4EVy9/HZuwG8m QpGw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 ck12si12965445pjb.26.2019.09.02.14.22.13; Mon, 02 Sep 2019 14:22:28 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727717AbfIBVUL (ORCPT + 99 others); Mon, 2 Sep 2019 17:20:11 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:34608 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727318AbfIBVUK (ORCPT ); Mon, 2 Sep 2019 17:20:10 -0400 Received: by mail-oi1-f196.google.com with SMTP id g128so11281214oib.1; Mon, 02 Sep 2019 14:20:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+lpVdJyYQZ7LkgNkMVrzaDCTE1l3PZ7/Lcu/MbmwZUI=; b=n1gbMIZvQhdc8KkN89ingFIug7M/vLOSmZLTZtW8bj/LNfCwIrXmTOYWIxux+HwjpO jYAAF5JXwMo4heOWckHITtHHgvCm0joaxBMraHd44X4pMzMn8Hd7SlFfpvm6mYzSbrhD W0BWdBXoGGNJhzZ9oxsihO3Pc8bKxo7S8WdSaJWRFIJ9HHrmWDx16KC76Aqzc1oWzeXs kKl63VXDcdq+nZL1uA6LVqK2SMYC3euzX6ZVOcE50TcbGgZdT5XaleCvoR0uLvfsDNkI 9i0QUQ4t3ZkxS/ijjhCgUBEBPMx4KVOcYwRj/ljvQYsTjPF6Ud0U23lrw+HTYQTzaIpc ZyBA== X-Gm-Message-State: APjAAAWeWPHThHj0TFdMIky4boNfLrLdFC2GVoaSjEJNzL+ynn7DLQj6 YJKkSdeChZWmGvrVaDu+Ks1CZ9LyZ5zFzuyBRDQ= X-Received: by 2002:aca:b808:: with SMTP id i8mr19471537oif.68.1567459209611; Mon, 02 Sep 2019 14:20:09 -0700 (PDT) MIME-Version: 1.0 References: <1566359059-4844-1-git-send-email-wenwen@cs.uga.edu> In-Reply-To: <1566359059-4844-1-git-send-email-wenwen@cs.uga.edu> From: "Rafael J. Wysocki" Date: Mon, 2 Sep 2019 23:19:58 +0200 Message-ID: Subject: Re: [PATCH v2] ACPI / PCI: fix acpi_pci_irq_enable() memory leak To: Wenwen Wang , Bjorn Helgaas Cc: "Rafael J. Wysocki" , Len Brown , "open list:PCI SUBSYSTEM" , "open list:ACPI" , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 21, 2019 at 5:44 AM Wenwen Wang wrote: > > In acpi_pci_irq_enable(), 'entry' is allocated by kzalloc() in > acpi_pci_irq_check_entry() (invoked from 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. > > Fixes: e237a5518425 ("x86/ACPI/PCI: Recognize that Interrupt Line 255 means > "not connected"") > > Signed-off-by: Wenwen Wang Bjorn, any more comments? > --- > 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; > + } > > if (acpi_isa_register_gsi(dev)) > dev_warn(&dev->dev, "PCI INT %c: no GSI\n", > -- > 2.7.4 >