]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
soc/tegra: pmc: Avoid crash for non-wake IRQs
authorThierry Reding <treding@nvidia.com>
Mon, 27 May 2019 10:19:23 +0000 (12:19 +0200)
committerThierry Reding <treding@nvidia.com>
Wed, 5 Jun 2019 07:53:01 +0000 (09:53 +0200)
For interrupts that are not wakeup sources but that may end up getting
mapped through the PMC as interrupt parent (this can happen for GPIOs),
return early in order to avoid a subsequent crash from an out-of-bounds
access to the register region.

Reported-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/soc/tegra/pmc.c

index 653fe2c466f631a1661b3991e2c9c51a3469b8f5..6e66b5e293bea97fc1278a771ce47c8272cfd9e1 100644 (file)
@@ -1924,6 +1924,9 @@ static int tegra_pmc_irq_set_wake(struct irq_data *data, unsigned int on)
        unsigned int offset, bit;
        u32 value;
 
+       if (WARN_ON(data->hwirq == ULONG_MAX))
+               return 0;
+
        offset = data->hwirq / 32;
        bit = data->hwirq % 32;