Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2095022pxb; Mon, 12 Apr 2021 14:20:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx43vyHP2OZ2YtQWVgVruI5cOqHNb9rXMMmOUKWNBp3AWcToR+xHWDjOiyvF/D61DAjCP3q X-Received: by 2002:a17:906:4c91:: with SMTP id q17mr29421001eju.0.1618262424322; Mon, 12 Apr 2021 14:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618262424; cv=none; d=google.com; s=arc-20160816; b=caH5ttdguntFjvqf+ZpbedN1+U3qSie5BsV87lqyyTnGlWcOc2ks4PqUT8tiVwXOrR yHcBFIt/f1zXWmZ/fBIIZqkPHiUtchdE2chxdX/HKsyibUp06n/ZMp5vuIKu4bCUob4v r/lRQqI9k2WKwALOawxseDbWlNcl6Ya/+1Qw0nLpYGXexPissKjS7pHAEU7MxOrYwQc4 MJwlg9dy1sgbYTpMoCnZA9MO5ePO9dyVsEgp0o0GhOodw9ZxPkboZzgfmYUEqRlhSLLu rZDZ/DwJUPLHeF+bpvj63unExM7ULaPoIL/Lg/wBqZnj3Q9xrjKSl1OtgMvdnUzrUZYT 6PaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=89yN92pw9JJCsp0NDsLYC4+Lyq7Ee4l8do/AumDR0u4=; b=Ulc+SWbTimTXfI8rpLxhnRGR4YCmLEIn8V87DlyzUWnUPpPQBQjKhabeseUjEu4rp/ l4B/vRxPq98IVYr2QzeOh03AU6Pl++oBQH9/gmfwxT+Yok576x3OzBfaF4OrwPavFAh4 FtweE2eFsC4BNMsqzQUWgJoDclzC0XKpFElCFjZ0yzEi6xrIJhYOzeLn98rgq8OBrgP8 bmV6dPG0hgN97QKCaC+N7/wew9Fgj7+ZeQLQVHPW+3VXNlwcRdGGxxUaYDW7VEFYALSz M4kYXhLE8MYwOGIP8uqRvSD1dv96j2FOfG3T3B5grOuEMTLjEmG45PMX3tCGDb9SSxIH Uwyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="WywlS/sz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si8292024edr.328.2021.04.12.14.20.01; Mon, 12 Apr 2021 14:20:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b="WywlS/sz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239727AbhDLJIK (ORCPT + 99 others); Mon, 12 Apr 2021 05:08:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:47594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238990AbhDLIzR (ORCPT ); Mon, 12 Apr 2021 04:55:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 317A861285; Mon, 12 Apr 2021 08:54:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217672; bh=soO65RWWiAufIVqij2Tf9tJ6jf33ypvx+Bw7cZSUuJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WywlS/szzVvrLeskUMhMV5oImjiZY+SfQmF6o2mQdHxYVTh62KtIq7n4nzdrorNEy wuEhk2mD4qBNZdLBmPCzgfp7J/60AUNvvzNfB5PS42Qv8iChToS6/IXXM0NVjbgEbd 1ltGVb8l0nxvOdphGmMmUY7l/b1/kg7GgSPFzzT0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kurt Kanzenbach , Eric Dumazet , "David S. Miller" Subject: [PATCH 5.10 068/188] net: hsr: Reset MAC header for Tx path Date: Mon, 12 Apr 2021 10:39:42 +0200 Message-Id: <20210412084015.919473844@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084013.643370347@linuxfoundation.org> References: <20210412084013.643370347@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kurt Kanzenbach commit 9d6803921a16f4d768dc41a75375629828f4d91e upstream. Reset MAC header in HSR Tx path. This is needed, because direct packet transmission, e.g. by specifying PACKET_QDISC_BYPASS does not reset the MAC header. This has been observed using the following setup: |$ ip link add name hsr0 type hsr slave1 lan0 slave2 lan1 supervision 45 version 1 |$ ifconfig hsr0 up |$ ./test hsr0 The test binary is using mmap'ed sockets and is specifying the PACKET_QDISC_BYPASS socket option. This patch resolves the following warning on a non-patched kernel: |[ 112.725394] ------------[ cut here ]------------ |[ 112.731418] WARNING: CPU: 1 PID: 257 at net/hsr/hsr_forward.c:560 hsr_forward_skb+0x484/0x568 |[ 112.739962] net/hsr/hsr_forward.c:560: Malformed frame (port_src hsr0) The warning can be safely removed, because the other call sites of hsr_forward_skb() make sure that the skb is prepared correctly. Fixes: d346a3fae3ff ("packet: introduce PACKET_QDISC_BYPASS socket option") Signed-off-by: Kurt Kanzenbach Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/hsr/hsr_device.c | 1 + net/hsr/hsr_forward.c | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -217,6 +217,7 @@ static netdev_tx_t hsr_dev_xmit(struct s master = hsr_port_get_hsr(hsr, HSR_PT_MASTER); if (master) { skb->dev = master->dev; + skb_reset_mac_header(skb); hsr_forward_skb(skb, master); } else { atomic_long_inc(&dev->tx_dropped); --- a/net/hsr/hsr_forward.c +++ b/net/hsr/hsr_forward.c @@ -528,12 +528,6 @@ void hsr_forward_skb(struct sk_buff *skb { struct hsr_frame_info frame; - if (skb_mac_header(skb) != skb->data) { - WARN_ONCE(1, "%s:%d: Malformed frame (port_src %s)\n", - __FILE__, __LINE__, port->dev->name); - goto out_drop; - } - if (fill_frame_info(&frame, skb, port) < 0) goto out_drop;