Received: by 10.223.185.116 with SMTP id b49csp5179071wrg; Tue, 27 Feb 2018 09:01:18 -0800 (PST) X-Google-Smtp-Source: AH8x227k/Z6yW1iNEcvX627TTMNWKOS4cDCTn9XgtGLkuQ0PUDIvbvt3233WGM9RyXYQ/v36BGgh X-Received: by 10.101.97.207 with SMTP id j15mr11658246pgv.266.1519750878384; Tue, 27 Feb 2018 09:01:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519750878; cv=none; d=google.com; s=arc-20160816; b=nZgUdmET5Yr0k94GboF/hG7z5nHxIDGIU5A1/HSD9IIh+vV+ybKMLb3PDxy3lSdFnJ pYPZp5eEsGhRlHAMvxs7+Wls497C+ajU518FdMoWlwC0DA3YxjBpUl/X6qKyCN0pq2Ea 5UVjYVSc5I12rwKFBMPrgkINmc6sr7heKKYlOMPknkWR2XSZrcuj0vAVLhoRlEC9W/2G JKw3CxmEyxappPXfWbu2im0NqlaM03nXU+Y6Oy2SSYC2LCAGRP+rTSGWwUAPWdOcy5cG WO1IGKphefRxYiN61MPTy7Glr+Y24oMYwWh2lJPwDft0OsRBlNej8hN8vX/Fr67xiFa3 qw6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=1vEiT9mkI1478jvuUbC5vfmoD2scKXoqpTuXB+71qUc=; b=AP6UJZcvRa9mMe+ITUrF8re3ZXgMs8Ubp1nT7TSbPpuhoUw8jeTrj0KORe62Ms+OuY FeKOZsAYmhJkkSReTX/Thsp/gW0JwhaPNqdVJZF/UVFvPsEzgom/MHNPAynCWut8YxZl dgVeNf6dpGPjq+BSQdIxyc4TnIB2nG+DE9Rc1C5yJnCNxkGhr4z4nLyXkHGTf9kJqe28 R0Ak/puvXCLIuT0/S/riVmdyqgRtraE/LmoI7LeW5N35HorWKnNmLI4HAmQEq3Pb2epf MxBHsuciCFHe722fXHxkqcvhWHBdLBaHqDdkvqqDR1QO5L0ofzmQXTnabTCl0iQQKtHD +XvQ== 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 w10si7195106pgr.136.2018.02.27.09.01.00; Tue, 27 Feb 2018 09:01:18 -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 S1752065AbeB0Q7s (ORCPT + 99 others); Tue, 27 Feb 2018 11:59:48 -0500 Received: from smtp.eu.citrix.com ([185.25.65.24]:51722 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752036AbeB0Q7r (ORCPT ); Tue, 27 Feb 2018 11:59:47 -0500 X-IronPort-AV: E=Sophos;i="5.47,401,1515456000"; d="scan'208";a="68706682" Date: Tue, 27 Feb 2018 16:58:10 +0000 From: Roger Pau =?iso-8859-1?Q?Monn=E9?= To: Amit Shah CC: , , , Boris Ostrovsky , Eduardo Valentin , Juergen Gross , Thomas Gleixner , "K. Y. Srinivasan" , Liu Shuo , Anoob Soman Subject: Re: [PATCH v2 1/2] xen: fix out-of-bounds irq unbind for MSI message groups Message-ID: <20180227165607.wrqp5tb7fmhqglea@MacBook-Pro-de-Roger.local> References: <1519746958-52077-1-git-send-email-aams@amazon.com> <1519746958-52077-2-git-send-email-aams@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1519746958-52077-2-git-send-email-aams@amazon.com> User-Agent: NeoMutt/20171215 X-ClientProxiedBy: AMSPEX02CAS01.citrite.net (10.69.22.112) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 27, 2018 at 03:55:57PM +0000, Amit Shah wrote: > When an MSI descriptor was not available, the error path would try to > unbind an irq that was never acquired - potentially unbinding an > unrelated irq. Those IRQs have been allocated in the xen_allocate_irqs_dynamic call, so I think the "potentially unbinding an unrelated irq" part is wrong. The unbind call would be performed against an unbound IRQ, which is harmless AFAICT. > Fixes: 4892c9b4ada9f9 ("xen: add support for MSI message groups") > Reported-by: Hooman Mirhadi > CC: > CC: Roger Pau Monn? > CC: Boris Ostrovsky > CC: Eduardo Valentin > CC: Juergen Gross > CC: Thomas Gleixner > CC: "K. Y. Srinivasan" > CC: Liu Shuo > CC: Anoob Soman > Signed-off-by: Amit Shah > --- > drivers/xen/events/events_base.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c > index 1ab4bd1..c86d10e 100644 > --- a/drivers/xen/events/events_base.c > +++ b/drivers/xen/events/events_base.c > @@ -755,8 +755,10 @@ int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc, > mutex_unlock(&irq_mapping_update_lock); > return irq; > error_irq: > - for (; i >= 0; i--) > + while (i > 0) { while (i--) __unbind_from_irq(irq + i); Although please see reply to patch 2. Roger.