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]
Message-Id: <20210306130346.16296-1-baijiaju1990@gmail.com>
Date:   Sat,  6 Mar 2021 05:03:46 -0800
From:   Jia-Ju Bai <baijiaju1990@...il.com>
To:     takedakn@...data.co.jp, penguin-kernel@...ove.SAKURA.ne.jp,
        jmorris@...ei.org, serge@...lyn.com
Cc:     linux-security-module@...r.kernel.org,
        linux-kernel@...r.kernel.org, Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH] security: tomoyo: fix error return code of tomoyo_update_domain()

When mutex_lock_interruptible() fails, the error return code of
tomoyo_update_domain() is not properly assigned.
To fix this bug, error is assigned with the return value of
mutex_lock_interruptible(), and then error is checked.

Reported-by: TOTE Robot <oslab@...nghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
---
 security/tomoyo/domain.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/security/tomoyo/domain.c b/security/tomoyo/domain.c
index 98d985895ec8..7b9f9664dbe3 100644
--- a/security/tomoyo/domain.c
+++ b/security/tomoyo/domain.c
@@ -118,7 +118,8 @@ int tomoyo_update_domain(struct tomoyo_acl_info *new_entry, const int size,
 		      ->perm == 1 << TOMOYO_TYPE_EXECUTE))
 			goto out;
 	}
-	if (mutex_lock_interruptible(&tomoyo_policy_lock))
+	error = mutex_lock_interruptible(&tomoyo_policy_lock);
+	if (error)
 		goto out;
 	list_for_each_entry_rcu(entry, list, list,
 				srcu_read_lock_held(&tomoyo_ss)) {
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ