Skip to content

Commit c495682

Browse files
KAGA-KOKOtorvalds
authored andcommitted
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>
1 parent 4d6c13f commit c495682

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎mm/dmapool.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ show_pools(struct device *dev, struct device_attribute *attr, char *buf)
8686
unsigned pages = 0;
8787
unsigned blocks = 0;
8888

89+
spin_lock_irq(&pool->lock);
8990
list_for_each_entry(page, &pool->page_list, page_list) {
9091
pages++;
9192
blocks += page->in_use;
9293
}
94+
spin_unlock_irq(&pool->lock);
9395

9496
/* per-pool info, no real statistics yet */
9597
temp = scnprintf(next, size, "%-16s %4u %4Zu %4Zu %2u\n",

0 commit comments

Comments
 (0)