]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: sg: protect against races between mmap() and SG_SET_RESERVED_SIZE
authorTodd Poynor <toddpoynor@google.com>
Wed, 16 Aug 2017 05:41:08 +0000 (22:41 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 25 Aug 2017 02:29:09 +0000 (22:29 -0400)
commitc503c9e877b04a20b23b479dfe1ba11971279918
tree6a9cb8566b1554f8aaafd81fabce9cfc20122490
parent1df875e81e528bc28847a313ebb9330a07f16bd8
scsi: sg: protect against races between mmap() and SG_SET_RESERVED_SIZE

Take f_mutex around mmap() processing to protect against races with the
SG_SET_RESERVED_SIZE ioctl.  Ensure the reserve buffer length remains
consistent during the mapping operation, and set the "mmap called" flag
to prevent further changes to the reserved buffer size as an atomic
operation with the mapping.

[mkp: fixed whitespace]

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sg.c