Skip to content

Commit

Permalink
regset: Return -EFAULT, not -EIO, on host-side memory fault
Browse files Browse the repository at this point in the history
There is only one error code to return for a bad user-space buffer
pointer passed to a system call in the same address space as the
system call is executed, and that is EFAULT.  Furthermore, the
low-level access routines, which catch most of the faults, return
EFAULT already.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Roland McGrath <roland@hack.frob.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
H. Peter Anvin authored and Linus Torvalds committed Mar 2, 2012
1 parent c8e2525 commit 5189fa1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/regset.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ static inline int copy_regset_to_user(struct task_struct *target,
return -EOPNOTSUPP;

if (!access_ok(VERIFY_WRITE, data, size))
return -EIO;
return -EFAULT;

return regset->get(target, regset, offset, size, NULL, data);
}
Expand All @@ -365,7 +365,7 @@ static inline int copy_regset_from_user(struct task_struct *target,
return -EOPNOTSUPP;

if (!access_ok(VERIFY_READ, data, size))
return -EIO;
return -EFAULT;

return regset->set(target, regset, offset, size, NULL, data);
}
Expand Down

0 comments on commit 5189fa1

Please sign in to comment.