[PATCH] sg: protect against races between mmap() and SG_SET_RESERVED_SIZE

2017-08-15 Thread Todd Poynor
operation with the mapping. Signed-off-by: Todd Poynor <toddpoy...@google.com> --- drivers/scsi/sg.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 3a44b4bc872b..a20718e9f1f4 100644 --- a/drivers/scsi/sg.c +++ b/d

[PATCH] sg: recheck MMAP_IO request length with lock held

2017-08-15 Thread Todd Poynor
M should be returned in this case, instead of switching over to an indirect buffer as for non-MMAP_IO requests. Signed-off-by: Todd Poynor <toddpoy...@google.com> --- drivers/scsi/sg.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/sc