diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2019-06-04 06:17:51 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2019-06-05 04:35:11 -0400 |
commit | eb737b8f446044df327b30f24416be0cae35d4aa (patch) | |
tree | b238b87ac56f44f7e82e8b3d10d648411c98acae /drivers/irqchip | |
parent | db56c5128e6625cb16efc4910b60627e46f608e3 (diff) |
irqchip/ti-sci-inta: Fix kernel crash if irq_create_fwspec_mapping fail
irq_create_fwspec_mapping() can fail, returning 0 as parent_virq. In this
case vint_desc is going to be NULL in ti_sci_inta_alloc_irq() which will
cause NULL pointer dereference.
Also note that irq_create_fwspec_mapping() returns 'unsigned int' so the
check '<=' was wrong.
Use -EINVAL if irq_create_fwspec_mapping() returned with 0.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'drivers/irqchip')
-rw-r--r-- | drivers/irqchip/irq-ti-sci-inta.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c index 011b60a49e3f..ef4d625d2d80 100644 --- a/drivers/irqchip/irq-ti-sci-inta.c +++ b/drivers/irqchip/irq-ti-sci-inta.c | |||
@@ -159,9 +159,9 @@ static struct ti_sci_inta_vint_desc *ti_sci_inta_alloc_parent_irq(struct irq_dom | |||
159 | parent_fwspec.param[1] = vint_desc->vint_id; | 159 | parent_fwspec.param[1] = vint_desc->vint_id; |
160 | 160 | ||
161 | parent_virq = irq_create_fwspec_mapping(&parent_fwspec); | 161 | parent_virq = irq_create_fwspec_mapping(&parent_fwspec); |
162 | if (parent_virq <= 0) { | 162 | if (parent_virq == 0) { |
163 | kfree(vint_desc); | 163 | kfree(vint_desc); |
164 | return ERR_PTR(parent_virq); | 164 | return ERR_PTR(-EINVAL); |
165 | } | 165 | } |
166 | vint_desc->parent_virq = parent_virq; | 166 | vint_desc->parent_virq = parent_virq; |
167 | 167 | ||