diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-17 09:04:38 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-17 09:04:38 -0400 |
| commit | 54e514b91b95d6441c12a7955addfb9f9d2afc65 (patch) | |
| tree | 8b73d901bd2a6ec5a31f34a8954e5ea92216dd6c /kernel/pid.c | |
| parent | 4fc8adcfec3da639da76e8314c9ccefe5bf9a045 (diff) | |
| parent | 6c8c90319c0bb1c9e0b68e721359b89ae4f28465 (diff) | |
Merge branch 'akpm' (patches from Andrew)
Merge third patchbomb from Andrew Morton:
- various misc things
- a couple of lib/ optimisations
- provide DIV_ROUND_CLOSEST_ULL()
- checkpatch updates
- rtc tree
- befs, nilfs2, hfs, hfsplus, fatfs, adfs, affs, bfs
- ptrace fixes
- fork() fixes
- seccomp cleanups
- more mmap_sem hold time reductions from Davidlohr
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (138 commits)
proc: show locks in /proc/pid/fdinfo/X
docs: add missing and new /proc/PID/status file entries, fix typos
drivers/rtc/rtc-at91rm9200.c: make IO endian agnostic
Documentation/spi/spidev_test.c: fix warning
drivers/rtc/rtc-s5m.c: allow usage on device type different than main MFD type
.gitignore: ignore *.tar
MAINTAINERS: add Mediatek SoC mailing list
tomoyo: reduce mmap_sem hold for mm->exe_file
powerpc/oprofile: reduce mmap_sem hold for exe_file
oprofile: reduce mmap_sem hold for mm->exe_file
mips: ip32: add platform data hooks to use DS1685 driver
lib/Kconfig: fix up HAVE_ARCH_BITREVERSE help text
x86: switch to using asm-generic for seccomp.h
sparc: switch to using asm-generic for seccomp.h
powerpc: switch to using asm-generic for seccomp.h
parisc: switch to using asm-generic for seccomp.h
mips: switch to using asm-generic for seccomp.h
microblaze: use asm-generic for seccomp.h
arm: use asm-generic for seccomp.h
seccomp: allow COMPAT sigreturn overrides
...
Diffstat (limited to 'kernel/pid.c')
| -rw-r--r-- | kernel/pid.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/pid.c b/kernel/pid.c index cd36a5e0d173..4fd07d5b7baf 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
| @@ -182,7 +182,7 @@ static int alloc_pidmap(struct pid_namespace *pid_ns) | |||
| 182 | spin_unlock_irq(&pidmap_lock); | 182 | spin_unlock_irq(&pidmap_lock); |
| 183 | kfree(page); | 183 | kfree(page); |
| 184 | if (unlikely(!map->page)) | 184 | if (unlikely(!map->page)) |
| 185 | break; | 185 | return -ENOMEM; |
| 186 | } | 186 | } |
| 187 | if (likely(atomic_read(&map->nr_free))) { | 187 | if (likely(atomic_read(&map->nr_free))) { |
| 188 | for ( ; ; ) { | 188 | for ( ; ; ) { |
| @@ -210,7 +210,7 @@ static int alloc_pidmap(struct pid_namespace *pid_ns) | |||
| 210 | } | 210 | } |
| 211 | pid = mk_pid(pid_ns, map, offset); | 211 | pid = mk_pid(pid_ns, map, offset); |
| 212 | } | 212 | } |
| 213 | return -1; | 213 | return -EAGAIN; |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | int next_pidmap(struct pid_namespace *pid_ns, unsigned int last) | 216 | int next_pidmap(struct pid_namespace *pid_ns, unsigned int last) |
| @@ -301,17 +301,20 @@ struct pid *alloc_pid(struct pid_namespace *ns) | |||
| 301 | int i, nr; | 301 | int i, nr; |
| 302 | struct pid_namespace *tmp; | 302 | struct pid_namespace *tmp; |
| 303 | struct upid *upid; | 303 | struct upid *upid; |
| 304 | int retval = -ENOMEM; | ||
| 304 | 305 | ||
| 305 | pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL); | 306 | pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL); |
| 306 | if (!pid) | 307 | if (!pid) |
| 307 | goto out; | 308 | return ERR_PTR(retval); |
| 308 | 309 | ||
| 309 | tmp = ns; | 310 | tmp = ns; |
| 310 | pid->level = ns->level; | 311 | pid->level = ns->level; |
| 311 | for (i = ns->level; i >= 0; i--) { | 312 | for (i = ns->level; i >= 0; i--) { |
| 312 | nr = alloc_pidmap(tmp); | 313 | nr = alloc_pidmap(tmp); |
| 313 | if (nr < 0) | 314 | if (IS_ERR_VALUE(nr)) { |
| 315 | retval = nr; | ||
| 314 | goto out_free; | 316 | goto out_free; |
| 317 | } | ||
| 315 | 318 | ||
| 316 | pid->numbers[i].nr = nr; | 319 | pid->numbers[i].nr = nr; |
| 317 | pid->numbers[i].ns = tmp; | 320 | pid->numbers[i].ns = tmp; |
| @@ -339,7 +342,6 @@ struct pid *alloc_pid(struct pid_namespace *ns) | |||
| 339 | } | 342 | } |
| 340 | spin_unlock_irq(&pidmap_lock); | 343 | spin_unlock_irq(&pidmap_lock); |
| 341 | 344 | ||
| 342 | out: | ||
| 343 | return pid; | 345 | return pid; |
| 344 | 346 | ||
| 345 | out_unlock: | 347 | out_unlock: |
| @@ -351,8 +353,7 @@ out_free: | |||
| 351 | free_pidmap(pid->numbers + i); | 353 | free_pidmap(pid->numbers + i); |
| 352 | 354 | ||
| 353 | kmem_cache_free(ns->pid_cachep, pid); | 355 | kmem_cache_free(ns->pid_cachep, pid); |
| 354 | pid = NULL; | 356 | return ERR_PTR(retval); |
| 355 | goto out; | ||
| 356 | } | 357 | } |
| 357 | 358 | ||
| 358 | void disable_pid_allocation(struct pid_namespace *ns) | 359 | void disable_pid_allocation(struct pid_namespace *ns) |
