Skip to content

Commit

Permalink
Merge branch 'akpm' (Fixes from Andrew)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
torvalds committed Oct 19, 2012
2 parents deb521c + fe73fbe commit 4a1f2b0
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 26 deletions.
4 changes: 2 additions & 2 deletions drivers/firmware/memmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ static ssize_t memmap_attr_show(struct kobject *kobj,
* firmware_map_add() or firmware_map_add_early() afterwards, the entries
* are not added to sysfs.
*/
static int __init memmap_init(void)
static int __init firmware_memmap_init(void)
{
struct firmware_map_entry *entry;

Expand All @@ -246,5 +246,5 @@ static int __init memmap_init(void)

return 0;
}
late_initcall(memmap_init);
late_initcall(firmware_memmap_init);

4 changes: 2 additions & 2 deletions drivers/video/backlight/lm3639_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ static ssize_t lm3639_bled_mode_store(struct device *dev,

out:
dev_err(pchip->dev, "%s:i2c access fail to register\n", __func__);
return size;
return ret;

out_input:
dev_err(pchip->dev, "%s:input conversion fail\n", __func__);
return size;
return ret;

}

Expand Down
1 change: 1 addition & 0 deletions include/linux/coredump.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <asm/siginfo.h>

/*
* These are the only things you should do on a core-file: use only these
Expand Down
8 changes: 1 addition & 7 deletions include/linux/pid_namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 void free_pid_ns(struct kref *kref);
extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd);

static inline void put_pid_ns(struct pid_namespace *ns)
{
if (ns != &init_pid_ns)
kref_put(&ns->kref, free_pid_ns);
}
extern void put_pid_ns(struct pid_namespace *ns);

#else /* !CONFIG_PID_NS */
#include <linux/err.h>
Expand Down
21 changes: 14 additions & 7 deletions kernel/pid_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,26 @@ struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *old
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);

parent = ns->parent;
destroy_pid_namespace(ns);
}

if (parent != NULL)
put_pid_ns(parent);
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(free_pid_ns);
EXPORT_SYMBOL_GPL(put_pid_ns);

void zap_pid_ns_processes(struct pid_namespace *pid_ns)
{
Expand Down
12 changes: 7 additions & 5 deletions kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1265,15 +1265,16 @@ DECLARE_RWSEM(uts_sem);
* 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
*/
static int override_release(char __user *release, int len)
static int override_release(char __user *release, size_t len)
{
int ret = 0;
char buf[65];

if (current->personality & UNAME26) {
char *rest = UTS_RELEASE;
const char *rest = UTS_RELEASE;
char buf[65] = { 0 };
int ndots = 0;
unsigned v;
size_t copy;

while (*rest) {
if (*rest == '.' && ++ndots >= 3)
Expand All @@ -1283,8 +1284,9 @@ static int override_release(char __user *release, int len)
rest++;
}
v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40;
snprintf(buf, len, "2.6.%u%s", v, rest);
ret = copy_to_user(release, buf, len);
copy = min(sizeof(buf), max_t(size_t, 1, len));
copy = scnprintf(buf, copy, "2.6.%u%s", v, rest);
ret = copy_to_user(release, buf, copy + 1);
}
return ret;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/dma-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ static struct dma_debug_entry *__hash_bucket_find(struct hash_bucket *bucket,
match_fn match)
{
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) {
if (!match(ref, entry))
Expand Down Expand Up @@ -293,7 +293,7 @@ static struct dma_debug_entry *__hash_bucket_find(struct hash_bucket *bucket,
} else if (match_lvl > last_lvl) {
/*
* We found an entry that fits better then the
* previous one
* previous one or it is the 1st match.
*/
last_lvl = match_lvl;
ret = entry;
Expand Down
2 changes: 1 addition & 1 deletion mm/compaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* returned and CMA will fail.
*/
if (strict && nr_strict_required != total_isolated)
if (strict && nr_strict_required > total_isolated)
total_isolated = 0;

if (locked)
Expand Down

0 comments on commit 4a1f2b0

Please sign in to comment.