Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 40644
b: refs/heads/master
c: 87c2b7c
h: refs/heads/master
v: v3
  • Loading branch information
Heiko Carstens authored and Linus Torvalds committed Nov 3, 2006
1 parent f0d34f5 commit 822bba3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7870db4c7fa1b03fec133c4f4e67fdaa04c5ac15
refs/heads/master: 87c2b7c045a44f6c1c7af23e64f2b286e6f7130a
20 changes: 17 additions & 3 deletions trunk/fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1835,9 +1835,12 @@ asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp,

} while (!ret && !timeout && tsp && (ts.tv_sec || ts.tv_nsec));

if (ret == 0 && tsp && !(current->personality & STICKY_TIMEOUTS)) {
if (tsp) {
struct compat_timespec rts;

if (current->personality & STICKY_TIMEOUTS)
goto sticky;

rts.tv_sec = timeout / HZ;
rts.tv_nsec = (timeout % HZ) * (NSEC_PER_SEC/HZ);
if (rts.tv_nsec >= NSEC_PER_SEC) {
Expand All @@ -1846,8 +1849,19 @@ asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp,
}
if (compat_timespec_compare(&rts, &ts) >= 0)
rts = ts;
if (copy_to_user(tsp, &rts, sizeof(rts)))
ret = -EFAULT;
if (copy_to_user(tsp, &rts, sizeof(rts))) {
sticky:
/*
* If an application puts its timeval in read-only
* memory, we don't want the Linux-specific update to
* the timeval to cause a fault after the select has
* completed successfully. However, because we're not
* updating the timeval, we can't restart the system
* call.
*/
if (ret == -ERESTARTNOHAND)
ret = -EINTR;
}
}

if (ret == -ERESTARTNOHAND) {
Expand Down

0 comments on commit 822bba3

Please sign in to comment.