diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2019-10-04 14:46:24 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-10-14 08:56:16 -0700 |
commit | 2abd839aa7e615f2bbc50c8ba7deb9e40d186768 (patch) | |
tree | 1e72fe29e969967bfdbf547edc1f98ff8a1002fd /block/sed-opal.c | |
parent | 4f5cafb5cb8471e54afdc9054d973535614f7675 (diff) | |
download | linux-2abd839aa7e615f2bbc50c8ba7deb9e40d186768.tar.bz2 |
kmemleak: Do not corrupt the object_list during clean-up
In case of an error (e.g. memory pool too small), kmemleak disables
itself and cleans up the already allocated metadata objects. However, if
this happens early before the RCU callback mechanism is available,
put_object() skips call_rcu() and frees the object directly. This is not
safe with the RCU list traversal in __kmemleak_do_cleanup().
Change the list traversal in __kmemleak_do_cleanup() to
list_for_each_entry_safe() and remove the rcu_read_{lock,unlock} since
the kmemleak is already disabled at this point. In addition, avoid an
unnecessary metadata object rb-tree look-up since it already has the
struct kmemleak_object pointer.
Fixes: c5665868183f ("mm: kmemleak: use the memory pool for early allocations")
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reported-by: Marc Dionne <marc.c.dionne@gmail.com>
Reported-by: Ted Ts'o <tytso@mit.edu>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'block/sed-opal.c')
0 files changed, 0 insertions, 0 deletions