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
This commit is contained in:
Linus Torvalds 2012-10-19 14:07:55 -07:00
commit 4a1f2b0fba
8 changed files with 31 additions and 27 deletions

View file

@ -237,7 +237,7 @@ static ssize_t memmap_attr_show(struct kobject *kobj,
* firmware_map_add() or firmware_map_add_early() afterwards, the entries * firmware_map_add() or firmware_map_add_early() afterwards, the entries
* are not added to sysfs. * are not added to sysfs.
*/ */
static int __init memmap_init(void) static int __init firmware_memmap_init(void)
{ {
struct firmware_map_entry *entry; struct firmware_map_entry *entry;
@ -246,5 +246,5 @@ static int __init memmap_init(void)
return 0; return 0;
} }
late_initcall(memmap_init); late_initcall(firmware_memmap_init);

View file

@ -206,11 +206,11 @@ static ssize_t lm3639_bled_mode_store(struct device *dev,
out: out:
dev_err(pchip->dev, "%s:i2c access fail to register\n", __func__); dev_err(pchip->dev, "%s:i2c access fail to register\n", __func__);
return size; return ret;
out_input: out_input:
dev_err(pchip->dev, "%s:input conversion fail\n", __func__); dev_err(pchip->dev, "%s:input conversion fail\n", __func__);
return size; return ret;
} }

View file

@ -4,6 +4,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <asm/siginfo.h>
/* /*
* These are the only things you should do on a core-file: use only these * These are the only things you should do on a core-file: use only these

View file

@ -47,15 +47,9 @@ static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
} }
extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
extern void free_pid_ns(struct kref *kref);
extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd); extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd);
extern void put_pid_ns(struct pid_namespace *ns);
static inline void put_pid_ns(struct pid_namespace *ns)
{
if (ns != &init_pid_ns)
kref_put(&ns->kref, free_pid_ns);
}
#else /* !CONFIG_PID_NS */ #else /* !CONFIG_PID_NS */
#include <linux/err.h> #include <linux/err.h>

View file

@ -133,19 +133,26 @@ struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *old
return create_pid_namespace(old_ns); return create_pid_namespace(old_ns);
} }
void free_pid_ns(struct kref *kref) static void free_pid_ns(struct kref *kref)
{ {
struct pid_namespace *ns, *parent; struct pid_namespace *ns;
ns = container_of(kref, struct pid_namespace, kref); ns = container_of(kref, struct pid_namespace, kref);
parent = ns->parent;
destroy_pid_namespace(ns); destroy_pid_namespace(ns);
if (parent != NULL)
put_pid_ns(parent);
} }
EXPORT_SYMBOL_GPL(free_pid_ns);
void put_pid_ns(struct pid_namespace *ns)
{
struct pid_namespace *parent;
while (ns != &init_pid_ns) {
parent = ns->parent;
if (!kref_put(&ns->kref, free_pid_ns))
break;
ns = parent;
}
}
EXPORT_SYMBOL_GPL(put_pid_ns);
void zap_pid_ns_processes(struct pid_namespace *pid_ns) void zap_pid_ns_processes(struct pid_namespace *pid_ns)
{ {

View file

@ -1265,15 +1265,16 @@ DECLARE_RWSEM(uts_sem);
* Work around broken programs that cannot handle "Linux 3.0". * Work around broken programs that cannot handle "Linux 3.0".
* Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40
*/ */
static int override_release(char __user *release, int len) static int override_release(char __user *release, size_t len)
{ {
int ret = 0; int ret = 0;
char buf[65];
if (current->personality & UNAME26) { if (current->personality & UNAME26) {
char *rest = UTS_RELEASE; const char *rest = UTS_RELEASE;
char buf[65] = { 0 };
int ndots = 0; int ndots = 0;
unsigned v; unsigned v;
size_t copy;
while (*rest) { while (*rest) {
if (*rest == '.' && ++ndots >= 3) if (*rest == '.' && ++ndots >= 3)
@ -1283,8 +1284,9 @@ static int override_release(char __user *release, int len)
rest++; rest++;
} }
v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40; v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40;
snprintf(buf, len, "2.6.%u%s", v, rest); copy = min(sizeof(buf), max_t(size_t, 1, len));
ret = copy_to_user(release, buf, len); copy = scnprintf(buf, copy, "2.6.%u%s", v, rest);
ret = copy_to_user(release, buf, copy + 1);
} }
return ret; return ret;
} }

View file

@ -264,7 +264,7 @@ static struct dma_debug_entry *__hash_bucket_find(struct hash_bucket *bucket,
match_fn match) match_fn match)
{ {
struct dma_debug_entry *entry, *ret = NULL; struct dma_debug_entry *entry, *ret = NULL;
int matches = 0, match_lvl, last_lvl = 0; int matches = 0, match_lvl, last_lvl = -1;
list_for_each_entry(entry, &bucket->list, list) { list_for_each_entry(entry, &bucket->list, list) {
if (!match(ref, entry)) if (!match(ref, entry))
@ -293,7 +293,7 @@ static struct dma_debug_entry *__hash_bucket_find(struct hash_bucket *bucket,
} else if (match_lvl > last_lvl) { } else if (match_lvl > last_lvl) {
/* /*
* We found an entry that fits better then the * We found an entry that fits better then the
* previous one * previous one or it is the 1st match.
*/ */
last_lvl = match_lvl; last_lvl = match_lvl;
ret = entry; ret = entry;

View file

@ -346,7 +346,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
* pages requested were isolated. If there were any failures, 0 is * pages requested were isolated. If there were any failures, 0 is
* returned and CMA will fail. * returned and CMA will fail.
*/ */
if (strict && nr_strict_required != total_isolated) if (strict && nr_strict_required > total_isolated)
total_isolated = 0; total_isolated = 0;
if (locked) if (locked)