Skip to content

Commit ac318ae

Browse files
committed
lsm: move the Infiniband hook comments to security/security.c
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. Acked-by: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 4a49f59 commit ac318ae

2 files changed

Lines changed: 34 additions & 22 deletions

File tree

include/linux/lsm_hooks.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,6 @@
3232
/**
3333
* union security_list_options - Linux Security Module hook function list
3434
*
35-
* Security hooks for Infiniband
36-
*
37-
* @ib_pkey_access:
38-
* Check permission to access a pkey when modifing a QP.
39-
* @subnet_prefix the subnet prefix of the port being used.
40-
* @pkey the pkey to be accessed.
41-
* @sec pointer to a security structure.
42-
* Return 0 if permission is granted.
43-
* @ib_endport_manage_subnet:
44-
* Check permissions to send and receive SMPs on a end port.
45-
* @dev_name the IB device name (i.e. mlx4_0).
46-
* @port_num the port number.
47-
* @sec pointer to a security structure.
48-
* Return 0 if permission is granted.
49-
* @ib_alloc_security:
50-
* Allocate a security structure for Infiniband objects.
51-
* @sec pointer to a security structure pointer.
52-
* Returns 0 on success, non-zero on failure.
53-
* @ib_free_security:
54-
* Deallocate an Infiniband security structure.
55-
* @sec contains the security structure to be freed.
56-
*
5735
* Security hooks for XFRM operations.
5836
*
5937
* @xfrm_policy_alloc_security:

security/security.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4208,24 +4208,58 @@ EXPORT_SYMBOL(security_sctp_assoc_established);
42084208

42094209
#ifdef CONFIG_SECURITY_INFINIBAND
42104210

4211+
/**
4212+
* security_ib_pkey_access() - Check if access to an IB pkey is allowed
4213+
* @sec: LSM blob
4214+
* @subnet_prefix: subnet prefix of the port
4215+
* @pkey: IB pkey
4216+
*
4217+
* Check permission to access a pkey when modifing a QP.
4218+
*
4219+
* Return: Returns 0 if permission is granted.
4220+
*/
42114221
int security_ib_pkey_access(void *sec, u64 subnet_prefix, u16 pkey)
42124222
{
42134223
return call_int_hook(ib_pkey_access, 0, sec, subnet_prefix, pkey);
42144224
}
42154225
EXPORT_SYMBOL(security_ib_pkey_access);
42164226

4227+
/**
4228+
* security_ib_endport_manage_subnet() - Check if SMPs traffic is allowed
4229+
* @sec: LSM blob
4230+
* @dev_name: IB device name
4231+
* @port_num: port number
4232+
*
4233+
* Check permissions to send and receive SMPs on a end port.
4234+
*
4235+
* Return: Returns 0 if permission is granted.
4236+
*/
42174237
int security_ib_endport_manage_subnet(void *sec, const char *dev_name, u8 port_num)
42184238
{
42194239
return call_int_hook(ib_endport_manage_subnet, 0, sec, dev_name, port_num);
42204240
}
42214241
EXPORT_SYMBOL(security_ib_endport_manage_subnet);
42224242

4243+
/**
4244+
* security_ib_alloc_security() - Allocate an Infiniband LSM blob
4245+
* @sec: LSM blob
4246+
*
4247+
* Allocate a security structure for Infiniband objects.
4248+
*
4249+
* Return: Returns 0 on success, non-zero on failure.
4250+
*/
42234251
int security_ib_alloc_security(void **sec)
42244252
{
42254253
return call_int_hook(ib_alloc_security, 0, sec);
42264254
}
42274255
EXPORT_SYMBOL(security_ib_alloc_security);
42284256

4257+
/**
4258+
* security_ib_free_security() - Free an Infiniband LSM blob
4259+
* @sec: LSM blob
4260+
*
4261+
* Deallocate an Infiniband security structure.
4262+
*/
42294263
void security_ib_free_security(void *sec)
42304264
{
42314265
call_void_hook(ib_free_security, sec);

0 commit comments

Comments
 (0)