https://github.com/torvalds/linux
Revision 678ff6a7afccc43d352c1b8c94b6d8c0ee1464ad authored by Shakeel Butt on 26 September 2020, 14:13:41 UTC, committed by Linus Torvalds on 26 September 2020, 17:15:01 UTC
With the commit 10befea91b61 ("mm: memcg/slab: use a single set of kmem_caches for all allocations"), it becomes possible to call kfree() from the slabs_destroy(). The functions cache_flusharray() and do_drain() calls slabs_destroy() on array_cache of the local CPU without updating the size of the array_cache. This enables the kfree() call from the slabs_destroy() to recursively call cache_flusharray() which can potentially call free_block() on the same elements of the array_cache of the local CPU and causing double free and memory corruption. To fix the issue, simply update the local CPU array_cache cache before calling slabs_destroy(). Fixes: 10befea91b61 ("mm: memcg/slab: use a single set of kmem_caches for all allocations") Signed-off-by: Shakeel Butt <shakeelb@google.com> Reviewed-by: Roman Gushchin <guro@fb.com> Tested-by: Ming Lei <ming.lei@redhat.com> Reported-by: kernel test robot <rong.a.chen@intel.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Ted Ts'o <tytso@mit.edu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7c7ec32
Tip revision: 678ff6a7afccc43d352c1b8c94b6d8c0ee1464ad authored by Shakeel Butt on 26 September 2020, 14:13:41 UTC
mm: slab: fix potential double free in ___cache_free
mm: slab: fix potential double free in ___cache_free
Tip revision: 678ff6a
File | Mode | Size |
---|---|---|
accounting | ||
arch | ||
bootconfig | ||
bpf | ||
build | ||
cgroup | ||
debugging | ||
edid | ||
firewire | ||
firmware | ||
gpio | ||
hv | ||
iio | ||
include | ||
io_uring | ||
kvm | ||
laptop | ||
leds | ||
lib | ||
memory-model | ||
nfsd | ||
objtool | ||
pci | ||
pcmcia | ||
perf | ||
power | ||
scripts | ||
spi | ||
testing | ||
thermal | ||
time | ||
usb | ||
virtio | ||
vm | ||
wmi | ||
Makefile | -rw-r--r-- | 6.1 KB |
Computing file changes ...