Skip to content

Commit aa1d7e1

Browse files
brettcreeleykuba-moo
authored andcommitted
ionic: catch NULL pointer issue on reconfig
It's possible that the driver will dereference a qcq that doesn't exist when calling ionic_reconfigure_queues(), which causes a page fault BUG. If a reduction in the number of queues is followed by a different reconfig such as changing the ring size, the driver can hit a NULL pointer when trying to clean up non-existent queues. Fix this by checking to make sure both the qcqs array and qcq entry exists bofore trying to use and free the entry. Fixes: 101b40a ("ionic: change queue count with no reset") Signed-off-by: Brett Creeley <[email protected]> Signed-off-by: Shannon Nelson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d8b5713 commit aa1d7e1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/net/ethernet/pensando/ionic/ionic_lif.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2817,11 +2817,15 @@ int ionic_reconfigure_queues(struct ionic_lif *lif,
28172817
* than the full array, but leave the qcq shells in place
28182818
*/
28192819
for (i = lif->nxqs; i < lif->ionic->ntxqs_per_lif; i++) {
2820-
lif->txqcqs[i]->flags &= ~IONIC_QCQ_F_INTR;
2821-
ionic_qcq_free(lif, lif->txqcqs[i]);
2820+
if (lif->txqcqs && lif->txqcqs[i]) {
2821+
lif->txqcqs[i]->flags &= ~IONIC_QCQ_F_INTR;
2822+
ionic_qcq_free(lif, lif->txqcqs[i]);
2823+
}
28222824

2823-
lif->rxqcqs[i]->flags &= ~IONIC_QCQ_F_INTR;
2824-
ionic_qcq_free(lif, lif->rxqcqs[i]);
2825+
if (lif->rxqcqs && lif->rxqcqs[i]) {
2826+
lif->rxqcqs[i]->flags &= ~IONIC_QCQ_F_INTR;
2827+
ionic_qcq_free(lif, lif->rxqcqs[i]);
2828+
}
28252829
}
28262830

28272831
if (err)

0 commit comments

Comments
 (0)