* [PATCH net] ionic: catch NULL pointer issue on reconfig
@ 2022-10-17 23:31 Shannon Nelson
2022-10-19 2:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Shannon Nelson @ 2022-10-17 23:31 UTC (permalink / raw)
To: davem, netdev, kuba; +Cc: drivers, Brett Creeley, Shannon Nelson
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.
Fix this by checking to make sure both the qcqs array and qcq entry
exists bofore trying to use and free the entry.
Fixes: 101b40a0171f ("ionic: change queue count with no reset")
Signed-off-by: Brett Creeley <brett@pensando.io>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
drivers/net/ethernet/pensando/ionic/ionic_lif.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
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)
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] ionic: catch NULL pointer issue on reconfig
2022-10-17 23:31 [PATCH net] ionic: catch NULL pointer issue on reconfig Shannon Nelson
@ 2022-10-19 2:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-10-19 2:30 UTC (permalink / raw)
To: Shannon Nelson; +Cc: davem, netdev, kuba, drivers, brett
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-19 2:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-17 23:31 [PATCH net] ionic: catch NULL pointer issue on reconfig Shannon Nelson
2022-10-19 2:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).