diff options
author | Ming Lei <ming.lei@redhat.com> | 2019-07-12 04:08:19 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-07-17 04:39:24 +0200 |
commit | f9b0530fa02e0c73f31a49ef743e8f44eb8e32cc (patch) | |
tree | ca8a8951347a3b5bbba448d80269476271ed064b /drivers/scsi/hosts.c | |
parent | scsi: sd_zbc: Fix compilation warning (diff) | |
download | linux-f9b0530fa02e0c73f31a49ef743e8f44eb8e32cc.tar.xz linux-f9b0530fa02e0c73f31a49ef743e8f44eb8e32cc.zip |
scsi: core: Fix race on creating sense cache
When scsi_init_sense_cache(host) is called concurrently from different
hosts, each code path may find that no cache has been created and
allocate a new one. The lack of locking can lead to potentially
overriding a cache allocated by a different host.
Fix the issue by moving 'mutex_lock(&scsi_sense_cache_mutex)' before
scsi_select_sense_cache().
Fixes: 0a6ac4ee7c21 ("scsi: respect unchecked_isa_dma for blk-mq")
Cc: Stable <stable@vger.kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/hosts.c')
0 files changed, 0 insertions, 0 deletions