Skip to content

Commit 2550afb

Browse files
Doug Bergergregkh
authored andcommitted
net: bcmgenet: skip invalid partial checksums
[ Upstream commit 0f643c8 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent bf5b7aa commit 2550afb

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
@@ -2239,8 +2239,10 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
22392239
dma_length_status = status->length_status;
22402240
if (dev->features & NETIF_F_RXCSUM) {
22412241
rx_csum = (__force __be16)(status->rx_csum & 0xffff);
2242-
skb->csum = (__force __wsum)ntohs(rx_csum);
2243-
skb->ip_summed = CHECKSUM_COMPLETE;
2242+
if (rx_csum) {
2243+
skb->csum = (__force __wsum)ntohs(rx_csum);
2244+
skb->ip_summed = CHECKSUM_COMPLETE;
2245+
}
22442246
}
22452247

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

0 commit comments

Comments
 (0)