linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, jmorris@namei.org,
	serge@hallyn.com
Subject: Re: [PATCH] security: tomoyo: fix error return code of tomoyo_update_domain()
Date: Sat, 6 Mar 2021 22:37:49 +0900	[thread overview]
Message-ID: <79dd201e-ea6e-8de5-6250-25c23453448d@i-love.sakura.ne.jp> (raw)
In-Reply-To: <20210306130346.16296-1-baijiaju1990@gmail.com>

On 2021/03/06 22:03, Jia-Ju Bai wrote:
> 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.

Thanks for a patch, but this patch is wrong.
Since the variable "error" is initialized as

  int error = is_delete ? -ENOENT : -ENOMEM;

at the beginning of this function, unconditionally overwriting
this variable with the return code of mutex_lock_interruptible() breaks

  if (error && !is_delete) {
  }

block of this function.

And the caller does not check if the return code is -EINTR
instead of -ENOENT or -ENOMEM.

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

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

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=79dd201e-ea6e-8de5-6250-25c23453448d@i-love.sakura.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --cc=baijiaju1990@gmail.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.com \
    /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).