scsi: mpt3sas: Fix a race condition in mpt3sas_base_hard_reset_handler()
authorBart Van Assche <bart.vanassche@wdc.com>
Fri, 15 Jun 2018 21:41:59 +0000 (14:41 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 20 Jun 2018 02:02:25 +0000 (22:02 -0400)
commit982ea6f9ff2b2f92c03eda06df420b2f3699b7ad
tree5ee4819d5d287365915aa4f5d384b2844bdefae6
parent91b7bdb2c0089cbbb817df6888ab1458c645184e
scsi: mpt3sas: Fix a race condition in mpt3sas_base_hard_reset_handler()

Since ioc->shost_recovery is set after ioc->reset_in_progress_mutex is
obtained, if concurrent resets are issued there is a short time during
which ioc->reset_in_progress_mutex is locked and ioc->shost_recovery ==
0. Avoid that this can cause trouble by unconditionally locking
ioc->shost_recovery.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: Chaitra P B <chaitra.basappa@broadcom.com>
Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_base.c
drivers/scsi/mpt3sas/mpt3sas_base.h