]> git.baikalelectronics.ru Git - kernel.git/commit
XArray: Fix infinite loop with entry at ULONG_MAX
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 17 Jan 2020 22:45:12 +0000 (17:45 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 18 Jan 2020 03:32:24 +0000 (22:32 -0500)
commit8e77e93307213b65e325939ceee8109ef18c7856
tree7a23f31ee6f3bca6a09e1ce0c23fa62d4e65c5e1
parenta1aa90b8999e7bb92fae70f15bcdbc9f23e62487
XArray: Fix infinite loop with entry at ULONG_MAX

If there is an entry at ULONG_MAX, xa_for_each() will overflow the
'index + 1' in xa_find_after() and wrap around to 0.  Catch this case
and terminate the loop by returning NULL.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: stable@vger.kernel.org
lib/test_xarray.c
lib/xarray.c