scsi: vmw_pscsi: Fix use-after-free in pvscsi_queue_lck()
authorJan Kara <jack@suse.cz>
Wed, 19 Jun 2019 07:05:41 +0000 (09:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Jul 2019 07:55:39 +0000 (09:55 +0200)
commitff2870b00428ba1c6652890d0754e2370b19af9b
treee070d7f2274a8e6482855b96fefc90720ada257a
parent0c4a3f55a80f9bc286bb0ba7cb6262a2cd55fa23
scsi: vmw_pscsi: Fix use-after-free in pvscsi_queue_lck()

commit 240b4cc8fd5db138b675297d4226ec46594d9b3b upstream.

Once we unlock adapter->hw_lock in pvscsi_queue_lck() nothing prevents just
queued scsi_cmnd from completing and freeing the request. Thus cmd->cmnd[0]
dereference can dereference already freed request leading to kernel crashes
or other issues (which one of our customers observed). Store cmd->cmnd[0]
in a local variable before unlocking adapter->hw_lock to fix the issue.

CC: <stable@vger.kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/vmw_pvscsi.c