scsi: sg: protect accesses to 'reserved' page array
authorHannes Reinecke <hare@suse.de>
Fri, 7 Apr 2017 07:34:14 +0000 (09:34 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 12 Apr 2017 00:55:20 +0000 (20:55 -0400)
commit1bc0eb0446158cc76562176b80623aa119afee5b
treef72fe80c00543cbce217db3bc95555fa34b2a09d
parent136e57bf43dc4babbfb8783abbf707d483cacbe3
scsi: sg: protect accesses to 'reserved' page array

The 'reserved' page array is used as a short-cut for mapping data,
saving us to allocate pages per request. However, the 'reserved' array
is only capable of holding one request, so this patch introduces a mutex
for protect 'sg_fd' against concurrent accesses.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Tested-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sg.c