]> git.baikalelectronics.ru Git - kernel.git/commit
qede: Fix race between rdma destroy workqueue and link change event
authorMichal Kalderon <michal.kalderon@marvell.com>
Mon, 17 Feb 2020 11:37:18 +0000 (13:37 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 Feb 2020 20:05:53 +0000 (12:05 -0800)
commit50088a902a2321e6af745ed602e1a89e3202d111
tree4ed0a834f46cc36f7e8a3e3ff34b1b0b48396976
parent8b2500dc5a988139ecde21b3699b69f2e502f9f7
qede: Fix race between rdma destroy workqueue and link change event

If an event is added while the rdma workqueue is being destroyed
it could lead to several races, list corruption, null pointer
dereference during queue_work or init_queue.
This fixes the race between the two flows which can occur during
shutdown.

A kref object and a completion object are added to the rdma_dev
structure, these are initialized before the workqueue is created.
The refcnt is used to indicate work is being added to the
workqueue and ensures the cleanup flow won't start while we're in
the middle of adding the event.
Once the work is added, the refcnt is decreased and the cleanup flow
is safe to run.

Fixes: 4aff7732a68 ("qede: Add qedr framework")
Signed-off-by: Ariel Elior <ariel.elior@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qede/qede.h
drivers/net/ethernet/qlogic/qede/qede_rdma.c