Skip to content

Commit 6840f90

Browse files
author
Matthew Wilcox (Oracle)
committed
pagevec: Initialise folio_batch->percpu_pvec_drained
When UBSAN is enabled, it reports an invalid value in __pagevec_release() when accessing pvec->percpu_pvec_drained, which is simply whatever garbage was on the stack. Initialise it when initialising the rest of the folio_batch. Fixes: 1033179 ("pagevec: Add folio_batch") Reported-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
1 parent 455e73a commit 6840f90

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

include/linux/pagevec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ static_assert(offsetof(struct pagevec, pages) ==
111111
static inline void folio_batch_init(struct folio_batch *fbatch)
112112
{
113113
fbatch->nr = 0;
114+
fbatch->percpu_pvec_drained = false;
114115
}
115116

116117
static inline unsigned int folio_batch_count(struct folio_batch *fbatch)

0 commit comments

Comments
 (0)