diff mbox series

[for-rc] IB/hfi1: Fix possible panic during hotplug remove

Message ID 169099756100.3927190.15284930454106475280.stgit@awfm-02.cornelisnetworks.com (mailing list archive)
State Accepted
Headers show
Series [for-rc] IB/hfi1: Fix possible panic during hotplug remove | expand

Commit Message

Dennis Dalessandro Aug. 2, 2023, 5:32 p.m. UTC
From: Douglas Miller <doug.miller@cornelisnetworks.com>

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>
---
 drivers/infiniband/hw/hfi1/chip.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Leon Romanovsky Aug. 3, 2023, 6:14 p.m. UTC | #1
On Wed, 02 Aug 2023 13:32:41 -0400, Dennis Dalessandro wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] IB/hfi1: Fix possible panic during hotplug remove
      https://git.kernel.org/rdma/rdma/c/4fdfaef71fced4

Best regards,
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c
index 9dbb89e9f4af..baaa4406d5e6 100644
--- a/drivers/infiniband/hw/hfi1/chip.c
+++ b/drivers/infiniband/hw/hfi1/chip.c
@@ -12307,6 +12307,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);