Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1207030pxy; Fri, 23 Apr 2021 02:55:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVZSA4KrRqPrGojyCtuS346BNUfVNMl9ByBmM0rBjrMlF0MGOSHV1St/kQ68rLhNwCT2zS X-Received: by 2002:a17:90a:f2d7:: with SMTP id gt23mr4763842pjb.199.1619171736542; Fri, 23 Apr 2021 02:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619171736; cv=none; d=google.com; s=arc-20160816; b=W+Y3zi1eszraPlVyb1FZjxvCUoBh/biaZ9EvoRS/inMEUg+rcQoZPDthHNt2ppHNMQ 4oJaDr7wOOahIRQt+uD7Ri2/PmhoMq/7XauogjZFjtS4rkzbd1+ZrE8vHXeMd7tvV2/e MixPLx50MtXd3yH2BxSf25uAmD+ZsVhvvubrsKe1+E8xx6cVvYlfnuuFtzBpoZNTMNj9 +rrLUi1BEGiaOQbWjoKL8A/RUAssozjIYYhWr4yMi3V5zMqUv8G9Rj7JfAmWtKmsU/qd hTzyW7GbvlPcvk+gApsDgZnR1Wf8WofL8aGORICkDUmdwND0Q5Uo0RIxQVw5WpRUcNk/ h+Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=/EUkRnGmsqhgrQyxHLAHubhiYlG1lft/auMlvDrVMo0=; b=GO6F2td3QtkPZz+edi+WbB8KVuUuoFXhHfC6vyb5e+1ZfPK69FpTX2KED1sLQ6nJMK hnnZ5eCA4Vr3mHjdugwMPDh0+OqDzbepNNIsQx7g649FeBSGdiDwmSdmghQ57m9k8axo 9cT3xdyUlXclYN/yjO87Dr/cOBXh6P/4JJ3tMOBv4AbVrMmBC8fMj9Wew2asXqThijT7 QtJ60P3Cg0D967dKgw+I20+bv0VClGM4XrowW/WH3x/Cu7cLjWA90gnUU+1rFvKNH7+r q41kFwbn7ZGPBLUnFOUfe6zdRXRC/xaom/0SQYnKRQaVy+SV8ygYeVTWacfoWjX57b4u fguw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SWl30oiE; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i6si6235059pgn.163.2021.04.23.02.55.24; Fri, 23 Apr 2021 02:55:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SWl30oiE; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbhDWJyR (ORCPT + 99 others); Fri, 23 Apr 2021 05:54:17 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:44928 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbhDWJyL (ORCPT ); Fri, 23 Apr 2021 05:54:11 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1619171611; 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: in-reply-to:in-reply-to:references:references; bh=/EUkRnGmsqhgrQyxHLAHubhiYlG1lft/auMlvDrVMo0=; b=SWl30oiEoreeJO/d+ubxk+HpPskgtn2goqqUYabC614+fscJyKpptKik3cwl4Up8fp3t9P ksLq1d4Qzn3bql9vrG7JLO606HR5nZ4yeV10Ysm+aIReNlNbTsR8nSjgfbF7RiEdxAq32S nhi2sZSU3du7wsYiRTdO6aRladMzZBdmIGl0RqY9pL/0PblFLuaI9nS5UASS/jCb7x/DQF grRmZvaEY6eExaX0K8Lhhhca7/SOJQXasrjTgcXExF2lQHcByRm0EPMBXdK/GnZ9t5dwcu rgCuc5jbWrH5Lr9+MX5BC10uNIOjZTU5NJvjoWsDhvfNNwoofQSwd9u67syNaA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1619171611; 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: in-reply-to:in-reply-to:references:references; bh=/EUkRnGmsqhgrQyxHLAHubhiYlG1lft/auMlvDrVMo0=; b=pJ9C+xxyFa5R1JF5w9VH0Tus/w+W4S4gpIjTvWKWQJyB/6uDGgBmq0X9hawLjcCi7ruoQZ vDYk0nPMCM6NgUBw== To: Bjorn Helgaas , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Wenwen Wang , Bjorn Helgaas , Ingo Molnar Subject: Re: [PATCH 086/190] Revert "x86/PCI: Fix PCI IRQ routing table memory leak" In-Reply-To: <20210422050919.GA2913711@bjorn-Precision-5520> References: <20210422050919.GA2913711@bjorn-Precision-5520> Date: Fri, 23 Apr 2021 11:53:31 +0200 Message-ID: <87a6ppwcmc.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 22 2021 at 00:09, Bjorn Helgaas wrote: > On Wed, Apr 21, 2021 at 02:59:21PM +0200, Greg Kroah-Hartman wrote: > I would prefer that you not apply this revert. > > Prior to ea094d53580f ("x86/PCI: Fix PCI IRQ routing table memory > leak"), we had essentially this: > > pcibios_irq_init() > pirq_table = pcibios_get_irq_routing_table(); # kmallocs > if (pirq_table) { > if (io_apic_assign_pci_irqs) > pirq_table = NULL; > } > > So if we called pcibios_get_irq_routing_table(), we kmalloced some > space and then (if io_apic_assign_pci_irqs) threw away the pointer, > which leaks the pointer as the commit log says. > > After ea094d53580f, we have: > > pcibios_irq_init() > rtable = NULL; > pirq_table = pcibios_get_irq_routing_table(); # kmallocs > rtable = pirq_table; > if (pirq_table) { > if (io_apic_assign_pci_irqs) { > kfree(rtable); > pirq_table = NULL; > } > } > > which seems right to me. It is correct. Though looking at it again, the question is why this invokes pcibios_get_irq_routing_table() at all if io_apic_assign_pci_irqs is true? Thanks, tglx