Skip to content

Commit bdffd69

Browse files
hiss2018gregkh
authored andcommitted
thunderbolt: Add the missed ida_simple_remove() in ring_request_msix()
commit 7342ca3 upstream. ring_request_msix() misses to call ida_simple_remove() in an error path. Add a label 'err_ida_remove' and jump to it. Fixes: 046bee1 ("thunderbolt: Add MSI-X support") Cc: stable@vger.kernel.org Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 134b855 commit bdffd69

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

‎drivers/thunderbolt/nhi.c‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,23 @@ static int ring_request_msix(struct tb_ring *ring, bool no_suspend)
405405

406406
ring->vector = ret;
407407

408-
ring->irq = pci_irq_vector(ring->nhi->pdev, ring->vector);
409-
if (ring->irq < 0)
410-
return ring->irq;
408+
ret = pci_irq_vector(ring->nhi->pdev, ring->vector);
409+
if (ret < 0)
410+
goto err_ida_remove;
411+
412+
ring->irq = ret;
411413

412414
irqflags = no_suspend ? IRQF_NO_SUSPEND : 0;
413-
return request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring);
415+
ret = request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring);
416+
if (ret)
417+
goto err_ida_remove;
418+
419+
return 0;
420+
421+
err_ida_remove:
422+
ida_simple_remove(&nhi->msix_ida, ring->vector);
423+
424+
return ret;
414425
}
415426

416427
static void ring_release_msix(struct tb_ring *ring)

0 commit comments

Comments
 (0)