Commit 83c11588 authored by Andrew Morton's avatar Andrew Morton Committed by james toy

__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>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent db014b1d
...@@ -1230,7 +1230,7 @@ static void pcpu_reclaim(struct work_struct *work) ...@@ -1230,7 +1230,7 @@ static void pcpu_reclaim(struct work_struct *work)
*/ */
void free_percpu(void *ptr) void free_percpu(void *ptr)
{ {
void *addr = __pcpu_ptr_to_addr(ptr); void *addr;
struct pcpu_chunk *chunk; struct pcpu_chunk *chunk;
unsigned long flags; unsigned long flags;
int off; int off;
...@@ -1238,6 +1238,8 @@ void free_percpu(void *ptr) ...@@ -1238,6 +1238,8 @@ void free_percpu(void *ptr)
if (!ptr) if (!ptr)
return; return;
addr = __pcpu_ptr_to_addr(ptr);
spin_lock_irqsave(&pcpu_lock, flags); spin_lock_irqsave(&pcpu_lock, flags);
chunk = pcpu_chunk_addr_search(addr); chunk = pcpu_chunk_addr_search(addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment