mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-10 16:54:34 -05:00
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>
This commit is contained in:
committed by
Martin K. Petersen
parent
a16a47416d
commit
a62726cb9c
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user