summaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2015-06-25 01:58:26 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-25 02:49:45 +0200
commitc5f3b1a51a591c18c8b33983908e7fdda6ae417e (patch)
tree0d09a41d69729eccedba223f9b9f4db36c88768b /drivers/ata/libata-eh.c
parentmemcg: convert mem_cgroup->under_oom from atomic_t to int (diff)
downloadlinux-c5f3b1a51a591c18c8b33983908e7fdda6ae417e.tar.xz
linux-c5f3b1a51a591c18c8b33983908e7fdda6ae417e.zip
mm: kmemleak: allow safe memory scanning during kmemleak disabling
The kmemleak scanning thread can run for minutes. Callbacks like kmemleak_free() are allowed during this time, the race being taken care of by the object->lock spinlock. Such lock also prevents a memory block from being freed or unmapped while it is being scanned by blocking the kmemleak_free() -> ... -> __delete_object() function until the lock is released in scan_object(). When a kmemleak error occurs (e.g. it fails to allocate its metadata), kmemleak_enabled is set and __delete_object() is no longer called on freed objects. If kmemleak_scan is running at the same time, kmemleak_free() no longer waits for the object scanning to complete, allowing the corresponding memory block to be freed or unmapped (in the case of vfree()). This leads to kmemleak_scan potentially triggering a page fault. This patch separates the kmemleak_free() enabling/disabling from the overall kmemleak_enabled nob so that we can defer the disabling of the object freeing tracking until the scanning thread completed. The kmemleak_free_part() is deliberately ignored by this patch since this is only called during boot before the scanning thread started. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Reported-by: Vignesh Radhakrishnan <vigneshr@codeaurora.org> Tested-by: Vignesh Radhakrishnan <vigneshr@codeaurora.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/ata/libata-eh.c')
0 files changed, 0 insertions, 0 deletions