lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190531160956.GB9356@redmoon>
Date:   Fri, 31 May 2019 17:09:56 +0100
From:   Lorenzo Pieralisi <lorenzo.pieralisi@....com>
To:     Bharat Kumar Gogada <bharat.kumar.gogada@...inx.com>
Cc:     bhelgaas@...gle.com, linux-pci@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        rgummal@...inx.com, marc.zyngier@....com
Subject: Re: [PATCH v3] PCI: xilinx-nwl: Fix Multi MSI data programming

[+Marc]

On Wed, May 29, 2019 at 06:07:49PM +0530, Bharat Kumar Gogada wrote:
> The current Multi MSI data programming fails if multiple end points
> requesting MSI and multi MSI are connected with switch, i.e the current
> multi MSI data being given is not considering the number of vectors
> being requested in case of multi MSI.
> Ex: Two EP's connected via switch, EP1 requesting single MSI first,
> EP2 requesting Multi MSI of count four. The current code gives
> MSI data 0x0 to EP1 and 0x1 to EP2, but EP2 can modify lower two bits
> due to which EP2 also sends interrupt with MSI data 0x0 which results
> in always invoking virq of EP1 due to which EP2 MSI interrupt never
> gets handled.

If this is a problem it is not the only driver where it should be fixed
it seems. CC'ed Marc in case I have missed something in relation to MSI
IRQs but AFAIU it looks like HW is allowed to toggled bits (according to
bits[6:4] in Message Control for MSI) in the MSI data, given that the
data written is the hwirq number (in this specific MSI controller)
it ought to be fixed.

The commit log and patch should be rewritten (I will do that) but
first I would like to understand if there are more drivers to be
updated.

Lorenzo

> Fix Multi MSI data programming with required alignment by
> using number of vectors being requested.
> 
> Fixes: ab597d35ef11 ("PCI: xilinx-nwl: Add support for Xilinx NWL PCIe
> Host Controller")
> Signed-off-by: Bharat Kumar Gogada <bharat.kumar.gogada@...inx.com>
> ---
> V3:
>  - Added example description of the issue
> ---
>  drivers/pci/controller/pcie-xilinx-nwl.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c
> index 81538d7..8efcb8a 100644
> --- a/drivers/pci/controller/pcie-xilinx-nwl.c
> +++ b/drivers/pci/controller/pcie-xilinx-nwl.c
> @@ -483,7 +483,16 @@ static int nwl_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
>  	int i;
>  
>  	mutex_lock(&msi->lock);
> -	bit = bitmap_find_next_zero_area(msi->bitmap, INT_PCI_MSI_NR, 0,
> +
> +	/*
> +	 * Multi MSI count is requested in power of two
> +	 * Check if multi msi is requested
> +	 */
> +	if (nr_irqs % 2 == 0)
> +		bit = bitmap_find_next_zero_area(msi->bitmap, INT_PCI_MSI_NR, 0,
> +					 nr_irqs, nr_irqs - 1);
> +	else
> +		bit = bitmap_find_next_zero_area(msi->bitmap, INT_PCI_MSI_NR, 0,
>  					 nr_irqs, 0);
>  	if (bit >= INT_PCI_MSI_NR) {
>  		mutex_unlock(&msi->lock);
> -- 
> 2.7.4
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ