• Cong Wang's avatar
    net: drop skb on failure in ip_check_defrag() · 7de414a9
    Cong Wang authored
    Most callers of pskb_trim_rcsum() simply drop the skb when
    it fails, however, ip_check_defrag() still continues to pass
    the skb up to stack. This is suspicious.
    
    In ip_check_defrag(), after we learn the skb is an IP fragment,
    passing the skb to callers makes no sense, because callers expect
    fragments are defrag'ed on success. So, dropping the skb when we
    can't defrag it is reasonable.
    
    Note, prior to commit 88078d98, this is not a big problem as
    checksum will be fixed up anyway. After it, the checksum is not
    correct on failure.
    
    Found this during code review.
    
    Fixes: 88078d98 ("net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends")
    Cc: Eric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
    Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    7de414a9
ip_fragment.c 24.2 KB