]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
XArray: Fix xa_release in allocating arrays
authorMatthew Wilcox <willy@infradead.org>
Wed, 20 Feb 2019 16:30:49 +0000 (11:30 -0500)
committerMatthew Wilcox <willy@infradead.org>
Wed, 20 Feb 2019 22:08:54 +0000 (17:08 -0500)
commitb38f6c50270683abf35a388f82cafecce971a003
tree0db0d39cf82d0f1996b28056668ebeabc8e58add
parentf818b82b80164014d7ee3df89bb110808778c796
XArray: Fix xa_release in allocating arrays

xa_cmpxchg() was a little too magic in turning ZERO entries into NULL,
and would leave the entry set to the ZERO entry instead of releasing
it for future use.  After careful review of existing users of
xa_cmpxchg(), change the semantics so that it does not translate either
incoming argument from NULL into ZERO entries.

Add several tests to the test-suite to make sure this problem doesn't
come back.

Reported-by: Jason Gunthorpe <jgg@ziepe.ca>
Signed-off-by: Matthew Wilcox <willy@infradead.org>
include/linux/xarray.h
lib/test_xarray.c
lib/xarray.c