diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2006-01-03 10:49:18 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-03 10:49:18 -0500 |
commit | ac67c6247361b3b8644b34e5301a46d5069c1373 (patch) | |
tree | dd83147e304181e889eefa39e5056451031f4b5d /kernel | |
parent | c4c48d83e9ffb1c25cccd59d5ea9dda6ded01faf (diff) | |
parent | 88026842b0a760145aa71d69e74fbc9ec118ca44 (diff) |
Merge branch 'master'
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/futex.c | 6 | ||||
-rw-r--r-- | kernel/params.c | 2 | ||||
-rw-r--r-- | kernel/sysctl.c | 29 |
3 files changed, 23 insertions, 14 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index 5872e3507f35..5e71a6bf6f6b 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -270,7 +270,13 @@ static void wake_futex(struct futex_q *q) | |||
270 | /* | 270 | /* |
271 | * The waiting task can free the futex_q as soon as this is written, | 271 | * The waiting task can free the futex_q as soon as this is written, |
272 | * without taking any locks. This must come last. | 272 | * without taking any locks. This must come last. |
273 | * | ||
274 | * A memory barrier is required here to prevent the following store | ||
275 | * to lock_ptr from getting ahead of the wakeup. Clearing the lock | ||
276 | * at the end of wake_up_all() does not prevent this store from | ||
277 | * moving. | ||
273 | */ | 278 | */ |
279 | wmb(); | ||
274 | q->lock_ptr = NULL; | 280 | q->lock_ptr = NULL; |
275 | } | 281 | } |
276 | 282 | ||
diff --git a/kernel/params.c b/kernel/params.c index 47ba69547945..c76ad25e6a21 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -619,7 +619,7 @@ static void __init param_sysfs_builtin(void) | |||
619 | 619 | ||
620 | 620 | ||
621 | /* module-related sysfs stuff */ | 621 | /* module-related sysfs stuff */ |
622 | #ifdef CONFIG_MODULES | 622 | #ifdef CONFIG_SYSFS |
623 | 623 | ||
624 | #define to_module_attr(n) container_of(n, struct module_attribute, attr); | 624 | #define to_module_attr(n) container_of(n, struct module_attribute, attr); |
625 | #define to_module_kobject(n) container_of(n, struct module_kobject, kobj); | 625 | #define to_module_kobject(n) container_of(n, struct module_kobject, kobj); |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 9990e10192e8..b53115b882e1 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -2192,29 +2192,32 @@ int sysctl_string(ctl_table *table, int __user *name, int nlen, | |||
2192 | void __user *oldval, size_t __user *oldlenp, | 2192 | void __user *oldval, size_t __user *oldlenp, |
2193 | void __user *newval, size_t newlen, void **context) | 2193 | void __user *newval, size_t newlen, void **context) |
2194 | { | 2194 | { |
2195 | size_t l, len; | ||
2196 | |||
2197 | if (!table->data || !table->maxlen) | 2195 | if (!table->data || !table->maxlen) |
2198 | return -ENOTDIR; | 2196 | return -ENOTDIR; |
2199 | 2197 | ||
2200 | if (oldval && oldlenp) { | 2198 | if (oldval && oldlenp) { |
2201 | if (get_user(len, oldlenp)) | 2199 | size_t bufsize; |
2200 | if (get_user(bufsize, oldlenp)) | ||
2202 | return -EFAULT; | 2201 | return -EFAULT; |
2203 | if (len) { | 2202 | if (bufsize) { |
2204 | l = strlen(table->data); | 2203 | size_t len = strlen(table->data), copied; |
2205 | if (len > l) len = l; | 2204 | |
2206 | if (len >= table->maxlen) | 2205 | /* This shouldn't trigger for a well-formed sysctl */ |
2206 | if (len > table->maxlen) | ||
2207 | len = table->maxlen; | 2207 | len = table->maxlen; |
2208 | if(copy_to_user(oldval, table->data, len)) | 2208 | |
2209 | return -EFAULT; | 2209 | /* Copy up to a max of bufsize-1 bytes of the string */ |
2210 | if(put_user(0, ((char __user *) oldval) + len)) | 2210 | copied = (len >= bufsize) ? bufsize - 1 : len; |
2211 | |||
2212 | if (copy_to_user(oldval, table->data, copied) || | ||
2213 | put_user(0, (char __user *)(oldval + copied))) | ||
2211 | return -EFAULT; | 2214 | return -EFAULT; |
2212 | if(put_user(len, oldlenp)) | 2215 | if (put_user(len, oldlenp)) |
2213 | return -EFAULT; | 2216 | return -EFAULT; |
2214 | } | 2217 | } |
2215 | } | 2218 | } |
2216 | if (newval && newlen) { | 2219 | if (newval && newlen) { |
2217 | len = newlen; | 2220 | size_t len = newlen; |
2218 | if (len > table->maxlen) | 2221 | if (len > table->maxlen) |
2219 | len = table->maxlen; | 2222 | len = table->maxlen; |
2220 | if(copy_from_user(table->data, newval, len)) | 2223 | if(copy_from_user(table->data, newval, len)) |
@@ -2223,7 +2226,7 @@ int sysctl_string(ctl_table *table, int __user *name, int nlen, | |||
2223 | len--; | 2226 | len--; |
2224 | ((char *) table->data)[len] = 0; | 2227 | ((char *) table->data)[len] = 0; |
2225 | } | 2228 | } |
2226 | return 0; | 2229 | return 1; |
2227 | } | 2230 | } |
2228 | 2231 | ||
2229 | /* | 2232 | /* |