Message ID | 20221017233123.15869-1-snelson@pensando.io (mailing list archive) |
---|---|
State | Accepted |
Commit | aa1d7e1267c12e07d979aa34c613716a89029db2 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] ionic: catch NULL pointer issue on reconfig | expand |
Hello: This patch was applied to netdev/net.git (master) by Jakub Kicinski <kuba@kernel.org>: On Mon, 17 Oct 2022 16:31:23 -0700 you wrote: > From: Brett Creeley <brett@pensando.io> > > 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. > > [...] Here is the summary with links: - [net] ionic: catch NULL pointer issue on reconfig https://git.kernel.org/netdev/net/c/aa1d7e1267c1 You are awesome, thank you!
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 5d58fd99be3c..19d4848df17d 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -2817,11 +2817,15 @@ int ionic_reconfigure_queues(struct ionic_lif *lif, * than the full array, but leave the qcq shells in place */ for (i = lif->nxqs; i < lif->ionic->ntxqs_per_lif; i++) { - lif->txqcqs[i]->flags &= ~IONIC_QCQ_F_INTR; - ionic_qcq_free(lif, lif->txqcqs[i]); + if (lif->txqcqs && lif->txqcqs[i]) { + lif->txqcqs[i]->flags &= ~IONIC_QCQ_F_INTR; + ionic_qcq_free(lif, lif->txqcqs[i]); + } - lif->rxqcqs[i]->flags &= ~IONIC_QCQ_F_INTR; - ionic_qcq_free(lif, lif->rxqcqs[i]); + if (lif->rxqcqs && lif->rxqcqs[i]) { + lif->rxqcqs[i]->flags &= ~IONIC_QCQ_F_INTR; + ionic_qcq_free(lif, lif->rxqcqs[i]); + } } if (err)