Skip to content

Commit

Permalink
thunderbolt: Add the missed ida_simple_remove() in ring_request_msix()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
hiss2018 authored and gregkh committed Nov 18, 2020
1 parent 134b855 commit bdffd69
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions drivers/thunderbolt/nhi.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,23 @@ static int ring_request_msix(struct tb_ring *ring, bool no_suspend)

ring->vector = ret;

ring->irq = pci_irq_vector(ring->nhi->pdev, ring->vector);
if (ring->irq < 0)
return ring->irq;
ret = pci_irq_vector(ring->nhi->pdev, ring->vector);
if (ret < 0)
goto err_ida_remove;

ring->irq = ret;

irqflags = no_suspend ? IRQF_NO_SUSPEND : 0;
return request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring);
ret = request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring);
if (ret)
goto err_ida_remove;

return 0;

err_ida_remove:
ida_simple_remove(&nhi->msix_ida, ring->vector);

return ret;
}

static void ring_release_msix(struct tb_ring *ring)
Expand Down

0 comments on commit bdffd69

Please sign in to comment.