[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181220194557.29196-1-kjlu@umn.edu>
Date: Thu, 20 Dec 2018 13:45:56 -0600
From: Kangjie Lu <kjlu@....edu>
To: kjlu@....edu
Cc: pakki001@....edu, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] bpf: fix a missing check of return value
check_reg_arg() may fail and not mark correct data in "env". This
fix inserts a check that ensures check_reg_arg() is successful, and
if it is not, the fix stops further operations and returns an error
upstream.
Signed-off-by: Kangjie Lu <kjlu@....edu>
---
kernel/bpf/verifier.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 51ba84d4d34a..ced8cc6470b1 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -2619,7 +2619,9 @@ static int check_func_call(struct bpf_verifier_env *env, struct bpf_insn *insn,
/* after the call registers r0 - r5 were scratched */
for (i = 0; i < CALLER_SAVED_REGS; i++) {
mark_reg_not_init(env, caller->regs, caller_saved[i]);
- check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK);
+ err = check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK);
+ if (err)
+ return err;
}
/* only increment it after check_reg_arg() finished */
--
2.17.1
Powered by blists - more mailing lists