Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp452687ybl; Thu, 15 Aug 2019 21:34:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5u/G/CyOFrRcYNdeBswG4e3BmIOIiQIgBZ6FHr45LAnxxAkVA6Afpjt7ziQ3V+0A/SvW8 X-Received: by 2002:a65:621a:: with SMTP id d26mr6162876pgv.153.1565930063834; Thu, 15 Aug 2019 21:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565930063; cv=none; d=google.com; s=arc-20160816; b=DqDHkJUJbU9puXWa5CvGFm6b7FUX8M/M8OLPvID4rmQnnf+pHlB2e95JfB9T1NkGTz 9jqkS52lIeXG2W43oAyLcZ4mq7pQQVK67Bm/Omj8PrQLqT59Mnl5t2ndkwuxavZLTqPp 8BFRG7PVqhBcua0gfMWTUEKDH/Hdked8mWxlrZQeYim8GEcO0F+awGRDpezOxr/PFqCi XjDy6fOE+kKXU+xeN0JIZImmA1kuKTN9B2/AbCqk24UVXKQaryta35iQl6xeQARU8k2M a8/cwIWA0LfuYzy7LsFgBgEp6eePuffs+BBwe63v3KzfVZLxTdxDd7chylEhiSvlt8za 3cwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=+OcQru066Drv5pXc9VyqHlEO+MqaTlu7JFvqJcPm4qE=; b=eGO8/zbyz9wOhp6ShpE/pfrug8TmGR1/6chqK+Zegqkq5+GWNhBmKOse8juLa7EgAj xcDXoCJt5konir2M/Uzp1YiJ3bxcPmoSLLeL9TMNdfylklYlOSIUW8y7FkC6t78SYPUQ Ob/A2zJAqUN1EieVS+tgBUBJ/LYj4risHchraC/AOJlL7/FG/zVpVYD8Eh/+0kuwMecF 4WvIDXLb2EtnZukunl9VL2aE1mI5obPI0CimsPZwqzzuPBlNoJSMMRoF8DItXy5CZzHU DSS36uMGdIU8X+YZQ+3mh0Pz1uQcSxwzBsRER977unaAQVeZS5UZw+aXKO0D/aLBEXkQ tRBQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g3si2247659pjs.21.2019.08.15.21.34.05; Thu, 15 Aug 2019 21:34:23 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726166AbfHPEd2 (ORCPT + 99 others); Fri, 16 Aug 2019 00:33:28 -0400 Received: from mail-yb1-f194.google.com ([209.85.219.194]:35389 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725897AbfHPEd2 (ORCPT ); Fri, 16 Aug 2019 00:33:28 -0400 Received: by mail-yb1-f194.google.com with SMTP id c9so1571789ybq.2; Thu, 15 Aug 2019 21:33:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+OcQru066Drv5pXc9VyqHlEO+MqaTlu7JFvqJcPm4qE=; b=b5dGDIWwLnSWLqM6ejb103JzIptXSxmVuqBYi33hr+eoyPLI3iGa9qTI87D+2Jc6zO Qa96vhLk3Z67HT3PGONjCz9s0sAfSQeEMswWg14Pm8gdxAY2Yf3xlXBb06mEGiMeYebl wVTxasEQff8X2ngS4HtmOh+zKQulCLE5dz3bhnBPEeCARoB2NCFMoseHwiJ/d2LVlEPn ONa0GuqV7Xj92i1NtPkcQwe8apTRB1CT/CqfGGoTDVJ9TbeNe24Y2VX3bY3Ux5y9OLnk AHkV4r+2ruHTbjY1nrwWG3ffuNGQdss72X/WHfeMRBW4at9uZOMePKrvdan1PLKk1DUt m4Fg== X-Gm-Message-State: APjAAAWX4sI/uvwxqU6yAmC/V/8bu9laNvVoK82KnsqerSXRJiw5ovts YnsvhoH/sf09Ylhb+J1VoxI= X-Received: by 2002:a25:208b:: with SMTP id g133mr6034984ybg.304.1565930007532; Thu, 15 Aug 2019 21:33:27 -0700 (PDT) Received: from localhost.localdomain (24-158-240-219.dhcp.smyr.ga.charter.com. [24.158.240.219]) by smtp.gmail.com with ESMTPSA id b64sm1024042ywe.43.2019.08.15.21.33.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Aug 2019 21:33:26 -0700 (PDT) From: Wenwen Wang To: Wenwen Wang Cc: Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), linux-acpi@vger.kernel.org (open list:ACPI), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] ACPI / PCI: fix a memory leak bug Date: Thu, 15 Aug 2019 23:33:22 -0500 Message-Id: <1565930002-5524-1-git-send-email-wenwen@cs.uga.edu> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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; + } if (acpi_isa_register_gsi(dev)) dev_warn(&dev->dev, "PCI INT %c: no GSI\n", -- 2.7.4