Received: by 10.223.185.116 with SMTP id b49csp6281888wrg; Wed, 28 Feb 2018 06:57:49 -0800 (PST) X-Google-Smtp-Source: AH8x226uacJbIag17jwqopVC/bqlUIiLjx2WKRJ07sQG/k6HjGuijunNtq4vCOyCuaLMR8hpg1vu X-Received: by 10.98.102.155 with SMTP id s27mr18122198pfj.198.1519829869833; Wed, 28 Feb 2018 06:57:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519829869; cv=none; d=google.com; s=arc-20160816; b=bFihYmSSu9H6mFuziffDka5q5biaymKFwJvkplMplLQoNnD5jyScGOS4duO1TarEhQ yjHZ/MEDuJU1bkpAJfwmGKiCWnoVxT/rWZVPXWuj31fzPve+kelLFQMsc+TbeX5bUqq2 Ip/yphxTq8hysV7AEp+2Fa7FWq8vszju0f15KkWj0KQRLHXfIyM6FAt+Nj0350/StmEA TOxs/BpIzrnfiWC9JlQq3jy+pd1WSwQTucJwu5Zp1rJRBVvC4mYld+u2SVlAz4qUU0yN z4ziHhAclQa0oiS71IDNouU/z1ZZiZ5Q/hZ+82gnLP598a6o0rSSQlXq7RHmdgHzfptr Dr8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=q3I7Rx8jjdcFuECnOWDFL7qb6kS4B68TpL8JvG04CwE=; b=dkGPeFFItUcj0OHIGAYT//8ebjugGXFmUkG/mmTcehhXh/GisZm2TbB2bEfzkDAZ8B YyWHW3FP3dcF/eCG8kiUNtU8TEPdpfBNf0YwJ99ipJ+4MdL60E4+hSWxPA7p+28r6T4J BAvk4lvuSTyZb5x+3AlJXqa2AYzar1Dg0H3b2BVJbXs3La3of2ATf9UfiiNM1mfV3/yI 4CiONru1Gso5o9y2tza1rtEK6eAyoYe7w3YLpq1sp2X2aGsXAh4FLN8Q76lrtLaQJb8S WHhwfUEg4OCB3qaObCTHViY1hfqj8qoxS1kYVfTHvySwcD6O0i5E3Mdxi1piESjXS+lq wiwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=rfPeS7eW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m4si1089767pgc.351.2018.02.28.06.57.35; Wed, 28 Feb 2018 06:57:49 -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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=rfPeS7eW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752793AbeB1O4W (ORCPT + 99 others); Wed, 28 Feb 2018 09:56:22 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:40916 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752436AbeB1O4U (ORCPT ); Wed, 28 Feb 2018 09:56:20 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1SEq6DQ006822; Wed, 28 Feb 2018 14:56:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=q3I7Rx8jjdcFuECnOWDFL7qb6kS4B68TpL8JvG04CwE=; b=rfPeS7eWnrP0nVw4wQbEwY+AWBCsF4+clRUlELBfVMiUjsiVCjFTsSW738DhfFyEMmVY HI3u9RLXXIdFA0r+eE2QYK2UL3z/tNcKpAvKxKbtTISIENX+iMsKGB3YRicmgwtcXr1h GmThZ1gxDO97r3aCfdPDqJr+hbXqQ2lNrDw43XYFbqXVKGHmQ0uAXdKFQ/XxoYMas7Hj z2MVhHmqgjG+lSfly6aQpg0fHY4NCoPEvkxhLoPxoSSr41d5olBikIxIdlKJf/5WBQXq mZyr10sksQq/OCKNwt6jZc2XyTVVQD30UM8V5GagfNgGEAEdJEbC8sG4kKGWbu14o8f9 Uw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2gdvx90nby-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Feb 2018 14:56:13 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w1SEuDeG021083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Feb 2018 14:56:13 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w1SEuDgm025548; Wed, 28 Feb 2018 14:56:13 GMT Received: from dhcp-burlington7-2nd-B-east-10-152-55-162.usdhcp.oraclecorp.com (/10.152.32.65) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 28 Feb 2018 06:56:12 -0800 Subject: Re: [PATCH] xen/pirq: fix error path cleanup when binding MSIs To: "Shah, Amit" , "linux-kernel@vger.kernel.org" , "roger.pau@citrix.com" Cc: "jgross@suse.com" , "stable@vger.kernel.org" , "xen-devel@lists.xenproject.org" References: <20180228091903.99889-1-roger.pau@citrix.com> <1519809769.4965.26.camel@amazon.com> From: Boris Ostrovsky Message-ID: Date: Wed, 28 Feb 2018 09:57:36 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1519809769.4965.26.camel@amazon.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8817 signatures=668681 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802280181 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/28/2018 04:22 AM, Shah, Amit wrote: > On Mi, 2018-02-28 at 09:19 +0000, Roger Pau Monne wrote: >> Current cleanup in the error path of xen_bind_pirq_msi_to_irq is >> wrong. First of all there's an off-by-one in the cleanup loop, which >> can lead to unbinding wrong IRQs. >> >> Secondly IRQs not bound won't be freed, thus leaking IRQ numbers. >> >> Note that there's no need to differentiate between bound and unbound >> IRQs when freeing them, __unbind_from_irq will deal with both of them >> correctly. >> >> Fixes: 4892c9b4ada9f9 ("xen: add support for MSI message groups") >> Reported-by: Hooman Mirhadi >> Signed-off-by: Roger Pau Monné >> --- >> Cc: Boris Ostrovsky >> Cc: Juergen Gross >> Cc: Amit Shah >> CC: stable@vger.kernel.org >> Cc: xen-devel@lists.xenproject.org >> --- >>  drivers/xen/events/events_base.c | 4 ++-- >>  1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/xen/events/events_base.c >> b/drivers/xen/events/events_base.c >> index b241bfa529ce..159faf1269fb 100644 >> --- a/drivers/xen/events/events_base.c >> +++ b/drivers/xen/events/events_base.c >> @@ -763,8 +763,8 @@ 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--) >> - __unbind_from_irq(irq + i); >> + while (nvec--) >> + __unbind_from_irq(irq + nvec); >>   mutex_unlock(&irq_mapping_update_lock); >>   return ret; >>  } > Reviewed-by: Amit Shah Reviewed-by: Boris Ostrovsky