diff options
author | Felix Maurer <fmaurer@redhat.com> | 2022-02-09 16:55:26 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2022-02-11 13:49:23 +0100 |
commit | 4a11678f683814df82fca9018d964771e02d7e6d (patch) | |
tree | f49dee64c35315009c22d9978a250ba8529017d7 /fs/hostfs/hostfs_kern.c | |
parent | 525de9a79349bd83fe5276d7672f91887f9ee721 (diff) | |
download | linux-4a11678f683814df82fca9018d964771e02d7e6d.tar.bz2 |
bpf: Do not try bpf_msg_push_data with len 0
If bpf_msg_push_data() is called with len 0 (as it happens during
selftests/bpf/test_sockmap), we do not need to do anything and can
return early.
Calling bpf_msg_push_data() with len 0 previously lead to a wrong ENOMEM
error: we later called get_order(copy + len); if len was 0, copy + len
was also often 0 and get_order() returned some undefined value (at the
moment 52). alloc_pages() caught that and failed, but then bpf_msg_push_data()
returned ENOMEM. This was wrong because we are most probably not out of
memory and actually do not need any additional memory.
Fixes: 6fff607e2f14b ("bpf: sk_msg program helper bpf_msg_push_data")
Signed-off-by: Felix Maurer <fmaurer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/df69012695c7094ccb1943ca02b4920db3537466.1644421921.git.fmaurer@redhat.com
Diffstat (limited to 'fs/hostfs/hostfs_kern.c')
0 files changed, 0 insertions, 0 deletions