lkml.org 
[lkml]   [2020]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.7 242/244] bpf: sockmap: Check value of unused args to BPF_PROG_ATTACH
    Date
    From: Lorenz Bauer <lmb@cloudflare.com>

    commit 9b2b09717e1812e450782a43ca0c2790651cf380 upstream.

    Using BPF_PROG_ATTACH on a sockmap program currently understands no
    flags or replace_bpf_fd, but accepts any value. Return EINVAL instead.

    Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")
    Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20200629095630.7933-4-lmb@cloudflare.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    net/core/sock_map.c | 3 +++
    1 file changed, 3 insertions(+)

    --- a/net/core/sock_map.c
    +++ b/net/core/sock_map.c
    @@ -70,6 +70,9 @@ int sock_map_get_from_fd(const union bpf
    struct fd f;
    int ret;

    + if (attr->attach_flags || attr->replace_bpf_fd)
    + return -EINVAL;
    +
    f = fdget(ufd);
    map = __bpf_map_get(f);
    if (IS_ERR(map))

    \
     
     \ /
      Last update: 2020-07-20 18:17    [W:2.296 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site