From patchwork Fri Jul 17 14:55:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 235715 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1776791ilg; Fri, 17 Jul 2020 07:55:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm6IQ21/+knOw0km9X431NWiyFXNPPzysdQrKexHc49CMc4qojDLQCuAHFxC7fDDf6+qLK X-Received: by 2002:a17:906:4acc:: with SMTP id u12mr6365583ejt.358.1594997720967; Fri, 17 Jul 2020 07:55:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594997720; cv=none; d=google.com; s=arc-20160816; b=QjAwPuPn83H13RYHXBbdTSQKVKLC0HnMWs7U4/ScVXe56+zbBGKMSs7tNhblREKqjZ RSbBAolslph9/IgMhUvRXBLCd5VtOzBbuKPBeqkdGMfMobCsrbJc5s2Ob/TzFJgvwhH8 pRdyGVv4Q2XI58RrNBMlxVABJXkOAbtbxUzCl/MRDuTsLNxbYe9WPaL7eMBhKz+eGvKa z8v29kb4miKJnA/19X+wmwDamzmsvexoRMrG9R9K4CyMH7h/dYsTecG5tD8Lb99VRVPu E1jZ8QvQmExKPvuRsITMYJMgelu3wXcxkCK+C8Z6GfKELPtr/Hx8tZJOdD0lO/B+bG6F UBhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:to :from:dkim-signature; bh=ILo50kO6ZaOdsTSCv78i0Pa1kXFMMaSNMvFJOAtFzlA=; b=B+08No32hqAJJp41hjvEZCqgJFI4PAEW2WOk+jU8kvMQLmd/OSSQGNPzp7um9E83iw LlOGtzt0thPnBaJZjtFDhyHqoBZ8BDy3hkT4B/VfjoAsNBxq47otQVPJtkDS9sIc+R8+ nnUPD+PUj+mmnq5tp0IIjsNGiU1KM8PMHXfLj4TPvksc8S05yPJi3lUHA2shY1+WLf1F hhZbAA5dZnmttYhoGCoInJ7eTgyB6V+0qTzYBZZx8Po0VwWUp+goMlh9qYLPF4xuasyX hKOz/ke28i3ifsqrhZlsVGCsEaFyTHhcAMUWu/FGxgAQt4kvT+J8H4Sk1tbsirwOlzi9 LDpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="i/hyofjw"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i23si5440637ejj.300.2020.07.17.07.55.20; Fri, 17 Jul 2020 07:55:20 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="i/hyofjw"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726983AbgGQOzR (ORCPT + 9 others); Fri, 17 Jul 2020 10:55:17 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:51220 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbgGQOzQ (ORCPT ); Fri, 17 Jul 2020 10:55:16 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06HEtBDR075663; Fri, 17 Jul 2020 09:55:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594997711; bh=ILo50kO6ZaOdsTSCv78i0Pa1kXFMMaSNMvFJOAtFzlA=; h=From:To:Subject:Date; b=i/hyofjwqwhtDDL014iF3ilR9ymjkqRNoidttj8kSmAtzZnD84n3FUdJY5pGdqVYR 3XSm1qap2Tbt1B2HdLNohm5wcHGOSh3xRhbdrXiT3Jc3lqC7NgQN4SEmsabKq1Y52k 5+3tU9Qq2YUhv11+g+FTenpD5OiZZXgrTG3dtnSg= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06HEtB0u066964; Fri, 17 Jul 2020 09:55:11 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 17 Jul 2020 09:55:10 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Fri, 17 Jul 2020 09:55:11 -0500 Received: from uda0868495.fios-router.home (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06HEtAg0090872; Fri, 17 Jul 2020 09:55:10 -0500 From: Murali Karicheri To: , , , , , , Subject: [PATCH 1/2 v2] net: hsr: fix incorrect lsdu size in the tag of HSR frames for small frames Date: Fri, 17 Jul 2020 10:55:09 -0400 Message-ID: <20200717145510.30433-1-m-karicheri2@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For small Ethernet frames with size less than minimum size 66 for HSR vs 60 for regular Ethernet frames, hsr driver currently doesn't pad the frame to make it minimum size. This results in incorrect LSDU size being populated in the HSR tag for these frames. Fix this by padding the frame to the minimum size applicable for HSR. Signed-off-by: Murali Karicheri --- no change from original version Sending this bug fix ahead of PRP patch series as per comment net/hsr/hsr_forward.c | 3 +++ 1 file changed, 3 insertions(+) Sending this bug fix ahead of PRP patch series as per comment -- 2.17.1 diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c index ed13760463de..e42fd356f073 100644 --- a/net/hsr/hsr_forward.c +++ b/net/hsr/hsr_forward.c @@ -127,6 +127,9 @@ static void hsr_fill_tag(struct sk_buff *skb, struct hsr_frame_info *frame, int lane_id; int lsdu_size; + /* pad to minimum packet size which is 60 + 6 (HSR tag) */ + skb_put_padto(skb, ETH_ZLEN + HSR_HLEN); + if (port->type == HSR_PT_SLAVE_A) lane_id = 0; else From patchwork Fri Jul 17 14:55:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 235716 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1776827ilg; Fri, 17 Jul 2020 07:55:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfy91ZJ3OYE/3hq9xrnk8qGWNOT2ZaSIbnqLx2FDfABSgT5onVGQtY2zOgsLxFdGgbhDU2 X-Received: by 2002:a50:8adb:: with SMTP id k27mr9215075edk.267.1594997724079; Fri, 17 Jul 2020 07:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594997724; cv=none; d=google.com; s=arc-20160816; b=UBbNjA2An7nvzakd8z3RCTapM4QUK694bCvjfYBSn14xjJmBMNEqAg7xYO29+tp/jT SiTHtj1xQsg+UY6+OPoULqfbhPk0wTgTWFREKNkrC1HUBoFid1RflimnZ/2E2ToVWiwI CQjHgu0TzT943bh4W6wwfPLQJb8BtxSDzoa6JRJvkdk7LGQOKcQhwipviYEz7ez+uhNw BPfNoI+Jqmua6Vn0AGejfvXwkg3bowo1+vNVyWNvI2RxmIoJUKcmQy7cbLT78SEJ5bzE cMbb25r9SevsJ6tUCXcvyk0VHHZ29aRaa5XVlrqgfMMxuj/p8wk8eKH9JoG0qI23SRS1 rlEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=zA/6AiizyA2x66ZytfmSRMYHubOCr0hWqV9pw3bpcQA=; b=oWTQhGN0FrBJEMje7xZVBPhxy/Y7dfqPtMQA1Lw/9atFdyU/9slEZe4NzZtJ0k99GR Aq/0WRhFx+u58MVN3xggycHt3RKvu9NNfuGM+NJ1S5rUfCIoOTOvLFQ0tKomreMTIRES 3w3zweooCk/bZFJc1o7IIc1TQzzgSadyNKjgmzbEYiAiOg1IoCD1wSLOPSg3V45fRT2K dh+dZkaZvNuK/9GBzLhQpx/3tauSh6MIqtkmI7w2z9DfeXQlOv7Kys5K9sXRbDXJMxHp HmPLethTB5yqYKflwvVZv68SRlE5kRyr4LIDjPCM5jkVNV2T2GcwTJdk+3e+bgC7lGez 8HEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=vF7uwz3R; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i23si5440637ejj.300.2020.07.17.07.55.23; Fri, 17 Jul 2020 07:55:24 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=vF7uwz3R; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726867AbgGQOzR (ORCPT + 9 others); Fri, 17 Jul 2020 10:55:17 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:60628 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726233AbgGQOzQ (ORCPT ); Fri, 17 Jul 2020 10:55:16 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06HEtBZl006684; Fri, 17 Jul 2020 09:55:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594997711; bh=zA/6AiizyA2x66ZytfmSRMYHubOCr0hWqV9pw3bpcQA=; h=From:To:Subject:Date:In-Reply-To:References; b=vF7uwz3R9b+Jtn4oEajY9b/D+bgQ74JIeAxCPrQnbIyUCGuBYKEvAlr9PfGx6Xypf 9zpuy1k3bkFfAWaZughSMwHGu19sH3OnkpRtGIAr/M1tTt5YGmMbdychzEmAHmyhL/ x4k29P66qV9dnBAjHIgy3MQgbI19U+48vOB9jU1c= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06HEtBbM072224 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 17 Jul 2020 09:55:11 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 17 Jul 2020 09:55:11 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Fri, 17 Jul 2020 09:55:11 -0500 Received: from uda0868495.fios-router.home (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06HEtAg1090872; Fri, 17 Jul 2020 09:55:11 -0500 From: Murali Karicheri To: , , , , , , Subject: [PATCH 2/2 v2] net: hsr: validate address B before copying to skb Date: Fri, 17 Jul 2020 10:55:10 -0400 Message-ID: <20200717145510.30433-2-m-karicheri2@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200717145510.30433-1-m-karicheri2@ti.com> References: <20200717145510.30433-1-m-karicheri2@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Validate MAC address before copying the same to outgoing frame skb destination address. Since a node can have zero mac address for Link B until a valid frame is received over that link, this fix address the issue of a zero MAC address being in the packet. Signed-off-by: Murali Karicheri --- Removing prp prefix from subject line. Sending this bug fix ahead of PRP patch series as per comment net/hsr/hsr_framereg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index 03b891904314..530de24b1fb5 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c @@ -325,7 +325,8 @@ void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb, if (port->type != node_dst->addr_B_port) return; - ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->macaddress_B); + if (is_valid_ether_addr(node_dst->macaddress_B)) + ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->macaddress_B); } void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,