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: <20120328222246.8AFA83E0CFE@localhost>
Date:	Wed, 28 Mar 2012 16:22:46 -0600
From:	Grant Likely <grant.likely@...retlab.ca>
To:	David Daney <david.daney@...ium.com>,
	Rob Herring <robherring2@...il.com>
Cc:	David Daney <ddaney.cavm@...il.com>, linux-mips@...ux-mips.org,
	ralf@...ux-mips.org, devicetree-discuss@...ts.ozlabs.org,
	Rob Herring <rob.herring@...xeda.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 2/4] MIPS: Octeon: Setup irq_domains for interrupts.

On Tue, 27 Mar 2012 11:24:51 -0700, David Daney <david.daney@...ium.com> wrote:
> On 03/26/2012 06:56 PM, Rob Herring wrote:
> > On 03/26/2012 02:31 PM, David Daney wrote:
> >> From: David Daney<david.daney@...ium.com>
> [...]
> >> +static int octeon_irq_ciu_map(struct irq_domain *d,
> >> +			      unsigned int virq, irq_hw_number_t hw)
> >> +{
> >> +	unsigned int line = hw>>  6;
> >> +	unsigned int bit = hw&  63;
> >> +
> >> +	if (virq>= 256)
> >> +		return -EINVAL;
> >
> > Drop this. You should not care what the virq numbers are.
> 
> 
> I care that they don't overflow the width of octeon_irq_ciu_to_irq (a u8).
> 
> So really I want to say:
> 
>     if (virq >= (1 << sizeof (octeon_irq_ciu_to_irq[0][0]))) {
>         WARN(...);
>         return -EINVAL;
>     }
> 
> 
> I need a map external to any one irq_domain.  The irq handling code 
> handles sources that come from two separate irq_domains, as well as irqs 
> that are not part of any domain.

You can get past this limitation by using the struct irq_data .hwirq and
.domain members for the irq ==> hwirq translation, and for hwirq ==>
irq the code should already have the context to know which user it is.

For the irqs that are not covered by an irq_domain, the driver is free
to set the .hwirq value directly.  Ultimately however, it will
probably be best to add an irq domain for those users also.

...

Howver, I don't understand where the risk is in overflowing
octeon_irq_ciu_to_irq[][].  From what I can see, the virq value isn't
used at all to calculate the array dereference.  line and bit are
calculated from the hwirq value.  What am I missing?

g.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ