Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmapools: protect page_list walk in show_pools()

show_pools() walks the page_list of a pool w/o protection against the list
modifications in alloc/free. Take pool->lock to avoid stomping into
nirvana.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Thomas Gleixner and committed by
Linus Torvalds
c4956823 4d6c13f8

+2
+2
mm/dmapool.c
··· 86 86 unsigned pages = 0; 87 87 unsigned blocks = 0; 88 88 89 + spin_lock_irq(&pool->lock); 89 90 list_for_each_entry(page, &pool->page_list, page_list) { 90 91 pages++; 91 92 blocks += page->in_use; 92 93 } 94 + spin_unlock_irq(&pool->lock); 93 95 94 96 /* per-pool info, no real statistics yet */ 95 97 temp = scnprintf(next, size, "%-16s %4u %4Zu %4Zu %2u\n",