]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: core: Make scsi_internal_device_unblock_nowait() reject invalid new_state
authorBart Van Assche <bvanassche@acm.org>
Thu, 1 Aug 2019 22:38:12 +0000 (15:38 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 8 Aug 2019 01:43:55 +0000 (21:43 -0400)
commitbae0e10334c310ef1b6a0f00404914eec51a0bff
tree249e6481bca7cbfcef38f6026132ae38f4b3c5bb
parenta6963686915fa3477f84e0b0ecfa5e879ca745a6
scsi: core: Make scsi_internal_device_unblock_nowait() reject invalid new_state

The only 'new_state' values passed by upstream kernel code to
scsi_internal_device_unblock_nowait() are SDEV_RUNNING and
SDEV_TRANSPORT_OFFLINE. These are the only values that should be passed to
this function. Hence check the value of the 'new_state' argument to avoid
that scsi_internal_device_unblock_nowait() would be used to trigger an
illegal SCSI device state transition. In this context 'illegal' means not
allowed by scsi_device_set_state().

Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_lib.c