]> 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)
commit91c759c9e2dd42d5be95b1baeab1667117fbb6bb
tree4ed0a834f46cc36f7e8a3e3ff34b1b0b48396976
parent5d60591ec79d8d34340c1c6699f9e8c955567c96
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: 0803e8a3c76 ("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