public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] samples/bpf: xdp_router_ipv4_user: Fix write overflow
@ 2022-11-22  2:32 Rong Tao
  2022-11-24 23:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Rong Tao @ 2022-11-22  2:32 UTC (permalink / raw)
  To: ast
  Cc: Rong Tao, Daniel Borkmann, David S. Miller, Jakub Kicinski,
	Jesper Dangaard Brouer, John Fastabend, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh,
	Stanislav Fomichev, Hao Luo, Jiri Olsa,
	open list:XDP (eXpress Data Path),
	open list:XDP (eXpress Data Path), open list

From: Rong Tao <rongtao@cestc.cn>

prefix_key->data allocates three bytes using alloca(), but four bytes are
accessed in the program.

Signed-off-by: Rong Tao <rongtao@cestc.cn>
---
 samples/bpf/xdp_router_ipv4_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/bpf/xdp_router_ipv4_user.c b/samples/bpf/xdp_router_ipv4_user.c
index 683913bbf279..9d41db09c480 100644
--- a/samples/bpf/xdp_router_ipv4_user.c
+++ b/samples/bpf/xdp_router_ipv4_user.c
@@ -162,7 +162,7 @@ static void read_route(struct nlmsghdr *nh, int nll)
 				__be32 gw;
 			} *prefix_value;
 
-			prefix_key = alloca(sizeof(*prefix_key) + 3);
+			prefix_key = alloca(sizeof(*prefix_key) + 4);
 			prefix_value = alloca(sizeof(*prefix_value));
 
 			prefix_key->prefixlen = 32;
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf-next] samples/bpf: xdp_router_ipv4_user: Fix write overflow
  2022-11-22  2:32 [PATCH bpf-next] samples/bpf: xdp_router_ipv4_user: Fix write overflow Rong Tao
@ 2022-11-24 23:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-24 23:30 UTC (permalink / raw)
  To: Rong Tao
  Cc: ast, rongtao, daniel, davem, kuba, hawk, john.fastabend, andrii,
	martin.lau, song, yhs, kpsingh, sdf, haoluo, jolsa, netdev, bpf,
	linux-kernel

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Tue, 22 Nov 2022 10:32:56 +0800 you wrote:
> From: Rong Tao <rongtao@cestc.cn>
> 
> prefix_key->data allocates three bytes using alloca(), but four bytes are
> accessed in the program.
> 
> Signed-off-by: Rong Tao <rongtao@cestc.cn>
> 
> [...]

Here is the summary with links:
  - [bpf-next] samples/bpf: xdp_router_ipv4_user: Fix write overflow
    https://git.kernel.org/bpf/bpf-next/c/19a2bdbaaddc

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-24 23:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-22  2:32 [PATCH bpf-next] samples/bpf: xdp_router_ipv4_user: Fix write overflow Rong Tao
2022-11-24 23:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox