Skip to content

Commit 9b36881

Browse files
T-Xdavem330
authored andcommitted
net: fix bridge multicast packet checksum validation
We need to update the skb->csum after pulling the skb, otherwise an unnecessary checksum (re)computation can ocure for IGMP/MLD packets in the bridge code. Additionally this fixes the following splats for network devices / bridge ports with support for and enabled RX checksum offloading: [...] [ 43.986968] eth0: hw csum failure [ 43.990344] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 4.4.0 rib#2 [ 43.996193] Hardware name: BCM2709 [ 43.999647] [<800204e0>] (unwind_backtrace) from [<8001cf14>] (show_stack+0x10/0x14) [ 44.007432] [<8001cf14>] (show_stack) from [<801ab614>] (dump_stack+0x80/0x90) [ 44.014695] [<801ab614>] (dump_stack) from [<802e4548>] (__skb_checksum_complete+0x6c/0xac) [ 44.023090] [<802e4548>] (__skb_checksum_complete) from [<803a055c>] (ipv6_mc_validate_checksum+0x104/0x178) [ 44.032959] [<803a055c>] (ipv6_mc_validate_checksum) from [<802e111c>] (skb_checksum_trimmed+0x130/0x188) [ 44.042565] [<802e111c>] (skb_checksum_trimmed) from [<803a06e8>] (ipv6_mc_check_mld+0x118/0x338) [ 44.051501] [<803a06e8>] (ipv6_mc_check_mld) from [<803b2c98>] (br_multicast_rcv+0x5dc/0xd00) [ 44.060077] [<803b2c98>] (br_multicast_rcv) from [<803aa510>] (br_handle_frame_finish+0xac/0x51c) [...] Fixes: 9afd85c ("net: Export IGMP/MLD message validation code") Reported-by: Álvaro Fernández Rojas <[email protected]> Signed-off-by: Linus Lüssing <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a4690af commit 9b36881

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

net/core/skbuff.c

+20-2
Original file line numberDiff line numberDiff line change
@@ -2947,6 +2947,24 @@ int skb_append_pagefrags(struct sk_buff *skb, struct page *page,
29472947
}
29482948
EXPORT_SYMBOL_GPL(skb_append_pagefrags);
29492949

2950+
/**
2951+
* skb_push_rcsum - push skb and update receive checksum
2952+
* @skb: buffer to update
2953+
* @len: length of data pulled
2954+
*
2955+
* This function performs an skb_push on the packet and updates
2956+
* the CHECKSUM_COMPLETE checksum. It should be used on
2957+
* receive path processing instead of skb_push unless you know
2958+
* that the checksum difference is zero (e.g., a valid IP header)
2959+
* or you are setting ip_summed to CHECKSUM_NONE.
2960+
*/
2961+
static unsigned char *skb_push_rcsum(struct sk_buff *skb, unsigned len)
2962+
{
2963+
skb_push(skb, len);
2964+
skb_postpush_rcsum(skb, skb->data, len);
2965+
return skb->data;
2966+
}
2967+
29502968
/**
29512969
* skb_pull_rcsum - pull skb and update receive checksum
29522970
* @skb: buffer to update
@@ -4084,9 +4102,9 @@ struct sk_buff *skb_checksum_trimmed(struct sk_buff *skb,
40844102
if (!pskb_may_pull(skb_chk, offset))
40854103
goto err;
40864104

4087-
__skb_pull(skb_chk, offset);
4105+
skb_pull_rcsum(skb_chk, offset);
40884106
ret = skb_chkf(skb_chk);
4089-
__skb_push(skb_chk, offset);
4107+
skb_push_rcsum(skb_chk, offset);
40904108

40914109
if (ret)
40924110
goto err;

0 commit comments

Comments
 (0)