lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 18 Jun 2022 16:38:20 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     <akpm@...ux-foundation.org>, <willy@...radead.org>
CC:     <linux-fsdevel@...r.kernel.org>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>, <linmiaohe@...wei.com>
Subject: [PATCH] filemap: obey mapping->invalidate_lock lock/unlock order

The invalidate_locks of two mappings should be unlocked in reverse order
relative to the locking order in filemap_invalidate_lock_two(). Modifying
the code to obey it.

Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
 mm/filemap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/filemap.c b/mm/filemap.c
index 8ef861297ffb..9948b26e6400 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1009,6 +1009,8 @@ EXPORT_SYMBOL(filemap_invalidate_lock_two);
 void filemap_invalidate_unlock_two(struct address_space *mapping1,
 				   struct address_space *mapping2)
 {
+	if (mapping1 < mapping2)
+		swap(mapping1, mapping2);
 	if (mapping1)
 		up_write(&mapping1->invalidate_lock);
 	if (mapping2 && mapping1 != mapping2)
-- 
2.23.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ