RDMA/bnxt_re: Fix system crash during load/unload
authorSelvin Xavier <selvin.xavier@broadcom.com>
Fri, 16 Feb 2018 05:20:12 +0000 (21:20 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 May 2018 05:51:59 +0000 (07:51 +0200)
[ Upstream commit dcdaba08062b4726500b9456f8664bfda896c664 ]

During driver unload, the driver proceeds with cleanup
without waiting for the scheduled events. So the device
pointers get freed up and driver crashes when the events
are scheduled later.

Flush the bnxt_re_task work queue before starting
device removal.

Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/bnxt_re/main.c

index e7450ea92aa9e11ba0d28792f54fcf373e470a66..1cc382049dabd40372240f8719a9d7d6e28f47b8 100644 (file)
@@ -1398,6 +1398,11 @@ static void __exit bnxt_re_mod_exit(void)
 
        list_for_each_entry(rdev, &to_be_deleted, list) {
                dev_info(rdev_to_dev(rdev), "Unregistering Device");
+               /*
+                * Flush out any scheduled tasks before destroying the
+                * resources
+                */
+               flush_workqueue(bnxt_re_wq);
                bnxt_re_dev_stop(rdev);
                bnxt_re_ib_unreg(rdev, true);
                bnxt_re_remove_one(rdev);