Received: by 10.223.185.116 with SMTP id b49csp1796453wrg; Sat, 17 Feb 2018 05:34:51 -0800 (PST) X-Google-Smtp-Source: AH8x2274IdEihjvyga2BzwwaEdzFQ8JrGRsPdadabgyHUBT1k1VpbgFkV03IRh986bCQ16bpnKmj X-Received: by 2002:a17:902:6d01:: with SMTP id s1-v6mr9010663plk.176.1518874491303; Sat, 17 Feb 2018 05:34:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518874491; cv=none; d=google.com; s=arc-20160816; b=ueJYhwKty5SUBabMfKeQgWX2cay/xMdMCUK1KwRhlxV4rCFTs8N4QfOKYfcQXXo06C u6+MI2BJaKDHIq/srp9mYUzKwW7LxOpQzY4z15Hw4+OrJxhhmH2IjZFOFJtek0L4h9/e aqmAX6lmzWs79KNc0EBJK4gZn1p47aLvQ7Bl4zQFKec8e3hi9cyMUiEtR1ijKD0IjsUy VfHct+iqj9BHzWm948p2xwYNDL4SUJE01zmdt2lvIbuU2NmS49hd0JD8GEKJTj1+ZD3J HH/fnyCAkMbEQD1Yu7gztZuvArhB5pzepXE4lvleAwMp6EOy8TxDPBybpwe3x0BnHj+h zzzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=wwNPhkeCGY9RTKIpB4l1Is6U9JVAjxAgCWbok/kwuuk=; b=ZmOMegAHDiKmkX4F17Wn73EU+saAmhzvs5yiuPgS2NZ6FLSDi+awnHtedGOtueLkJ3 1qCXiyLA1rtro3/tMW51fDC1lfxTpnvFKJGTeJysNbPQhSQyHuBYkG3Lekiv1kwcPRUm s6q2cC8FToQcl3PlWrzoNm0hR50nSXMO5L4bEA6PL59H2qXPD+9K6oYf3m6Ts4Mi3WN+ vLjt1QfJlzwkH3mBlps67eoEKuFAvt0QuioQU3++5TF+9TK669VQ0UhMUgz7hvyPTUbR fkYkQkH/zkMLMS4td6DmMekUq+imUODD4YXuZtrwpWqk5j0M6qol8pBNCHIE41pQay/f Mj7g== 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 x81si2247667pgx.402.2018.02.17.05.34.37; Sat, 17 Feb 2018 05:34:51 -0800 (PST) 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 S1751156AbeBQNeD (ORCPT + 99 others); Sat, 17 Feb 2018 08:34:03 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:57819 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750977AbeBQNeB (ORCPT ); Sat, 17 Feb 2018 08:34:01 -0500 Received: from [37.82.182.103] by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1en2Za-0008Kv-3L; Sat, 17 Feb 2018 14:30:38 +0100 Date: Sat, 17 Feb 2018 14:34:06 +0100 (CET) From: Thomas Gleixner To: Ben Hutchings cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Keith Busch Subject: Re: [PATCH 4.4 33/53] x86/apic/vector: Fix off by one in error path In-Reply-To: <1518814661.3422.42.camel@codethink.co.uk> Message-ID: References: <20180122083910.299610926@linuxfoundation.org> <20180122083911.776154720@linuxfoundation.org> <1518814661.3422.42.camel@codethink.co.uk> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-110430160-1518874447=:2087" X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-110430160-1518874447=:2087 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Fri, 16 Feb 2018, Ben Hutchings wrote: > On Mon, 2018-01-22 at 09:40 +0100, Greg Kroah-Hartman wrote: > > 4.4-stable review patch.  If anyone has any objections, please let me know. > > > > ------------------ > > > > From: Thomas Gleixner > > > > commit 45d55e7bac4028af93f5fa324e69958a0b868e96 upstream. > > > > Keith reported the following warning: > > > > WARNING: CPU: 28 PID: 1420 at kernel/irq/matrix.c:222 irq_matrix_remove_managed+0x10f/0x120 > >   x86_vector_free_irqs+0xa1/0x180 > >   x86_vector_alloc_irqs+0x1e4/0x3a0 > >   msi_domain_alloc+0x62/0x130 > > > > The reason for this is that if the vector allocation fails the error > > handling code tries to free the failed vector as well, which causes the > > above imbalance warning to trigger. > > > > Adjust the error path to handle this correctly. > > > > Fixes: b5dc8e6c21e7 ("x86/irq: Use hierarchical irqdomain to manage CPU interrupt vectors") > > Reported-by: Keith Busch > > Signed-off-by: Thomas Gleixner > > Tested-by: Keith Busch > > Cc: stable@vger.kernel.org > > Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1801161217300.1823@nanos > > > Signed-off-by: Greg Kroah-Hartman > > > > --- > >  arch/x86/kernel/apic/vector.c |    7 +++++-- > >  1 file changed, 5 insertions(+), 2 deletions(-) > > > > --- a/arch/x86/kernel/apic/vector.c > > +++ b/arch/x86/kernel/apic/vector.c > > @@ -359,14 +359,17 @@ static int x86_vector_alloc_irqs(struct > >   irq_data->chip_data = data; > >   irq_data->hwirq = virq + i; > >   err = assign_irq_vector_policy(virq + i, node, data, info); > > - if (err) > > + if (err) { > > + irq_data->chip_data = NULL; > > + free_apic_chip_data(data); > >   goto error; > > This doesn't look quite right for 4.4.y (or any stable branch before > 4.15.y). When virq is a legacy IRQ this function doesn't allocate > "data" and shouldn't free it. Bah. I'm a moron. Lemme look at that. --8323329-110430160-1518874447=:2087--