Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp318510ybl; Tue, 20 Aug 2019 20:52:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyBr2+ambaH3O0mwE4iTErqScOXVR2d94a0T0CCfeGQS5I/UATKfzqCvWTfSypp54EZGfL X-Received: by 2002:a17:90a:b908:: with SMTP id p8mr3262504pjr.65.1566359576264; Tue, 20 Aug 2019 20:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566359576; cv=none; d=google.com; s=arc-20160816; b=sTxjOSIQ4EysCzsjRS/z4QuE6+I3ieyadFo1/iWPa5DXRqJXeIPYh8NESmCz8JLmoU NiButh3gCKVKdqngAMgkgREtH4TQXQTLlUYL2Mit/M3ISXbSIeYa+SiuBsqnINuCfioj udaCAMylo6z/qusFDyDaI283HPZM7gkV8/Bqs6HwOAYK1ud227MWvHixVhqqRm8nIfEj 7K7HCslfIEpgFZeuKLvhaSXJk0iJLWvheXrR78xKIzEKKQq7TDJSqthr03IltzLF8C+L M+pN90DrIE+tjuCvxLUTAHPfAaZEXCVTz9DPkebIOpeVPQSDhBEK1s3cCFfOOGVGCBve eNmA== 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=YcggR1HawStyBJ3k10IaNabkt2WXu5RxAJT3QmaxLtw=; b=HpGkt2knugRBoL2i5JyN9vBFw6FseRAYXrHpX39VI/u6wUbe8Cte3cijnF0SVpCpCy sg4wcMIoBK2RIxiylCVauBDtSbrCzO1GVSEbha8GKkUGvN9HSxn16pxcJOXHzoWsoi1S spjkaG3hARtbpxL7gSW5ANB8RjD3Kx4Lma2axF2AR7TpdVVqDkqSUkySys/AzcfqRMIa rnfxfSAICIFkch+CRuq3/cNYIx8FcemGLc9aw3oKEKpPeRRX+h9jpfW5Thp5RgJQtkan fTnI5w5jpwt2R1IUuLOJNBYIZ0agAconZrQjoNLxdYpcTIkl4kGcAjDpAlxhIjSycqu6 hZ3w== 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 j23si13379586pgh.535.2019.08.20.20.52.40; Tue, 20 Aug 2019 20:52:56 -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 S1727394AbfHUDo1 (ORCPT + 99 others); Tue, 20 Aug 2019 23:44:27 -0400 Received: from mail-yb1-f195.google.com ([209.85.219.195]:42809 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726463AbfHUDo0 (ORCPT ); Tue, 20 Aug 2019 23:44:26 -0400 Received: by mail-yb1-f195.google.com with SMTP id h8so449588ybq.9; Tue, 20 Aug 2019 20:44:26 -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=YcggR1HawStyBJ3k10IaNabkt2WXu5RxAJT3QmaxLtw=; b=m+FIr9uSKbH7TJMP0Ahdc94aI/pr99eGNU/kAzDAh3MaNrzNOSjlxvzpVn/OD4oYo9 30CgE+tg7iQR8wpq2gXKpSPiquntA3zhWCInmr2+VmkvEhQ1EPddJZwb5XzY++l7lSCK 9SZ3kXmyo8j5dWUGmKz1vnQ2Q3XtA9ZrNW9t7KvpigmIN+qkS3EiWT9CaKQgVIFEvMXq yKWtUHLdZMB0x7KHUYm5DSGOCdg+99V5JLnE83AjeuU6YshOqYt4T7uE8If7o/HZT3g5 CCjjAk+6Gr2iQET1ri5jFUIYRauRglzfdTaJd2mzfa60ITU5dyp5oZuOJyMuys4fiAuP LOMg== X-Gm-Message-State: APjAAAXQu5R41qYXKFrKgv8zbfJbSFGUTuFaZhb+jV/iUxhlZ95lLsMn oYIMsCsv7WcULCZVGzvbrB8= X-Received: by 2002:a25:dc87:: with SMTP id y129mr13167422ybe.424.1566359065921; Tue, 20 Aug 2019 20:44:25 -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 q65sm4017227ywc.11.2019.08.20.20.44.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Aug 2019 20:44:25 -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 v2] ACPI / PCI: fix acpi_pci_irq_enable() memory leak Date: Tue, 20 Aug 2019 22:44:19 -0500 Message-Id: <1566359059-4844-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 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 --- 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