bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf 1/2] libbpf: Fix type of old_fd in bpf_xdp_set_link_opts
@ 2020-04-14 14:50 Toke Høiland-Jørgensen
  2020-04-14 14:50 ` [PATCH bpf 2/2] selftests/bpf: Check for correct program attach/detach in xdp_attach test Toke Høiland-Jørgensen
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Toke Høiland-Jørgensen @ 2020-04-14 14:50 UTC (permalink / raw)
  To: daniel, ast; +Cc: Toke Høiland-Jørgensen, bpf, netdev, David Ahern

The 'old_fd' parameter used for atomic replacement of XDP programs is
supposed to be an FD, but was left as a u32 from an earlier iteration of
the patch that added it. It was converted to an int when read, so things
worked correctly even with negative values, but better change the
definition to correctly reflect the intention.

Fixes: bd5ca3ef93cd ("libbpf: Add function to set link XDP fd while specifying old program")
Reported-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
 tools/lib/bpf/libbpf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index 44df1d3e7287..f1dacecb1619 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -458,7 +458,7 @@ struct xdp_link_info {
 
 struct bpf_xdp_set_link_opts {
 	size_t sz;
-	__u32 old_fd;
+	int old_fd;
 };
 #define bpf_xdp_set_link_opts__last_field old_fd
 
-- 
2.26.0


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

end of thread, other threads:[~2020-04-15 12:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14 14:50 [PATCH bpf 1/2] libbpf: Fix type of old_fd in bpf_xdp_set_link_opts Toke Høiland-Jørgensen
2020-04-14 14:50 ` [PATCH bpf 2/2] selftests/bpf: Check for correct program attach/detach in xdp_attach test Toke Høiland-Jørgensen
2020-04-14 22:30   ` Song Liu
2020-04-14 19:47 ` [PATCH bpf 1/2] libbpf: Fix type of old_fd in bpf_xdp_set_link_opts David Ahern
2020-04-14 22:24 ` Song Liu
2020-04-15 12:34 ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).