All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ahci: fix nvec check
@ 2016-10-20 15:15 Christoph Hellwig
  2016-10-20 15:32 ` Colin Ian King
  2016-10-20 17:41 ` Tejun Heo
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2016-10-20 15:15 UTC (permalink / raw)
  To: tj; +Cc: colin.king, linux-ide

commit 17a51f12 ("ahci: only try to use multi-MSI mode if there is more
than 1 port") lead to a case where nvec isn't initialized before it's
used.  Fix this by moving the check into the n_ports conditional.

Reported-by Colin Ian King <colin.king@canonical.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/ata/ahci.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index ed311a0..60e42e2 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1436,14 +1436,14 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
 				"ahci: MRSM is on, fallback to single MSI\n");
 			pci_free_irq_vectors(pdev);
 		}
-	}
 
-	/*
-	 * -ENOSPC indicated we don't have enough vectors.  Don't bother trying
-	 * a single vectors for any other error:
-	 */
-	if (nvec < 0 && nvec != -ENOSPC)
-		return nvec;
+		/*
+		 * -ENOSPC indicated we don't have enough vectors.  Don't bother
+		 * trying a single vectors for any other error:
+		 */
+		if (nvec < 0 && nvec != -ENOSPC)
+			return nvec;
+	}
 
 	/*
 	 * If the host is not capable of supporting per-port vectors, fall
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ahci: fix nvec check
  2016-10-20 15:15 [PATCH] ahci: fix nvec check Christoph Hellwig
@ 2016-10-20 15:32 ` Colin Ian King
  2016-10-20 17:41 ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2016-10-20 15:32 UTC (permalink / raw)
  To: Christoph Hellwig, tj; +Cc: linux-ide

On 20/10/16 16:15, Christoph Hellwig wrote:
> commit 17a51f12 ("ahci: only try to use multi-MSI mode if there is more
> than 1 port") lead to a case where nvec isn't initialized before it's
> used.  Fix this by moving the check into the n_ports conditional.
> 
> Reported-by Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/ata/ahci.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index ed311a0..60e42e2 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -1436,14 +1436,14 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
>  				"ahci: MRSM is on, fallback to single MSI\n");
>  			pci_free_irq_vectors(pdev);
>  		}
> -	}
>  
> -	/*
> -	 * -ENOSPC indicated we don't have enough vectors.  Don't bother trying
> -	 * a single vectors for any other error:
> -	 */
> -	if (nvec < 0 && nvec != -ENOSPC)
> -		return nvec;
> +		/*
> +		 * -ENOSPC indicated we don't have enough vectors.  Don't bother
> +		 * trying a single vectors for any other error:
> +		 */
> +		if (nvec < 0 && nvec != -ENOSPC)
> +			return nvec;
> +	}
>  
>  	/*
>  	 * If the host is not capable of supporting per-port vectors, fall
> 
That looks good to me. Thanks Christoph

Acked-by: Colin Ian King <colin.king@canonical.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ahci: fix nvec check
  2016-10-20 15:15 [PATCH] ahci: fix nvec check Christoph Hellwig
  2016-10-20 15:32 ` Colin Ian King
@ 2016-10-20 17:41 ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2016-10-20 17:41 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: colin.king, linux-ide

On Thu, Oct 20, 2016 at 05:15:41PM +0200, Christoph Hellwig wrote:
> commit 17a51f12 ("ahci: only try to use multi-MSI mode if there is more
> than 1 port") lead to a case where nvec isn't initialized before it's
> used.  Fix this by moving the check into the n_ports conditional.
> 
> Reported-by Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Applied to libata/for-4.9-fixes.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-20 17:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-20 15:15 [PATCH] ahci: fix nvec check Christoph Hellwig
2016-10-20 15:32 ` Colin Ian King
2016-10-20 17:41 ` Tejun Heo

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.