From patchwork Wed Jul 26 07:39:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roberto Sassu X-Patchwork-Id: 13327555 X-Patchwork-Delegate: paul@paul-moore.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E973C00528 for ; Wed, 26 Jul 2023 07:44:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232297AbjGZHo3 (ORCPT ); Wed, 26 Jul 2023 03:44:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230140AbjGZHnx (ORCPT ); Wed, 26 Jul 2023 03:43:53 -0400 Received: from frasgout11.his.huawei.com (unknown [14.137.139.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 580D244B6; Wed, 26 Jul 2023 00:39:32 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.18.147.227]) by frasgout11.his.huawei.com (SkyGuard) with ESMTP id 4R9lqX53bRz9v7VL; Wed, 26 Jul 2023 15:28:08 +0800 (CST) Received: from huaweicloud.com (unknown [10.204.63.22]) by APP2 (Coremail) with SMTP id GxC2BwA3CmGhzcBkURUHBQ--.31802S2; Wed, 26 Jul 2023 08:39:19 +0100 (CET) From: Roberto Sassu To: paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Roberto Sassu Subject: [PATCH v2] security: Fix ret values doc for security_inode_init_security() Date: Wed, 26 Jul 2023 09:39:05 +0200 Message-Id: <20230726073905.1175826-1-roberto.sassu@huaweicloud.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CM-TRANSID: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or3voofrz/1tbiAQAKBF1jj5DyKwAAs3 X-CFilter-Loop: Reflected Precedence: bulk List-ID: From: Roberto Sassu Commit 6bcdfd2cac55 ("security: Allow all LSMs to provide xattrs for inode_init_security hook") unified the !initxattrs and initxattrs cases. By doing that, security_inode_init_security() cannot return -EOPNOTSUPP anymore, as it is always replaced with zero at the end of the function. Also, mentioning -ENOMEM as the only possible error is not correct. For example, evm_inode_init_security() could return -ENOKEY. Fix these issues in the documentation of security_inode_init_security(). Fixes: 6bcdfd2cac55 ("security: Allow all LSMs to provide xattrs for inode_init_security hook") Signed-off-by: Roberto Sassu --- security/security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/security.c b/security/security.c index cfdd0cbbcb9..f86567083e6 100644 --- a/security/security.c +++ b/security/security.c @@ -1604,8 +1604,8 @@ EXPORT_SYMBOL(security_dentry_create_files_as); * a security attribute on this particular inode, then it should return * -EOPNOTSUPP to skip this processing. * - * Return: Returns 0 on success, -EOPNOTSUPP if no security attribute is - * needed, or -ENOMEM on memory allocation failure. + * Return: Returns 0 if the LSM successfully initialized all of the inode + * security attributes that are required, negative values otherwise. */ int security_inode_init_security(struct inode *inode, struct inode *dir, const struct qstr *qstr,