Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp445455pxb; Sat, 6 Mar 2021 05:06:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxiIUYFQZWHiYdgEuJpV31+kX0x34E0XxC6aqXHoxeUbSXGPmsaaKHtU6gU522XxFHXv3YH X-Received: by 2002:a17:906:c081:: with SMTP id f1mr6870262ejz.97.1615035981577; Sat, 06 Mar 2021 05:06:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615035981; cv=none; d=google.com; s=arc-20160816; b=u99VKuMWr1wQNbDEOqTmI6UuDbah84kShUEtYsD5f68yRD6Zsuv+H6WWquSib/34sJ embBHcakHDNObLwDg6jFSw66zgsj+0ztzeqkb/JB0gcjUA+StXVuga/IsQB0r1qXzlc+ 8IhJwzrHL7Q9+2s63Opp25JQTS7/yISBqDu6GlAfuUvciGoYw8KFvbAMx9PqWJX2xel9 HwzwLA5cpblpFUJD8paZXnB1ZlRmSvlsLyQayv244Z/Dgj5Vn0D0wJaIKh20TdXP9p7y 0v1b2n67uszwtBkRDA7CCBsnzdHhA6EcQXpzJlB5/yoLph6UImZbwStMeB9Pjw9QNsY5 ty6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=borX0+mAA6MXIi2VKQDK1EmdcPRQFgjcerjvurRRsPU=; b=dxn5ROg82ngnnE2i0BZwZB2WbXW+3odb1TFOpoejwfPd8+7n1sygcr4vIKopzFQHnw hvT3J45GNUUeAMKQBR5GSmlKdtN/xt5iqNpq1bM7YsdRWbkgusQvHbSdGEP28IaamU7L RyAIo1SnBi7NJm4fLXrML2bx9txKgNX5UseI2V1auDi4yQ4dJX9qkcBOwWrK07z/2wkH lhWGDAwlMPHoZ7aSDYT4jq3zfjcQnETJVLxczw0KP6M0xna0yQ5PM8vdKrdetAbt9AvI fyHaVNAyda+A7dEz3fWW4z5pVcet6GS0hOK7NYa6mx489QDbFbfScX8/IHlB0sdSu/qv 8J5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fF5KsTrR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l4si3090390eje.225.2021.03.06.05.05.58; Sat, 06 Mar 2021 05:06:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fF5KsTrR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230238AbhCFNFD (ORCPT + 99 others); Sat, 6 Mar 2021 08:05:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229888AbhCFNEb (ORCPT ); Sat, 6 Mar 2021 08:04:31 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8C63C06174A; Sat, 6 Mar 2021 05:04:31 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id t9so708572pjl.5; Sat, 06 Mar 2021 05:04:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=borX0+mAA6MXIi2VKQDK1EmdcPRQFgjcerjvurRRsPU=; b=fF5KsTrRZNNqioYREGJjOWFqLIawNtTGnd9ajFDo0g8L4jfweC01MB9citNaM/RDya ftJ6R8LcK3hEFLLm8Qt76of7XX/QXod1l9Iqr/BQI08lXG/1j0C4aZNqlaY60Mtw4LQq TphwQFnMfebA31zUWlOkrTemW7OdImvbCzQmo9VcIMtPlT02XNIzAP0+fFSnEn8MbpWO DwHW/IA/7KyEPupbeOziZTIsgtCd4t0k3dkkfKtB5d6qe21YHeB0VpV8x1jD/BpwmUkU ujSyFp0c81gFco3nZSHNxULf9psrBQedOceiKI4QYlAeA+jnaMpoMYNnnDzLsxFJbOya nvzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=borX0+mAA6MXIi2VKQDK1EmdcPRQFgjcerjvurRRsPU=; b=QRxywzjae9l9h7E/olE/P64NiZcADkMWdo3k9HucdxgKxQ7+X0X+8S0SdupdAiuNUX xXCm903h+EW6n6hI4Wvjmny9uT0KUd7NVN+RLnbFdx+vX+b2hivl85HSqr+lLagpbCzI 79lsJJcifDCAn+wPSgWo411aovUBxZlILFDe+npzVhDbh/sx0wLXNmGG41Q70yYtWX1N StN5rIx2qp/VbI6pnjG4bRshdYoP0SgKoDHcit0Uyd2a1amRdHmoAwpdFHw0Vt613OXy Hcw2rS9DF68xdMMVAqAAcnonh9YHtFodpIa0isR7+AIgMWrpH0f1yLimuv1H9n8f0+rU g94Q== X-Gm-Message-State: AOAM533BSLigmqwkuKgCIChF5QHA4SqwhK6CwdML+wZS8CBet2h0cIdu lCdc0uRk4wYZKYT0PhFXg00= X-Received: by 2002:a17:90a:5501:: with SMTP id b1mr15666224pji.57.1615035871079; Sat, 06 Mar 2021 05:04:31 -0800 (PST) Received: from localhost.localdomain ([45.135.186.66]) by smtp.gmail.com with ESMTPSA id j20sm5568570pjn.27.2021.03.06.05.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 05:04:30 -0800 (PST) From: Jia-Ju Bai 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 Subject: [PATCH] security: tomoyo: fix error return code of tomoyo_update_domain() Date: Sat, 6 Mar 2021 05:03:46 -0800 Message-Id: <20210306130346.16296-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Jia-Ju Bai --- 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