mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 03:50:24 +09:00
ANDROID: mm: fix incorrect unlock mmap_lock for speculative swap fault
In a20b68c396127cd6387f37845c5bc05e44e2fd0e, SPF is supported for swap fault. But in __lock_page_or_retry(), it will unlock mmap_lock unconditionally. That will cause unpaired lock release in handling SPF. Bug: 333508035 Change-Id: Ia1da66c85e0d58883cf518f10cd33fc5cad387b8 Signed-off-by: Oven <liyangouwen1@oppo.com> (cherry picked from commit 63070883166ae63620a87d958319deba86f236ae)
This commit is contained in:
@@ -1710,7 +1710,8 @@ __sched int __lock_page_or_retry(struct page *page, struct mm_struct *mm,
|
||||
if (flags & FAULT_FLAG_RETRY_NOWAIT)
|
||||
return 0;
|
||||
|
||||
mmap_read_unlock(mm);
|
||||
if (!(flags & FAULT_FLAG_SPECULATIVE))
|
||||
mmap_read_unlock(mm);
|
||||
if (flags & FAULT_FLAG_KILLABLE)
|
||||
wait_on_page_locked_killable(page);
|
||||
else
|
||||
@@ -1722,7 +1723,8 @@ __sched int __lock_page_or_retry(struct page *page, struct mm_struct *mm,
|
||||
|
||||
ret = __lock_page_killable(page);
|
||||
if (ret) {
|
||||
mmap_read_unlock(mm);
|
||||
if (!(flags & FAULT_FLAG_SPECULATIVE))
|
||||
mmap_read_unlock(mm);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user