• John Fastabend's avatar
    bpf: sockmap remove duplicate queue free · c42253cc
    John Fastabend authored
    In tcp bpf remove we free the cork list and purge the ingress msg
    list. However we do this before the ref count reaches zero so it
    could be possible some other access is in progress. In this case
    (tcp close and/or tcp_unhash) we happen to also hold the sock
    lock so no path exists but lets fix it otherwise it is extremely
    fragile and breaks the reference counting rules. Also we already
    check the cork list and ingress msg queue and free them once the
    ref count reaches zero so its wasteful to check twice.
    
    Fixes: 604326b4 ("bpf, sockmap: convert to generic sk_msg interface")
    Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    c42253cc
tcp_bpf.c 15.5 KB