diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2010-01-08 17:42:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-01-11 12:34:04 -0500 |
commit | 129182e5626972ac0df85d43a36dd46ad61c64e1 (patch) | |
tree | c91d17c697aa29d284dbe065423e01ca7020db73 /mm/percpu.c | |
parent | 8767ba2796a1c894e6d9524584a26a8224f0543d (diff) |
percpu: avoid calling __pcpu_ptr_to_addr(NULL)
__pcpu_ptr_to_addr() can be overridden by the architecture and might not
behave well if passed a NULL pointer. So avoid calling it until we have
verified that its arg is not NULL.
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/percpu.c')
-rw-r--r-- | mm/percpu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/percpu.c b/mm/percpu.c index 442010cc91c6..083e7c91e5f6 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
@@ -1271,7 +1271,7 @@ static void pcpu_reclaim(struct work_struct *work) | |||
1271 | */ | 1271 | */ |
1272 | void free_percpu(void *ptr) | 1272 | void free_percpu(void *ptr) |
1273 | { | 1273 | { |
1274 | void *addr = __pcpu_ptr_to_addr(ptr); | 1274 | void *addr; |
1275 | struct pcpu_chunk *chunk; | 1275 | struct pcpu_chunk *chunk; |
1276 | unsigned long flags; | 1276 | unsigned long flags; |
1277 | int off; | 1277 | int off; |
@@ -1279,6 +1279,8 @@ void free_percpu(void *ptr) | |||
1279 | if (!ptr) | 1279 | if (!ptr) |
1280 | return; | 1280 | return; |
1281 | 1281 | ||
1282 | addr = __pcpu_ptr_to_addr(ptr); | ||
1283 | |||
1282 | spin_lock_irqsave(&pcpu_lock, flags); | 1284 | spin_lock_irqsave(&pcpu_lock, flags); |
1283 | 1285 | ||
1284 | chunk = pcpu_chunk_addr_search(addr); | 1286 | chunk = pcpu_chunk_addr_search(addr); |