aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorLi RongQing <lirongqing@baidu.com>2020-01-10 09:04:37 +0800
committerDaniel Borkmann <daniel@iogearbox.net>2020-01-14 20:32:24 +0100
commit0a29275b6300f39f78a87f2038bbfe5bdbaeca47 (patch)
tree1d8ed61d64ce17f6f067eca367d76d0fa531ab46 /net/core
parentbpf: Fix seq_show for BPF_MAP_TYPE_STRUCT_OPS (diff)
downloadlinux-dev-0a29275b6300f39f78a87f2038bbfe5bdbaeca47.tar.xz
linux-dev-0a29275b6300f39f78a87f2038bbfe5bdbaeca47.zip
bpf: Return -EBADRQC for invalid map type in __bpf_tx_xdp_map
A negative value should be returned if map->map_type is invalid although that is impossible now, but if we run into such situation in future, then xdpbuff could be leaked. Daniel Borkmann suggested: -EBADRQC should be returned to stay consistent with generic XDP for the tracepoint output and not to be confused with -EOPNOTSUPP from other locations like dev_map_enqueue() when ndo_xdp_xmit is missing and such. Suggested-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Li RongQing <lirongqing@baidu.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/1578618277-18085-1-git-send-email-lirongqing@baidu.com
Diffstat (limited to 'net/core')
-rw-r--r--net/core/filter.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index a702761ef369..d6f58dc4e1c4 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3522,7 +3522,7 @@ static int __bpf_tx_xdp_map(struct net_device *dev_rx, void *fwd,
case BPF_MAP_TYPE_XSKMAP:
return __xsk_map_redirect(fwd, xdp);
default:
- break;
+ return -EBADRQC;
}
return 0;
}