Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2310203imm; Thu, 7 Jun 2018 08:34:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLEW+g1U0/euWfm2xm2PNr+hfq4WYk70M+NKnHrlLnM4hathmGKcku1aTILMHeAlmDZNx5G X-Received: by 2002:a17:902:88:: with SMTP id a8-v6mr2501770pla.156.1528385657070; Thu, 07 Jun 2018 08:34:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528385657; cv=none; d=google.com; s=arc-20160816; b=yZ+JIBN67TIHmpULb0j+EfyGwoHOG1XVplcIjCeiFENe0nTuydwxXRDT6WLpAWrs9O MnigE69sGkhMkIjR7qaZAaDrVPipFGgY9TYjSr9RI66SxRsKkFU6p/9F1IENCjl228JY Z/oQJMQRqLPUtM63cEbSSlPSjOeVQKJA9mWRFj3K5L1ReQpW6M/LoEQrEtODV5iS/zQP GRgOWx66KM0dQpJEF9iUg5z+EfHK6CIMtTYs83X9x5JEjeg2ZBwuVo2IojKg5PmuhPKA b4zdCAcjq5fUMOYtWf1BxiE8d9tWCJ1I2mtiCa4qwaHd7NK0K24QuWjDDb3zcVaCJIoH Hutw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=yZ8UbUTunRLlrV6dZMESMzzkSFGRbvu6/XvbA4rS6tY=; b=j8CDMXxIScgVbBoRGaJTRTEGv6VgW/GB0jUMLJeOwgxZre17hYhBVAnEoC5zqRQvvb zDvr66eQI40KDaEB+Qd3XiaXFPIGm/RRB8u9pNpT47FCgFiAmyYMAIcMtyXHHBkhVCAC Zi2bZF/vV1h1UMfWCuiJDspHKsNMBDtS+XTQCGzzXw1BaJDSEihZY2IL8E4iuDzGbAvl Cy0oTd9pl752hhWeVrgPD1NLk15fU7VtB5qtcAZoPvu783+9o9sodM++FqrPWslBxb6b 9ehp2xgQmELtcf09vCY+Mnw/gUXig9XtwE1wq6GPFTuY4MhoBXWhJYwHSO4fT3ksO1MG jaJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9-v6si22303340pgp.558.2018.06.07.08.34.01; Thu, 07 Jun 2018 08:34:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935230AbeFGOwz (ORCPT + 99 others); Thu, 7 Jun 2018 10:52:55 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:40924 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934776AbeFGOwv (ORCPT ); Thu, 7 Jun 2018 10:52:51 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbN-0005dI-5X; Thu, 07 Jun 2018 15:09:21 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvbD-0003Gn-Gw; Thu, 07 Jun 2018 15:09:11 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Sven Eckelmann" , "Simon Wunderlich" , "Matthias Schiffer" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 373/410] batman-adv: Fix skbuff rcsum on packet reroute In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Sven Eckelmann commit fc04fdb2c8a894283259f5621d31d75610701091 upstream. batadv_check_unicast_ttvn may redirect a packet to itself or another originator. This involves rewriting the ttvn and the destination address in the batadv unicast header. These field were not yet pulled (with skb rcsum update) and thus any change to them also requires a change in the receive checksum. Reported-by: Matthias Schiffer Fixes: a73105b8d4c7 ("batman-adv: improved client announcement mechanism") Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- net/batman-adv/routing.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -687,6 +687,7 @@ out: /** * batadv_reroute_unicast_packet - update the unicast header for re-routing * @bat_priv: the bat priv with all the soft interface information + * @skb: unicast packet to process * @unicast_packet: the unicast header to be updated * @dst_addr: the payload destination * @vid: VLAN identifier @@ -698,7 +699,7 @@ out: * Returns true if the packet header has been updated, false otherwise */ static bool -batadv_reroute_unicast_packet(struct batadv_priv *bat_priv, +batadv_reroute_unicast_packet(struct batadv_priv *bat_priv, struct sk_buff *skb, struct batadv_unicast_packet *unicast_packet, uint8_t *dst_addr, unsigned short vid) { @@ -727,8 +728,10 @@ batadv_reroute_unicast_packet(struct bat } /* update the packet header */ + skb_postpull_rcsum(skb, unicast_packet, sizeof(*unicast_packet)); ether_addr_copy(unicast_packet->dest, orig_addr); unicast_packet->ttvn = orig_ttvn; + skb_postpush_rcsum(skb, unicast_packet, sizeof(*unicast_packet)); ret = true; out: @@ -768,7 +771,7 @@ static int batadv_check_unicast_ttvn(str * the packet to */ if (batadv_tt_local_client_is_roaming(bat_priv, ethhdr->h_dest, vid)) { - if (batadv_reroute_unicast_packet(bat_priv, unicast_packet, + if (batadv_reroute_unicast_packet(bat_priv, skb, unicast_packet, ethhdr->h_dest, vid)) net_ratelimited_function(batadv_dbg, BATADV_DBG_TT, bat_priv, @@ -814,7 +817,7 @@ static int batadv_check_unicast_ttvn(str * destination can possibly be updated and forwarded towards the new * target host */ - if (batadv_reroute_unicast_packet(bat_priv, unicast_packet, + if (batadv_reroute_unicast_packet(bat_priv, skb, unicast_packet, ethhdr->h_dest, vid)) { net_ratelimited_function(batadv_dbg, BATADV_DBG_TT, bat_priv, "Rerouting unicast packet to %pM (dst=%pM): TTVN mismatch old_ttvn=%u new_ttvn=%u\n", @@ -837,12 +840,14 @@ static int batadv_check_unicast_ttvn(str if (!primary_if) return 0; + /* update the packet header */ + skb_postpull_rcsum(skb, unicast_packet, sizeof(*unicast_packet)); ether_addr_copy(unicast_packet->dest, primary_if->net_dev->dev_addr); + unicast_packet->ttvn = curr_ttvn; + skb_postpush_rcsum(skb, unicast_packet, sizeof(*unicast_packet)); batadv_hardif_free_ref(primary_if); - unicast_packet->ttvn = curr_ttvn; - return 1; }