• Alex Elder's avatar
    net: qualcomm: rmnet: IPv4 header has zero checksum · 16bf3d33
    Alex Elder authored
    In rmnet_map_ipv4_dl_csum_trailer(), an illegal checksum subtraction
    is done, subtracting hdr_csum (in host byte order) from csum_value (in
    network byte order).  Despite being illegal, it generally works,
    because it turns out the value subtracted is (or should be) always 0,
    which has the same representation in either byte order.
    
    Doing illegal operations is not good form though, so fix this by
    verifying the IP header checksum early in that function.  If its
    checksum is non-zero, the packet will be bad, so just return an
    error.  This will cause the packet to passed to the IP layer where
    it can be dropped.
    
    Thereafter, there is no need subtract the IP header checksum from
    the checksum value in the trailer because we know it is zero.
    Add a comment explaining this.
    
    This type of packet error is different from other types, so add a
    new statistics counter to track this condition.
    Signed-off-by: default avatarAlex Elder <elder@linaro.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    16bf3d33
rmnet_vnd.c 8.59 KB