linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: takedakn@nttdata.co.jp, penguin-kernel@I-love.SAKURA.ne.jp,
	jmorris@namei.org, serge@hallyn.com
Cc: linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, Jia-Ju Bai <baijiaju1990@gmail.com>
Subject: [PATCH] security: tomoyo: fix error return code of tomoyo_update_domain()
Date: Sat,  6 Mar 2021 05:03:46 -0800	[thread overview]
Message-ID: <20210306130346.16296-1-baijiaju1990@gmail.com> (raw)

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@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.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


             reply	other threads:[~2021-03-06 13:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-06 13:03 Jia-Ju Bai [this message]
2021-03-06 13:37 ` [PATCH] security: tomoyo: fix error return code of tomoyo_update_domain() Tetsuo Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210306130346.16296-1-baijiaju1990@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=serge@hallyn.com \
    --cc=takedakn@nttdata.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).