qed: Fix race condition between scheduling and destroying the slowpath workqueue
authorYuval Basson <ybason@marvell.com>
Wed, 25 Mar 2020 20:50:43 +0000 (22:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 May 2020 06:49:00 +0000 (08:49 +0200)
commitb0946b45b85a540aa1b030c277301ce87003d5b6
treef750a8de9fd9a32e489c36bf459d506d759e069b
parentd15fc14704414a7b90465a8f735c9ad7f5cf1ac0
qed: Fix race condition between scheduling and destroying the slowpath workqueue

commit 3b85720d3fd72e6ef4de252cd2f67548eb645eb4 upstream.

Calling queue_delayed_work concurrently with
destroy_workqueue might race to an unexpected outcome -
scheduled task after wq is destroyed or other resources
(like ptt_pool) are freed (yields NULL pointer dereference).
cancel_delayed_work prevents the race by cancelling
the timer triggered for scheduling a new task.

Fixes: 59ccf86fe ("qed: Add driver infrastucture for handling mfw requests")
Signed-off-by: Denis Bolotin <dbolotin@marvell.com>
Signed-off-by: Michal Kalderon <mkalderon@marvell.com>
Signed-off-by: Yuval Basson <ybason@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/qlogic/qed/qed_main.c