[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200428182235.076509927@linuxfoundation.org>
Date: Tue, 28 Apr 2020 20:24:16 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, David Ahern <dsahern@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Andrey Ignatov <rdna@...com>, Sasha Levin <sashal@...nel.org>
Subject: [PATCH 5.6 080/167] libbpf: Only check mode flags in get_xdp_id
From: David Ahern <dsahern@...il.com>
[ Upstream commit 257d7d4f0e69f5e8e3d38351bdcab896719dba04 ]
The commit in the Fixes tag changed get_xdp_id to only return prog_id
if flags is 0, but there are other XDP flags than the modes - e.g.,
XDP_FLAGS_UPDATE_IF_NOEXIST. Since the intention was only to look at
MODE flags, clear other ones before checking if flags is 0.
Fixes: f07cbad29741 ("libbpf: Fix bpf_get_link_xdp_id flags handling")
Signed-off-by: David Ahern <dsahern@...il.com>
Signed-off-by: Alexei Starovoitov <ast@...nel.org>
Acked-by: Andrey Ignatov <rdna@...com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
tools/lib/bpf/netlink.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/lib/bpf/netlink.c b/tools/lib/bpf/netlink.c
index 6d47345a310bd..c364e4be5e6eb 100644
--- a/tools/lib/bpf/netlink.c
+++ b/tools/lib/bpf/netlink.c
@@ -289,6 +289,8 @@ int bpf_get_link_xdp_info(int ifindex, struct xdp_link_info *info,
static __u32 get_xdp_id(struct xdp_link_info *info, __u32 flags)
{
+ flags &= XDP_FLAGS_MODES;
+
if (info->attach_mode != XDP_ATTACHED_MULTI && !flags)
return info->prog_id;
if (flags & XDP_FLAGS_DRV_MODE)
--
2.20.1
Powered by blists - more mailing lists