Skip to content

Commit f29035a

Browse files
committed
security,bpf: constify struct path in bpf_token_create() LSM hook
There is no reason why struct path pointer shouldn't be const-qualified when being passed into bpf_token_create() LSM hook. Add that const. Suggested-by: Al Viro <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]>
1 parent eceb7b3 commit f29035a

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

include/linux/lsm_hook_defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ LSM_HOOK(int, 0, bpf_prog_load, struct bpf_prog *prog, union bpf_attr *attr,
431431
struct bpf_token *token)
432432
LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free, struct bpf_prog *prog)
433433
LSM_HOOK(int, 0, bpf_token_create, struct bpf_token *token, union bpf_attr *attr,
434-
struct path *path)
434+
const struct path *path)
435435
LSM_HOOK(void, LSM_RET_VOID, bpf_token_free, struct bpf_token *token)
436436
LSM_HOOK(int, 0, bpf_token_cmd, const struct bpf_token *token, enum bpf_cmd cmd)
437437
LSM_HOOK(int, 0, bpf_token_capable, const struct bpf_token *token, int cap)

include/linux/security.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,7 +2137,7 @@ extern int security_bpf_prog_load(struct bpf_prog *prog, union bpf_attr *attr,
21372137
struct bpf_token *token);
21382138
extern void security_bpf_prog_free(struct bpf_prog *prog);
21392139
extern int security_bpf_token_create(struct bpf_token *token, union bpf_attr *attr,
2140-
struct path *path);
2140+
const struct path *path);
21412141
extern void security_bpf_token_free(struct bpf_token *token);
21422142
extern int security_bpf_token_cmd(const struct bpf_token *token, enum bpf_cmd cmd);
21432143
extern int security_bpf_token_capable(const struct bpf_token *token, int cap);
@@ -2177,7 +2177,7 @@ static inline void security_bpf_prog_free(struct bpf_prog *prog)
21772177
{ }
21782178

21792179
static inline int security_bpf_token_create(struct bpf_token *token, union bpf_attr *attr,
2180-
struct path *path)
2180+
const struct path *path)
21812181
{
21822182
return 0;
21832183
}

security/security.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5510,7 +5510,7 @@ int security_bpf_prog_load(struct bpf_prog *prog, union bpf_attr *attr,
55105510
* Return: Returns 0 on success, error on failure.
55115511
*/
55125512
int security_bpf_token_create(struct bpf_token *token, union bpf_attr *attr,
5513-
struct path *path)
5513+
const struct path *path)
55145514
{
55155515
return call_int_hook(bpf_token_create, token, attr, path);
55165516
}

security/selinux/hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6965,7 +6965,7 @@ static void selinux_bpf_prog_free(struct bpf_prog *prog)
69656965
}
69666966

69676967
static int selinux_bpf_token_create(struct bpf_token *token, union bpf_attr *attr,
6968-
struct path *path)
6968+
const struct path *path)
69696969
{
69706970
struct bpf_security_struct *bpfsec;
69716971

0 commit comments

Comments
 (0)