diff options
Diffstat (limited to 'kernel/futex_compat.c')
-rw-r--r-- | kernel/futex_compat.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c index 133d558db452..ff90f049f8f6 100644 --- a/kernel/futex_compat.c +++ b/kernel/futex_compat.c | |||
@@ -54,6 +54,9 @@ void compat_exit_robust_list(struct task_struct *curr) | |||
54 | compat_long_t futex_offset; | 54 | compat_long_t futex_offset; |
55 | int rc; | 55 | int rc; |
56 | 56 | ||
57 | if (!futex_cmpxchg_enabled) | ||
58 | return; | ||
59 | |||
57 | /* | 60 | /* |
58 | * Fetch the list head (which was registered earlier, via | 61 | * Fetch the list head (which was registered earlier, via |
59 | * sys_set_robust_list()): | 62 | * sys_set_robust_list()): |
@@ -115,6 +118,9 @@ asmlinkage long | |||
115 | compat_sys_set_robust_list(struct compat_robust_list_head __user *head, | 118 | compat_sys_set_robust_list(struct compat_robust_list_head __user *head, |
116 | compat_size_t len) | 119 | compat_size_t len) |
117 | { | 120 | { |
121 | if (!futex_cmpxchg_enabled) | ||
122 | return -ENOSYS; | ||
123 | |||
118 | if (unlikely(len != sizeof(*head))) | 124 | if (unlikely(len != sizeof(*head))) |
119 | return -EINVAL; | 125 | return -EINVAL; |
120 | 126 | ||
@@ -130,6 +136,9 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, | |||
130 | struct compat_robust_list_head __user *head; | 136 | struct compat_robust_list_head __user *head; |
131 | unsigned long ret; | 137 | unsigned long ret; |
132 | 138 | ||
139 | if (!futex_cmpxchg_enabled) | ||
140 | return -ENOSYS; | ||
141 | |||
133 | if (!pid) | 142 | if (!pid) |
134 | head = current->compat_robust_list; | 143 | head = current->compat_robust_list; |
135 | else { | 144 | else { |
@@ -176,7 +185,7 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, | |||
176 | 185 | ||
177 | t = timespec_to_ktime(ts); | 186 | t = timespec_to_ktime(ts); |
178 | if (cmd == FUTEX_WAIT) | 187 | if (cmd == FUTEX_WAIT) |
179 | t = ktime_add(ktime_get(), t); | 188 | t = ktime_add_safe(ktime_get(), t); |
180 | tp = &t; | 189 | tp = &t; |
181 | } | 190 | } |
182 | if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE) | 191 | if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE) |