Skip to content

Commit 0f643c8

Browse files
Doug Bergerkuba-moo
authored andcommitted
net: bcmgenet: skip invalid partial checksums
The RXCHK block will return a partial checksum of 0 if it encounters a problem while receiving a packet. Since a 1's complement sum can only produce this result if no bits are set in the received data stream it is fair to treat it as an invalid partial checksum and not pass it up the stack. Fixes: 8101553 ("net: bcmgenet: use CHECKSUM_COMPLETE for NETIF_F_RXCSUM") Signed-off-by: Doug Berger <opendmb@gmail.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20220317012812.1313196-1-opendmb@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 424e783 commit 0f643c8

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,8 +2287,10 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
22872287
dma_length_status = status->length_status;
22882288
if (dev->features & NETIF_F_RXCSUM) {
22892289
rx_csum = (__force __be16)(status->rx_csum & 0xffff);
2290-
skb->csum = (__force __wsum)ntohs(rx_csum);
2291-
skb->ip_summed = CHECKSUM_COMPLETE;
2290+
if (rx_csum) {
2291+
skb->csum = (__force __wsum)ntohs(rx_csum);
2292+
skb->ip_summed = CHECKSUM_COMPLETE;
2293+
}
22922294
}
22932295

22942296
/* DMA flags and length are still valid no matter how

0 commit comments

Comments
 (0)