[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210508040101.2474-1-thunder.leizhen@huawei.com>
Date: Sat, 8 May 2021 12:01:01 +0800
From: Zhen Lei <thunder.leizhen@...wei.com>
To: Kees Cook <keescook@...omium.org>,
linux-kernel <linux-kernel@...r.kernel.org>
CC: Zhen Lei <thunder.leizhen@...wei.com>
Subject: [PATCH 1/1] samples/seccomp: fix error return code in handle_req()
Unlike branch "if (lseek(mem, req->data.args[0], SEEK_SET) < 0)" above,
'ret' is overwritten by the previous 'ret = read(...)' statement.
Therefore, 'ret' needs to be explicitly assigned to -1 here. Otherwise,
0 is incorrectly returned.
Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
---
samples/seccomp/user-trap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/samples/seccomp/user-trap.c b/samples/seccomp/user-trap.c
index 20291ec6489f..c1d4ca0284ba 100644
--- a/samples/seccomp/user-trap.c
+++ b/samples/seccomp/user-trap.c
@@ -164,6 +164,7 @@ static int handle_req(struct seccomp_notif *req,
}
if (lseek(mem, req->data.args[1], SEEK_SET) < 0) {
+ ret = -1;
perror("seek");
goto out;
}
--
2.25.1
Powered by blists - more mailing lists