]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ice, irdma: fix an off by one in error handling code
authorDan Carpenter <dan.carpenter@linaro.org>
Mon, 14 Apr 2025 23:42:31 +0000 (18:42 -0500)
committerLeon Romanovsky <leon@kernel.org>
Sun, 20 Apr 2025 10:55:51 +0000 (06:55 -0400)
If we don't allocate the MIN number of IRQs then we need to free what
we have and return -ENOMEM.  The problem is this loop is off by one
so it frees an entry that wasn't allocated and it doesn't free the
first entry where i == 0.

Fixes: 3e0d3cb3fbe0 ("ice, irdma: move interrupts code to irdma")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Link: https://patch.msgid.link/20250414234231.523-2-tatyana.e.nikolova@intel.com
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/irdma/main.c

index d10fd16dcec3d82ae10f5e4efae9686b69bcae57..7599e31b574369058573e8f6cf9ce9d5b07e6ffd 100644 (file)
@@ -221,7 +221,7 @@ static int irdma_init_interrupts(struct irdma_pci_f *rf, struct ice_pf *pf)
                        break;
 
        if (i < IRDMA_MIN_MSIX) {
-               for (; i > 0; i--)
+               while (--i >= 0)
                        ice_free_rdma_qvector(pf, &rf->msix_entries[i]);
 
                kfree(rf->msix_entries);