]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
ibmvnic: serialize access to work queue on remove
authorSukadev Bhattiprolu <sukadev@linux.ibm.com>
Sat, 13 Feb 2021 04:42:50 +0000 (20:42 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Feb 2021 23:17:30 +0000 (15:17 -0800)
commit4a41c421f3676fdeea91733cf434dcf319c4c351
treedec910c33e9465be15965438b5483d3c13436713
parent7d3a7b9ea59ddb223aec59b45fa1713c633aaed4
ibmvnic: serialize access to work queue on remove

The work queue is used to queue reset requests like CHANGE-PARAM or
FAILOVER resets for the worker thread. When the adapter is being removed
the adapter state is set to VNIC_REMOVING and the work queue is flushed
so no new work is added. However the check for adapter being removed is
racy in that the adapter can go into REMOVING state just after we check
and we might end up adding work just as it is being flushed (or after).

The ->rwi_lock is already being used to serialize queue/dequeue work.
Extend its usage ensure there is no race when scheduling/flushing work.

Fixes: 6954a9e4192b ("ibmvnic: Flush existing work items before device removal")
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Cc:Uwe Kleine-König <uwe@kleine-koenig.org>
Cc:Saeed Mahameed <saeed@kernel.org>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c
drivers/net/ethernet/ibm/ibmvnic.h