All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Amit Shah <aams@amazon.com>
Cc: <xen-devel@lists.xenproject.org>, <linux-kernel@vger.kernel.org>,
	<stable@vger.kernel.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Eduardo Valentin <eduval@amazon.com>,
	Juergen Gross <jgross@suse.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Liu Shuo <shuo.a.liu@intel.com>,
	Anoob Soman <anoob.soman@citrix.com>
Subject: Re: [PATCH v2 1/2] xen: fix out-of-bounds irq unbind for MSI message groups
Date: Tue, 27 Feb 2018 16:58:10 +0000	[thread overview]
Message-ID: <20180227165607.wrqp5tb7fmhqglea@MacBook-Pro-de-Roger.local> (raw)
In-Reply-To: <1519746958-52077-2-git-send-email-aams@amazon.com>

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 <mirhadih@amazon.com>
> CC: <stable@vger.kernel.org>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> CC: Eduardo Valentin <eduval@amazon.com>
> CC: Juergen Gross <jgross@suse.com>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: "K. Y. Srinivasan" <kys@microsoft.com>
> CC: Liu Shuo <shuo.a.liu@intel.com>
> CC: Anoob Soman <anoob.soman@citrix.com>
> Signed-off-by: Amit Shah <aams@amazon.com>
> ---
>  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.

WARNING: multiple messages have this Message-ID (diff)
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Amit Shah <aams@amazon.com>
Cc: <xen-devel@lists.xenproject.org>, <linux-kernel@vger.kernel.org>,
	<stable@vger.kernel.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Eduardo Valentin <eduval@amazon.com>,
	Juergen Gross <jgross@suse.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Liu Shuo <shuo.a.liu@intel.com>,
	Anoob Soman <anoob.soman@citrix.com>
Subject: Re: [PATCH v2 1/2] xen: fix out-of-bounds irq unbind for MSI message groups
Date: Tue, 27 Feb 2018 16:58:10 +0000	[thread overview]
Message-ID: <20180227165607.wrqp5tb7fmhqglea@MacBook-Pro-de-Roger.local> (raw)
In-Reply-To: <1519746958-52077-2-git-send-email-aams@amazon.com>

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 <mirhadih@amazon.com>
> CC: <stable@vger.kernel.org>
> CC: Roger Pau Monn� <roger.pau@citrix.com>
> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> CC: Eduardo Valentin <eduval@amazon.com>
> CC: Juergen Gross <jgross@suse.com>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: "K. Y. Srinivasan" <kys@microsoft.com>
> CC: Liu Shuo <shuo.a.liu@intel.com>
> CC: Anoob Soman <anoob.soman@citrix.com>
> Signed-off-by: Amit Shah <aams@amazon.com>
> ---
>  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.

  parent reply	other threads:[~2018-02-27 16:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 15:55 [PATCH v2 0/2] xen: fix bugs in error conditions Amit Shah
2018-02-27 15:55 ` [PATCH v2 1/2] xen: fix out-of-bounds irq unbind for MSI message groups Amit Shah
2018-02-27 16:58   ` Roger Pau Monné
2018-02-27 16:58   ` Roger Pau Monné [this message]
2018-02-27 16:58     ` Roger Pau Monné
2018-02-27 15:55 ` Amit Shah
2018-02-27 15:55 ` [PATCH v2 2/2] xen: events: free irqs in error condition Amit Shah
2018-02-27 17:07   ` Roger Pau Monné
2018-02-27 17:07   ` Roger Pau Monné
2018-02-27 17:07     ` Roger Pau Monné
2018-02-27 17:32     ` Shah, Amit
2018-02-27 17:32     ` Shah, Amit
2018-02-28  8:16       ` Roger Pau Monné
2018-02-28  8:16         ` Roger Pau Monné
2018-02-28  8:25         ` Shah, Amit
2018-02-28  8:25         ` Shah, Amit
2018-02-28  8:27           ` Juergen Gross
2018-02-28  8:27           ` Juergen Gross
2018-02-28  8:16       ` Roger Pau Monné
2018-02-27 15:55 ` Amit Shah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180227165607.wrqp5tb7fmhqglea@MacBook-Pro-de-Roger.local \
    --to=roger.pau@citrix.com \
    --cc=aams@amazon.com \
    --cc=anoob.soman@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=eduval@amazon.com \
    --cc=jgross@suse.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shuo.a.liu@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.