Skip to content

Commit 1cba275

Browse files
committed
apparmor: cleanup network hook comments
Drop useless partial kernel doc style comments. Finish/update kerneldoc comment where there is useful information Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent a7e405a commit 1cba275

1 file changed

Lines changed: 16 additions & 44 deletions

File tree

security/apparmor/lsm.c

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -987,9 +987,6 @@ static int apparmor_userns_create(const struct cred *cred)
987987
return error;
988988
}
989989

990-
/**
991-
* apparmor_sk_alloc_security - allocate and attach the sk_security field
992-
*/
993990
static int apparmor_sk_alloc_security(struct sock *sk, int family, gfp_t flags)
994991
{
995992
struct aa_sk_ctx *ctx;
@@ -1003,9 +1000,6 @@ static int apparmor_sk_alloc_security(struct sock *sk, int family, gfp_t flags)
10031000
return 0;
10041001
}
10051002

1006-
/**
1007-
* apparmor_sk_free_security - free the sk_security field
1008-
*/
10091003
static void apparmor_sk_free_security(struct sock *sk)
10101004
{
10111005
struct aa_sk_ctx *ctx = aa_sock(sk);
@@ -1018,6 +1012,8 @@ static void apparmor_sk_free_security(struct sock *sk)
10181012

10191013
/**
10201014
* apparmor_sk_clone_security - clone the sk_security field
1015+
* @sk: sock to have security cloned
1016+
* @newsk: sock getting clone
10211017
*/
10221018
static void apparmor_sk_clone_security(const struct sock *sk,
10231019
struct sock *newsk)
@@ -1034,9 +1030,6 @@ static void apparmor_sk_clone_security(const struct sock *sk,
10341030
new->peer = aa_get_label(ctx->peer);
10351031
}
10361032

1037-
/**
1038-
* apparmor_socket_create - check perms before creating a new socket
1039-
*/
10401033
static int apparmor_socket_create(int family, int type, int protocol, int kern)
10411034
{
10421035
struct aa_label *label;
@@ -1058,10 +1051,14 @@ static int apparmor_socket_create(int family, int type, int protocol, int kern)
10581051

10591052
/**
10601053
* apparmor_socket_post_create - setup the per-socket security struct
1054+
* @sock: socket that is being setup
1055+
* @family: family of socket being created
1056+
* @type: type of the socket
1057+
* @ptotocol: protocol of the socket
1058+
* @kern: socket is a special kernel socket
10611059
*
10621060
* Note:
1063-
* - kernel sockets currently labeled unconfined but we may want to
1064-
* move to a special kernel label
1061+
* - kernel sockets labeled kernel_t used to use unconfined
10651062
* - socket may not have sk here if created with sock_create_lite or
10661063
* sock_alloc. These should be accept cases which will be handled in
10671064
* sock_graft.
@@ -1087,9 +1084,6 @@ static int apparmor_socket_post_create(struct socket *sock, int family,
10871084
return 0;
10881085
}
10891086

1090-
/**
1091-
* apparmor_socket_bind - check perms before bind addr to socket
1092-
*/
10931087
static int apparmor_socket_bind(struct socket *sock,
10941088
struct sockaddr *address, int addrlen)
10951089
{
@@ -1103,9 +1097,6 @@ static int apparmor_socket_bind(struct socket *sock,
11031097
aa_sk_perm(OP_BIND, AA_MAY_BIND, sock->sk));
11041098
}
11051099

1106-
/**
1107-
* apparmor_socket_connect - check perms before connecting @sock to @address
1108-
*/
11091100
static int apparmor_socket_connect(struct socket *sock,
11101101
struct sockaddr *address, int addrlen)
11111102
{
@@ -1119,9 +1110,6 @@ static int apparmor_socket_connect(struct socket *sock,
11191110
aa_sk_perm(OP_CONNECT, AA_MAY_CONNECT, sock->sk));
11201111
}
11211112

1122-
/**
1123-
* apparmor_socket_listen - check perms before allowing listen
1124-
*/
11251113
static int apparmor_socket_listen(struct socket *sock, int backlog)
11261114
{
11271115
AA_BUG(!sock);
@@ -1133,9 +1121,7 @@ static int apparmor_socket_listen(struct socket *sock, int backlog)
11331121
aa_sk_perm(OP_LISTEN, AA_MAY_LISTEN, sock->sk));
11341122
}
11351123

1136-
/**
1137-
* apparmor_socket_accept - check perms before accepting a new connection.
1138-
*
1124+
/*
11391125
* Note: while @newsock is created and has some information, the accept
11401126
* has not been done.
11411127
*/
@@ -1164,18 +1150,12 @@ static int aa_sock_msg_perm(const char *op, u32 request, struct socket *sock,
11641150
aa_sk_perm(op, request, sock->sk));
11651151
}
11661152

1167-
/**
1168-
* apparmor_socket_sendmsg - check perms before sending msg to another socket
1169-
*/
11701153
static int apparmor_socket_sendmsg(struct socket *sock,
11711154
struct msghdr *msg, int size)
11721155
{
11731156
return aa_sock_msg_perm(OP_SENDMSG, AA_MAY_SEND, sock, msg, size);
11741157
}
11751158

1176-
/**
1177-
* apparmor_socket_recvmsg - check perms before receiving a message
1178-
*/
11791159
static int apparmor_socket_recvmsg(struct socket *sock,
11801160
struct msghdr *msg, int size, int flags)
11811161
{
@@ -1194,17 +1174,11 @@ static int aa_sock_perm(const char *op, u32 request, struct socket *sock)
11941174
aa_sk_perm(op, request, sock->sk));
11951175
}
11961176

1197-
/**
1198-
* apparmor_socket_getsockname - check perms before getting the local address
1199-
*/
12001177
static int apparmor_socket_getsockname(struct socket *sock)
12011178
{
12021179
return aa_sock_perm(OP_GETSOCKNAME, AA_MAY_GETATTR, sock);
12031180
}
12041181

1205-
/**
1206-
* apparmor_socket_getpeername - check perms before getting remote address
1207-
*/
12081182
static int apparmor_socket_getpeername(struct socket *sock)
12091183
{
12101184
return aa_sock_perm(OP_GETPEERNAME, AA_MAY_GETATTR, sock);
@@ -1223,29 +1197,20 @@ static int aa_sock_opt_perm(const char *op, u32 request, struct socket *sock,
12231197
aa_sk_perm(op, request, sock->sk));
12241198
}
12251199

1226-
/**
1227-
* apparmor_socket_getsockopt - check perms before getting socket options
1228-
*/
12291200
static int apparmor_socket_getsockopt(struct socket *sock, int level,
12301201
int optname)
12311202
{
12321203
return aa_sock_opt_perm(OP_GETSOCKOPT, AA_MAY_GETOPT, sock,
12331204
level, optname);
12341205
}
12351206

1236-
/**
1237-
* apparmor_socket_setsockopt - check perms before setting socket options
1238-
*/
12391207
static int apparmor_socket_setsockopt(struct socket *sock, int level,
12401208
int optname)
12411209
{
12421210
return aa_sock_opt_perm(OP_SETSOCKOPT, AA_MAY_SETOPT, sock,
12431211
level, optname);
12441212
}
12451213

1246-
/**
1247-
* apparmor_socket_shutdown - check perms before shutting down @sock conn
1248-
*/
12491214
static int apparmor_socket_shutdown(struct socket *sock, int how)
12501215
{
12511216
return aa_sock_perm(OP_SHUTDOWN, AA_MAY_SHUTDOWN, sock);
@@ -1254,6 +1219,8 @@ static int apparmor_socket_shutdown(struct socket *sock, int how)
12541219
#ifdef CONFIG_NETWORK_SECMARK
12551220
/**
12561221
* apparmor_socket_sock_rcv_skb - check perms before associating skb to sk
1222+
* @sk: sk to associate @skb with
1223+
* @skb: skb to check for perms
12571224
*
12581225
* Note: can not sleep may be called with locks held
12591226
*
@@ -1285,6 +1252,11 @@ static struct aa_label *sk_peer_label(struct sock *sk)
12851252

12861253
/**
12871254
* apparmor_socket_getpeersec_stream - get security context of peer
1255+
* @sock: socket that we are trying to get the peer context of
1256+
* @optval: output - buffer to copy peer name to
1257+
* @optlen: output - size of copied name in @optval
1258+
* @len: size of @optval buffer
1259+
* Returns: 0 on success, -errno of failure
12881260
*
12891261
* Note: for tcp only valid if using ipsec or cipso on lan
12901262
*/

0 commit comments

Comments
 (0)