All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul@paul-moore.com>
To: linux-security-module@vger.kernel.org
Subject: [PATCH 12/22] lsm: move the Infiniband hook comments to security/security.c
Date: Thu, 16 Feb 2023 22:26:15 -0500	[thread overview]
Message-ID: <20230217032625.678457-13-paul@paul-moore.com> (raw)
In-Reply-To: <20230217032625.678457-1-paul@paul-moore.com>

This patch relocates the LSM hook function comments to the function
definitions, in keeping with the current kernel conventions.  This
should make the hook descriptions more easily discoverable and easier
to maintain.

While formatting changes have been done to better fit the kernel-doc
style, content changes have been kept to a minimum and limited to
text which was obviously incorrect and/or outdated.  It is expected
the future patches will improve the quality of the function header
comments.

Signed-off-by: Paul Moore <paul@paul-moore.com>
---
 include/linux/lsm_hooks.h | 22 ----------------------
 security/security.c       | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index bb460e0b1ff2..9fc6417af980 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -32,28 +32,6 @@
 /**
  * union security_list_options - Linux Security Module hook function list
  *
- * Security hooks for Infiniband
- *
- * @ib_pkey_access:
- *	Check permission to access a pkey when modifing a QP.
- *	@subnet_prefix the subnet prefix of the port being used.
- *	@pkey the pkey to be accessed.
- *	@sec pointer to a security structure.
- *	Return 0 if permission is granted.
- * @ib_endport_manage_subnet:
- *	Check permissions to send and receive SMPs on a end port.
- *	@dev_name the IB device name (i.e. mlx4_0).
- *	@port_num the port number.
- *	@sec pointer to a security structure.
- *	Return 0 if permission is granted.
- * @ib_alloc_security:
- *	Allocate a security structure for Infiniband objects.
- *	@sec pointer to a security structure pointer.
- *	Returns 0 on success, non-zero on failure.
- * @ib_free_security:
- *	Deallocate an Infiniband security structure.
- *	@sec contains the security structure to be freed.
- *
  * Security hooks for XFRM operations.
  *
  * @xfrm_policy_alloc_security:
diff --git a/security/security.c b/security/security.c
index 1ada27c7917f..3b713ed3d29c 100644
--- a/security/security.c
+++ b/security/security.c
@@ -4207,24 +4207,58 @@ EXPORT_SYMBOL(security_sctp_assoc_established);
 
 #ifdef CONFIG_SECURITY_INFINIBAND
 
+/**
+ * security_ib_pkey_access() - Check if access to an IB pkey is allowed
+ * @sec: LSM blob
+ * @subnet_prefix: subnet prefix of the port
+ * @pkey: IB pkey
+ *
+ * Check permission to access a pkey when modifing a QP.
+ *
+ * Return: Returns 0 if permission is granted.
+ */
 int security_ib_pkey_access(void *sec, u64 subnet_prefix, u16 pkey)
 {
 	return call_int_hook(ib_pkey_access, 0, sec, subnet_prefix, pkey);
 }
 EXPORT_SYMBOL(security_ib_pkey_access);
 
+/**
+ * security_ib_endport_manage_subnet() - Check if SMPs traffic is allowed
+ * @sec: LSM blob
+ * @dev_name: IB device name
+ * @port_num: port number
+ *
+ * Check permissions to send and receive SMPs on a end port.
+ *
+ * Return: Returns 0 if permission is granted.
+ */
 int security_ib_endport_manage_subnet(void *sec, const char *dev_name, u8 port_num)
 {
 	return call_int_hook(ib_endport_manage_subnet, 0, sec, dev_name, port_num);
 }
 EXPORT_SYMBOL(security_ib_endport_manage_subnet);
 
+/**
+ * security_ib_alloc_security() - Allocate an Infiniband LSM blob
+ * @sec: LSM blob
+ *
+ * Allocate a security structure for Infiniband objects.
+ *
+ * Return: Returns 0 on success, non-zero on failure.
+ */
 int security_ib_alloc_security(void **sec)
 {
 	return call_int_hook(ib_alloc_security, 0, sec);
 }
 EXPORT_SYMBOL(security_ib_alloc_security);
 
+/**
+ * security_ib_free_security() - Free an Infiniband LSM blob
+ * @sec: LSM blob
+ *
+ * Deallocate an Infiniband security structure.
+ */
 void security_ib_free_security(void *sec)
 {
 	call_void_hook(ib_free_security, sec);
-- 
2.39.2


  parent reply	other threads:[~2023-02-17  3:27 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17  3:26 [PATCH 00/22] Move LSM hook comments into security/security.c Paul Moore
2023-02-17  3:26 ` [PATCH 01/22] lsm: move the program execution hook comments to security/security.c Paul Moore
2023-02-17  3:26 ` [PATCH 02/22] lsm: move the fs_context " Paul Moore
2023-02-17  3:26 ` [PATCH 03/22] lsm: move the filesystem " Paul Moore
2023-02-17  3:26 ` [PATCH 04/22] lsm: move the inode " Paul Moore
2023-02-17  3:26 ` [PATCH 05/22] lsm: move the kernfs " Paul Moore
2023-02-17  3:26 ` [PATCH 06/22] lsm: move the file " Paul Moore
2023-02-17  3:26 ` [PATCH 07/22] lsm: move the task " Paul Moore
2023-02-17  3:26 ` [PATCH 08/22] lsm: move the netlink " Paul Moore
2023-02-17  3:26 ` [PATCH 09/22] lsm: move the AF_UNIX " Paul Moore
2023-02-17  3:26 ` [PATCH 10/22] lsm: move the socket " Paul Moore
2023-02-17  3:26 ` [PATCH 11/22] lsm: move the SCTP " Paul Moore
2023-02-17  3:26 ` Paul Moore [this message]
2023-02-17  3:26 ` [PATCH 13/22] lsm: move the xfrm " Paul Moore
2023-02-17  3:26 ` [PATCH 14/22] lsm: move the key " Paul Moore
2023-02-17  3:26 ` [PATCH 15/22] lsm: move the sysv " Paul Moore
2023-02-17  3:26 ` [PATCH 16/22] lsm: move the binder " Paul Moore
2023-02-17  3:26 ` [PATCH 17/22] lsm: move the audit " Paul Moore
2023-02-17  3:26 ` [PATCH 18/22] lsm: move the bpf " Paul Moore
2023-02-17  3:26 ` [PATCH 19/22] lsm: move the perf " Paul Moore
2023-02-17  3:26 ` [PATCH 20/22] lsm: move the io_uring " Paul Moore
2023-02-17  3:26 ` [PATCH 21/22] lsm: move the remaining LSM " Paul Moore
2023-02-17  3:26 ` [PATCH 22/22] lsm: styling fixes " Paul Moore
2023-02-17 14:07 ` [PATCH 00/22] Move LSM hook comments into security/security.c Paul Moore
2023-02-17 17:22 ` Casey Schaufler
2023-02-17 19:04   ` Paul Moore
2023-03-06 18:49 ` Paul Moore
2023-03-07  8:08   ` Roberto Sassu
2023-03-07 16:33     ` Paul Moore
2023-03-07 16:38       ` Roberto Sassu
2023-03-08 17:09         ` Paul Moore
2023-03-08 17:14           ` Roberto Sassu
2023-03-08 17:20             ` Paul Moore

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=20230217032625.678457-13-paul@paul-moore.com \
    --to=paul@paul-moore.com \
    --cc=linux-security-module@vger.kernel.org \
    /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 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.