• Eric Dumazet's avatar
    ipv4: tcp: get rid of ugly unicast_sock · 6b200661
    Eric Dumazet authored
    commit bdbbb852 upstream.
    
    In commit be9f4a44 ("ipv4: tcp: remove per net tcp_sock")
    I tried to address contention on a socket lock, but the solution
    I chose was horrible :
    
    commit 3a7c384f ("ipv4: tcp: unicast_sock should not land outside
    of TCP stack") addressed a selinux regression.
    
    commit 0980e56e ("ipv4: tcp: set unicast_sock uc_ttl to -1")
    took care of another regression.
    
    commit b5ec8eea ("ipv4: fix ip_send_skb()") fixed another regression.
    
    commit 811230cd ("tcp: ipv4: initialize unicast_sock sk_pacing_rate")
    was another shot in the dark.
    
    Really, just use a proper socket per cpu, and remove the skb_orphan()
    call, to re-enable flow control.
    
    This solves a serious problem with FQ packet scheduler when used in
    hostile environments, as we do not want to allocate a flow structure
    for every RST packet sent in response to a spoofed packet.
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    [ luis: backported to 3.16: based on davem's backport to 3.14 ]
    Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
    6b200661
tcp_ipv4.c 66.1 KB