From: Roberto Sassu <roberto.sassu@huawei.com> To: <zohar@linux.ibm.com>, <jmorris@namei.org>, <paul@paul-moore.com>, <casey@schaufler-ca.com> Cc: <linux-integrity@vger.kernel.org>, <linux-security-module@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <selinux@vger.kernel.org>, <reiserfs-devel@vger.kernel.org>, Roberto Sassu <roberto.sassu@huawei.com>, <stable@vger.kernel.org>, Jeff Mahoney <jeffm@suse.com>, Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Subject: [PATCH v2 1/6] xattr: Complete constify ->name member of "struct xattr" Date: Wed, 21 Apr 2021 18:19:20 +0200 [thread overview] Message-ID: <20210421161925.968825-2-roberto.sassu@huawei.com> (raw) In-Reply-To: <20210421161925.968825-1-roberto.sassu@huawei.com> This patch completes commit 9548906b2bb7 ('xattr: Constify ->name member of "struct xattr"'). It fixes the documentation of the inode_init_security hook, by removing the xattr name from the objects that are expected to be allocated by LSMs (only the value is allocated). Also, it removes the kfree() of name and setting it to NULL in reiserfs_security_free(). Fixes: 9548906b2bb7 ('xattr: Constify ->name member of "struct xattr"') Cc: stable@vger.kernel.org Cc: Jeff Mahoney <jeffm@suse.com> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> --- fs/reiserfs/xattr_security.c | 2 -- include/linux/lsm_hooks.h | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index 8965c8e5e172..bb2a0062e0e5 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c @@ -95,9 +95,7 @@ int reiserfs_security_write(struct reiserfs_transaction_handle *th, void reiserfs_security_free(struct reiserfs_security_handle *sec) { - kfree(sec->name); kfree(sec->value); - sec->name = NULL; sec->value = NULL; } diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index fb7f3193753d..c5498f5174ce 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -219,8 +219,8 @@ * This hook is called by the fs code as part of the inode creation * transaction and provides for atomic labeling of the inode, unlike * the post_create/mkdir/... hooks called by the VFS. The hook function - * is expected to allocate the name and value via kmalloc, with the caller - * being responsible for calling kfree after using them. + * is expected to allocate the value via kmalloc, with the caller + * being responsible for calling kfree after using it. * If the security module does not use security attributes or does * not wish to put a security attribute on this particular inode, * then it should return -EOPNOTSUPP to skip this processing. -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Roberto Sassu <roberto.sassu@huawei.com> To: zohar@linux.ibm.com, jmorris@namei.org, paul@paul-moore.com, casey@schaufler-ca.com Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, selinux@vger.kernel.org, reiserfs-devel@vger.kernel.org, Roberto Sassu <roberto.sassu@huawei.com>, stable@vger.kernel.org, Jeff Mahoney <jeffm@suse.com>, Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Subject: [PATCH v2 1/6] xattr: Complete constify ->name member of "struct xattr" Date: Wed, 21 Apr 2021 18:19:20 +0200 [thread overview] Message-ID: <20210421161925.968825-2-roberto.sassu@huawei.com> (raw) In-Reply-To: <20210421161925.968825-1-roberto.sassu@huawei.com> This patch completes commit 9548906b2bb7 ('xattr: Constify ->name member of "struct xattr"'). It fixes the documentation of the inode_init_security hook, by removing the xattr name from the objects that are expected to be allocated by LSMs (only the value is allocated). Also, it removes the kfree() of name and setting it to NULL in reiserfs_security_free(). Fixes: 9548906b2bb7 ('xattr: Constify ->name member of "struct xattr"') Cc: stable@vger.kernel.org Cc: Jeff Mahoney <jeffm@suse.com> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> --- fs/reiserfs/xattr_security.c | 2 -- include/linux/lsm_hooks.h | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index 8965c8e5e172..bb2a0062e0e5 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c @@ -95,9 +95,7 @@ int reiserfs_security_write(struct reiserfs_transaction_handle *th, void reiserfs_security_free(struct reiserfs_security_handle *sec) { - kfree(sec->name); kfree(sec->value); - sec->name = NULL; sec->value = NULL; } diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index fb7f3193753d..c5498f5174ce 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -219,8 +219,8 @@ * This hook is called by the fs code as part of the inode creation * transaction and provides for atomic labeling of the inode, unlike * the post_create/mkdir/... hooks called by the VFS. The hook function - * is expected to allocate the name and value via kmalloc, with the caller - * being responsible for calling kfree after using them. + * is expected to allocate the value via kmalloc, with the caller + * being responsible for calling kfree after using it. * If the security module does not use security attributes or does * not wish to put a security attribute on this particular inode, * then it should return -EOPNOTSUPP to skip this processing. -- 2.25.1
next prev parent reply other threads:[~2021-04-21 16:20 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-21 16:19 [PATCH v2 0/6] evm: Prepare for moving to the LSM infrastructure Roberto Sassu 2021-04-21 16:19 ` Roberto Sassu 2021-04-21 16:19 ` Roberto Sassu [this message] 2021-04-21 16:19 ` [PATCH v2 1/6] xattr: Complete constify ->name member of "struct xattr" Roberto Sassu 2021-04-21 16:19 ` [PATCH v2 2/6] reiserfs: Add missing calls to reiserfs_security_free() Roberto Sassu 2021-04-21 16:19 ` Roberto Sassu 2021-04-21 16:19 ` [PATCH v2 3/6] security: Pass xattrs allocated by LSMs to the inode_init_security hook Roberto Sassu 2021-04-21 16:19 ` Roberto Sassu 2021-04-21 22:43 ` Casey Schaufler 2021-04-22 13:46 ` Roberto Sassu 2021-04-22 15:46 ` Casey Schaufler 2021-04-22 16:12 ` Roberto Sassu 2021-04-22 21:39 ` Casey Schaufler 2021-04-21 16:19 ` [PATCH v2 4/6] security: Support multiple LSMs implementing " Roberto Sassu 2021-04-21 16:19 ` Roberto Sassu 2021-04-21 23:09 ` Casey Schaufler 2021-04-21 16:19 ` [PATCH v2 5/6] evm: Align evm_inode_init_security() definition with LSM infrastructure Roberto Sassu 2021-04-21 16:19 ` Roberto Sassu 2021-04-21 16:19 ` [PATCH v2 6/6] evm: Support multiple LSMs providing an xattr Roberto Sassu 2021-04-21 16:19 ` Roberto Sassu
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=20210421161925.968825-2-roberto.sassu@huawei.com \ --to=roberto.sassu@huawei.com \ --cc=casey@schaufler-ca.com \ --cc=jeffm@suse.com \ --cc=jmorris@namei.org \ --cc=linux-integrity@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-security-module@vger.kernel.org \ --cc=paul@paul-moore.com \ --cc=penguin-kernel@I-love.SAKURA.ne.jp \ --cc=reiserfs-devel@vger.kernel.org \ --cc=selinux@vger.kernel.org \ --cc=stable@vger.kernel.org \ --cc=zohar@linux.ibm.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.