diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2019-10-17 21:39:19 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-11-06 06:04:03 +0100 |
commit | a62726cb9cb42b366f2af2c1951ae2fff66e2ad3 (patch) | |
tree | e4667c39f9dc01fe0f53bd1175915352b5abb197 /drivers/scsi/sg.c | |
parent | scsi: sg: sg_ioctl(): fix copyout handling (diff) | |
download | linux-a62726cb9cb42b366f2af2c1951ae2fff66e2ad3.tar.xz linux-a62726cb9cb42b366f2af2c1951ae2fff66e2ad3.zip |
scsi: sg: sg_new_write(): replace access_ok() + __copy_from_user() with copy_from_user()
Link: https://lore.kernel.org/r/20191017193925.25539-2-viro@ZenIV.linux.org.uk
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r-- | drivers/scsi/sg.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 634460421ce4..026628aa556d 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -763,11 +763,7 @@ sg_new_write(Sg_fd *sfp, struct file *file, const char __user *buf, sg_remove_request(sfp, srp); return -EMSGSIZE; } - if (!access_ok(hp->cmdp, hp->cmd_len)) { - sg_remove_request(sfp, srp); - return -EFAULT; /* protects following copy_from_user()s + get_user()s */ - } - if (__copy_from_user(cmnd, hp->cmdp, hp->cmd_len)) { + if (copy_from_user(cmnd, hp->cmdp, hp->cmd_len)) { sg_remove_request(sfp, srp); return -EFAULT; } |