Skip to content

Commit f9c9dce

Browse files
Jump2233jrjohansen
authored andcommitted
apparmor: fix documentation mismatches in val_mask_to_str and socket functions
This patch fixes kernel-doc warnings: 1. val_mask_to_str: - Added missing descriptions for `size` and `table` parameters. - Removed outdated str_size and chrs references. 2. Socket Functions: - Makes non-null requirements clear for socket/address args. - Standardizes return values per kernel conventions. - Adds Unix domain socket protocol details. These changes silence doc validation warnings and improve accuracy for AppArmor LSM docs. Signed-off-by: Peng Jiang <[email protected]> Signed-off-by: John Johansen <[email protected]>
1 parent 4ce7d3c commit f9c9dce

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

security/apparmor/lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int aa_parse_debug_params(const char *str)
8585
* val_mask_to_str - convert a perm mask to its short string
8686
* @str: character buffer to store string in (at least 10 characters)
8787
* @size: size of the @str buffer
88-
* @table: NUL-terminated character buffer of permission characters
88+
* @table: NUL-terminated character buffer of permission characters (NOT NULL)
8989
* @mask: permission mask to convert
9090
*/
9191
static int val_mask_to_str(char *str, size_t size,

security/apparmor/lsm.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,10 @@ static void unix_connect_peers(struct aa_sk_ctx *sk_ctx,
11861186
* @peer_sk: sk that is accepting the connection
11871187
* @newsk: new sk created for this connection
11881188
* peer is locked when this hook is called
1189+
*
1190+
* Return:
1191+
* 0 if connection is permitted
1192+
* error code on denial or failure
11891193
*/
11901194
static int apparmor_unix_stream_connect(struct sock *sk, struct sock *peer_sk,
11911195
struct sock *newsk)
@@ -1221,8 +1225,16 @@ static int apparmor_unix_stream_connect(struct sock *sk, struct sock *peer_sk,
12211225
* @sock: socket sending the message
12221226
* @peer: socket message is being send to
12231227
*
1228+
* Performs bidirectional permission checks for Unix domain socket communication:
1229+
* 1. Verifies sender has AA_MAY_SEND to target socket
1230+
* 2. Verifies receiver has AA_MAY_RECEIVE from source socket
1231+
*
12241232
* sock and peer are locked when this hook is called
12251233
* called by: dgram_connect peer setup but path not copied to newsk
1234+
*
1235+
* Return:
1236+
* 0 if transmission is permitted
1237+
* error code on denial or failure
12261238
*/
12271239
static int apparmor_unix_may_send(struct socket *sock, struct socket *peer)
12281240
{
@@ -1339,9 +1351,17 @@ static int apparmor_socket_socketpair(struct socket *socka,
13391351

13401352
/**
13411353
* apparmor_socket_bind - check perms before bind addr to socket
1342-
* @sock: socket to bind the address to
1343-
* @address: address that is being bound
1354+
* @sock: socket to bind the address to (must be non-NULL)
1355+
* @address: address that is being bound (must be non-NULL)
13441356
* @addrlen: length of @address
1357+
*
1358+
* Performs security checks before allowing a socket to bind to an address.
1359+
* Handles Unix domain sockets specially through aa_unix_bind_perm().
1360+
* For other socket families, uses generic permission check via aa_sk_perm().
1361+
*
1362+
* Return:
1363+
* 0 if binding is permitted
1364+
* error code on denial or invalid parameters
13451365
*/
13461366
static int apparmor_socket_bind(struct socket *sock,
13471367
struct sockaddr *address, int addrlen)

0 commit comments

Comments
 (0)