summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Miller <doug.miller@cornelisnetworks.com>2023-08-02 13:32:41 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-16 18:21:01 +0200
commit33c677d1e087e437c7dcaad8d73402cf6add282e (patch)
treee02b7ce48c129d6434bcb1444895f15b4c1dddfe
parent13f7752f4adbb0ed47ad06230e2c86933c45b56c (diff)
downloadlinux-33c677d1e087e437c7dcaad8d73402cf6add282e.tar.gz
linux-33c677d1e087e437c7dcaad8d73402cf6add282e.tar.bz2
linux-33c677d1e087e437c7dcaad8d73402cf6add282e.zip
IB/hfi1: Fix possible panic during hotplug remove
commit 4fdfaef71fced490835145631a795497646f4555 upstream. During hotplug remove it is possible that the update counters work might be pending, and may run after memory has been freed. Cancel the update counters work before freeing memory. Fixes: 7724105686e7 ("IB/hfi1: add driver files") Signed-off-by: Douglas Miller <doug.miller@cornelisnetworks.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com> Link: https://lore.kernel.org/r/169099756100.3927190.15284930454106475280.stgit@awfm-02.cornelisnetworks.com Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/infiniband/hw/hfi1/chip.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c
index 4b41f35668b2..c74868f01637 100644
--- a/drivers/infiniband/hw/hfi1/chip.c
+++ b/drivers/infiniband/hw/hfi1/chip.c
@@ -12348,6 +12348,7 @@ static void free_cntrs(struct hfi1_devdata *dd)
if (dd->synth_stats_timer.function)
del_timer_sync(&dd->synth_stats_timer);
+ cancel_work_sync(&dd->update_cntr_work);
ppd = (struct hfi1_pportdata *)(dd + 1);
for (i = 0; i < dd->num_pports; i++, ppd++) {
kfree(ppd->cntrs);