From cb04f5610f018828342421fdab83cb956c9ad223 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Wed, 30 Aug 2023 11:54:08 -1000 Subject: [PATCH] scx: bpf_scx_btf_struct_access() should return -EACCES for unknown accesses The function is currently returning 0 for unknown accesses which means allowing writes to anything. Fix the default return value. --- kernel/sched/ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 0f89326b79d9e1..b7a80233ea089c 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -3485,7 +3485,7 @@ static int bpf_scx_btf_struct_access(struct bpf_verifier_log *log, return SCALAR_VALUE; } - return 0; + return -EACCES; } static const struct bpf_func_proto *