]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix seq_show for BPF_MAP_TYPE_STRUCT_OPS
authorMartin KaFai Lau <kafai@fb.com>
Tue, 14 Jan 2020 07:26:47 +0000 (23:26 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 14 Jan 2020 17:54:31 +0000 (09:54 -0800)
commit5c443f9957313e705fba9a4d46e54236c4503c1d
treee21b8e78a62af42310fbf7d9e0c92061df9ccf97
parent478fa770517274fd9a0b0fc2e187accb394394af
bpf: Fix seq_show for BPF_MAP_TYPE_STRUCT_OPS

Instead of using bpf_struct_ops_map_lookup_elem() which is
not implemented, bpf_struct_ops_map_seq_show_elem() should
also use bpf_struct_ops_map_sys_lookup_elem() which does
an inplace update to the value.  The change allocates
a value to pass to bpf_struct_ops_map_sys_lookup_elem().

[root@arch-fb-vm1 bpf]# cat /sys/fs/bpf/dctcp
{{{1}},BPF_STRUCT_OPS_STATE_INUSE,{{00000000df93eebc,00000000df93eebc},0,2, ...

Fixes: 81e2adb6e6de ("bpf: Introduce BPF_MAP_TYPE_STRUCT_OPS")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200114072647.3188298-1-kafai@fb.com
kernel/bpf/bpf_struct_ops.c