diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-19 17:07:55 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-19 17:07:55 -0400 |
| commit | 4a1f2b0fba89cdb3b2b1be99a7411bfd24d61be5 (patch) | |
| tree | e14158bdaf2a4723f98fc2411fb65416edb9f90b | |
| parent | deb521c44fa529b24cc78a64702757a683f82487 (diff) | |
| parent | fe73fbe1c5eda709084dedb66cbdd4b86826cce7 (diff) | |
Merge branch 'akpm' (Fixes from Andrew)
Merge misc fixes from Andrew Morton:
"Seven fixes"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (7 patches)
lib/dma-debug.c: fix __hash_bucket_find()
mm: compaction: correct the nr_strict va isolated check for CMA
firmware/memmap: avoid type conflicts with the generic memmap_init()
pidns: remove recursion from free_pid_ns()
drivers/video/backlight/lm3639_bl.c: return proper error in lm3639_bled_mode_store() error paths
kernel/sys.c: fix stack memory content leak via UNAME26
linux/coredump.h needs asm/siginfo.h
| -rw-r--r-- | drivers/firmware/memmap.c | 4 | ||||
| -rw-r--r-- | drivers/video/backlight/lm3639_bl.c | 4 | ||||
| -rw-r--r-- | include/linux/coredump.h | 1 | ||||
| -rw-r--r-- | include/linux/pid_namespace.h | 8 | ||||
| -rw-r--r-- | kernel/pid_namespace.c | 21 | ||||
| -rw-r--r-- | kernel/sys.c | 12 | ||||
| -rw-r--r-- | lib/dma-debug.c | 4 | ||||
| -rw-r--r-- | mm/compaction.c | 2 |
8 files changed, 30 insertions, 26 deletions
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c index c1cdc9236666..90723e65b081 100644 --- a/drivers/firmware/memmap.c +++ b/drivers/firmware/memmap.c | |||
| @@ -237,7 +237,7 @@ static ssize_t memmap_attr_show(struct kobject *kobj, | |||
| 237 | * firmware_map_add() or firmware_map_add_early() afterwards, the entries | 237 | * firmware_map_add() or firmware_map_add_early() afterwards, the entries |
| 238 | * are not added to sysfs. | 238 | * are not added to sysfs. |
| 239 | */ | 239 | */ |
| 240 | static int __init memmap_init(void) | 240 | static int __init firmware_memmap_init(void) |
| 241 | { | 241 | { |
| 242 | struct firmware_map_entry *entry; | 242 | struct firmware_map_entry *entry; |
| 243 | 243 | ||
| @@ -246,5 +246,5 @@ static int __init memmap_init(void) | |||
| 246 | 246 | ||
| 247 | return 0; | 247 | return 0; |
| 248 | } | 248 | } |
| 249 | late_initcall(memmap_init); | 249 | late_initcall(firmware_memmap_init); |
| 250 | 250 | ||
diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c index c6915c6c3cd1..585949b57055 100644 --- a/drivers/video/backlight/lm3639_bl.c +++ b/drivers/video/backlight/lm3639_bl.c | |||
| @@ -206,11 +206,11 @@ static ssize_t lm3639_bled_mode_store(struct device *dev, | |||
| 206 | 206 | ||
| 207 | out: | 207 | out: |
| 208 | dev_err(pchip->dev, "%s:i2c access fail to register\n", __func__); | 208 | dev_err(pchip->dev, "%s:i2c access fail to register\n", __func__); |
| 209 | return size; | 209 | return ret; |
| 210 | 210 | ||
| 211 | out_input: | 211 | out_input: |
| 212 | dev_err(pchip->dev, "%s:input conversion fail\n", __func__); | 212 | dev_err(pchip->dev, "%s:input conversion fail\n", __func__); |
| 213 | return size; | 213 | return ret; |
| 214 | 214 | ||
| 215 | } | 215 | } |
| 216 | 216 | ||
diff --git a/include/linux/coredump.h b/include/linux/coredump.h index 1775eb8acc03..1d7399314a89 100644 --- a/include/linux/coredump.h +++ b/include/linux/coredump.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
| 6 | #include <linux/fs.h> | 6 | #include <linux/fs.h> |
| 7 | #include <asm/siginfo.h> | ||
| 7 | 8 | ||
| 8 | /* | 9 | /* |
| 9 | * These are the only things you should do on a core-file: use only these | 10 | * These are the only things you should do on a core-file: use only these |
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index 00474b047145..65e3e87eacc5 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h | |||
| @@ -47,15 +47,9 @@ static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) | |||
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); | 49 | extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); |
| 50 | extern void free_pid_ns(struct kref *kref); | ||
| 51 | extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); | 50 | extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); |
| 52 | extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd); | 51 | extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd); |
| 53 | 52 | extern void put_pid_ns(struct pid_namespace *ns); | |
| 54 | static inline void put_pid_ns(struct pid_namespace *ns) | ||
| 55 | { | ||
| 56 | if (ns != &init_pid_ns) | ||
| 57 | kref_put(&ns->kref, free_pid_ns); | ||
| 58 | } | ||
| 59 | 53 | ||
| 60 | #else /* !CONFIG_PID_NS */ | 54 | #else /* !CONFIG_PID_NS */ |
| 61 | #include <linux/err.h> | 55 | #include <linux/err.h> |
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index 478bad2745e3..eb00be205811 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c | |||
| @@ -133,19 +133,26 @@ struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *old | |||
| 133 | return create_pid_namespace(old_ns); | 133 | return create_pid_namespace(old_ns); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | void free_pid_ns(struct kref *kref) | 136 | static void free_pid_ns(struct kref *kref) |
| 137 | { | 137 | { |
| 138 | struct pid_namespace *ns, *parent; | 138 | struct pid_namespace *ns; |
| 139 | 139 | ||
| 140 | ns = container_of(kref, struct pid_namespace, kref); | 140 | ns = container_of(kref, struct pid_namespace, kref); |
| 141 | |||
| 142 | parent = ns->parent; | ||
| 143 | destroy_pid_namespace(ns); | 141 | destroy_pid_namespace(ns); |
| 142 | } | ||
| 144 | 143 | ||
| 145 | if (parent != NULL) | 144 | void put_pid_ns(struct pid_namespace *ns) |
| 146 | put_pid_ns(parent); | 145 | { |
| 146 | struct pid_namespace *parent; | ||
| 147 | |||
| 148 | while (ns != &init_pid_ns) { | ||
| 149 | parent = ns->parent; | ||
| 150 | if (!kref_put(&ns->kref, free_pid_ns)) | ||
| 151 | break; | ||
| 152 | ns = parent; | ||
| 153 | } | ||
| 147 | } | 154 | } |
| 148 | EXPORT_SYMBOL_GPL(free_pid_ns); | 155 | EXPORT_SYMBOL_GPL(put_pid_ns); |
| 149 | 156 | ||
| 150 | void zap_pid_ns_processes(struct pid_namespace *pid_ns) | 157 | void zap_pid_ns_processes(struct pid_namespace *pid_ns) |
| 151 | { | 158 | { |
diff --git a/kernel/sys.c b/kernel/sys.c index c5cb5b99cb81..01865c6fb6a0 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
| @@ -1265,15 +1265,16 @@ DECLARE_RWSEM(uts_sem); | |||
| 1265 | * Work around broken programs that cannot handle "Linux 3.0". | 1265 | * Work around broken programs that cannot handle "Linux 3.0". |
| 1266 | * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 | 1266 | * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 |
| 1267 | */ | 1267 | */ |
| 1268 | static int override_release(char __user *release, int len) | 1268 | static int override_release(char __user *release, size_t len) |
| 1269 | { | 1269 | { |
| 1270 | int ret = 0; | 1270 | int ret = 0; |
| 1271 | char buf[65]; | ||
| 1272 | 1271 | ||
| 1273 | if (current->personality & UNAME26) { | 1272 | if (current->personality & UNAME26) { |
| 1274 | char *rest = UTS_RELEASE; | 1273 | const char *rest = UTS_RELEASE; |
| 1274 | char buf[65] = { 0 }; | ||
| 1275 | int ndots = 0; | 1275 | int ndots = 0; |
| 1276 | unsigned v; | 1276 | unsigned v; |
| 1277 | size_t copy; | ||
| 1277 | 1278 | ||
| 1278 | while (*rest) { | 1279 | while (*rest) { |
| 1279 | if (*rest == '.' && ++ndots >= 3) | 1280 | if (*rest == '.' && ++ndots >= 3) |
| @@ -1283,8 +1284,9 @@ static int override_release(char __user *release, int len) | |||
| 1283 | rest++; | 1284 | rest++; |
| 1284 | } | 1285 | } |
| 1285 | v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40; | 1286 | v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40; |
| 1286 | snprintf(buf, len, "2.6.%u%s", v, rest); | 1287 | copy = min(sizeof(buf), max_t(size_t, 1, len)); |
| 1287 | ret = copy_to_user(release, buf, len); | 1288 | copy = scnprintf(buf, copy, "2.6.%u%s", v, rest); |
| 1289 | ret = copy_to_user(release, buf, copy + 1); | ||
| 1288 | } | 1290 | } |
| 1289 | return ret; | 1291 | return ret; |
| 1290 | } | 1292 | } |
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index b9087bff008b..d84beb994f36 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
| @@ -264,7 +264,7 @@ static struct dma_debug_entry *__hash_bucket_find(struct hash_bucket *bucket, | |||
| 264 | match_fn match) | 264 | match_fn match) |
| 265 | { | 265 | { |
| 266 | struct dma_debug_entry *entry, *ret = NULL; | 266 | struct dma_debug_entry *entry, *ret = NULL; |
| 267 | int matches = 0, match_lvl, last_lvl = 0; | 267 | int matches = 0, match_lvl, last_lvl = -1; |
| 268 | 268 | ||
| 269 | list_for_each_entry(entry, &bucket->list, list) { | 269 | list_for_each_entry(entry, &bucket->list, list) { |
| 270 | if (!match(ref, entry)) | 270 | if (!match(ref, entry)) |
| @@ -293,7 +293,7 @@ static struct dma_debug_entry *__hash_bucket_find(struct hash_bucket *bucket, | |||
| 293 | } else if (match_lvl > last_lvl) { | 293 | } else if (match_lvl > last_lvl) { |
| 294 | /* | 294 | /* |
| 295 | * We found an entry that fits better then the | 295 | * We found an entry that fits better then the |
| 296 | * previous one | 296 | * previous one or it is the 1st match. |
| 297 | */ | 297 | */ |
| 298 | last_lvl = match_lvl; | 298 | last_lvl = match_lvl; |
| 299 | ret = entry; | 299 | ret = entry; |
diff --git a/mm/compaction.c b/mm/compaction.c index 2c4ce17651d8..9eef55838fca 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
| @@ -346,7 +346,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
| 346 | * pages requested were isolated. If there were any failures, 0 is | 346 | * pages requested were isolated. If there were any failures, 0 is |
| 347 | * returned and CMA will fail. | 347 | * returned and CMA will fail. |
| 348 | */ | 348 | */ |
| 349 | if (strict && nr_strict_required != total_isolated) | 349 | if (strict && nr_strict_required > total_isolated) |
| 350 | total_isolated = 0; | 350 | total_isolated = 0; |
| 351 | 351 | ||
| 352 | if (locked) | 352 | if (locked) |
