From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AA50C2D0A8 for ; Tue, 29 Sep 2020 01:32:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 009212080A for ; Tue, 29 Sep 2020 01:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601343156; bh=bcv8Lud4gs41IJaT0W7P1F4O8D4lq4qTnSGKz0wkDY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SXzyHFOCn7vrM2c2dMJUIx8Ogx4lGkzOfqOIUF0h+E3H91hxkp68Cll4lFXZpHdJX Zj+7GcFuxPqM/PdJ7SDuws6J53B/3k0IKYf3umUOGdG1WsIIUl43tstvH7qqhhLRv7 i03UHsGNL/FzgPs650KsgtR8PHHzdwxqQ9mPQ8ls= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727873AbgI2Bcf (ORCPT ); Mon, 28 Sep 2020 21:32:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:41830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727792AbgI2BcL (ORCPT ); Mon, 28 Sep 2020 21:32:11 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E6F96216C4; Tue, 29 Sep 2020 01:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601343129; bh=bcv8Lud4gs41IJaT0W7P1F4O8D4lq4qTnSGKz0wkDY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TetYxnpYVaIVpkOGI9AkxUlqzgDokBrhjPCK5sPBn8GAz46YvBCbbBWY4Hil6erQz EH4Q0SswovF57kC64PPMd56RBlTvyzUH2/yk5jmuD1lFsFz8rbiis/FLIq05oDw/5r omDF23Q8gr4nmk+o1gy/1rb9JV3wTP2u4VZ8F3mU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xie He , Martin Schiller , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.4 3/4] drivers/net/wan/lapbether: Make skb->protocol consistent with the header Date: Mon, 28 Sep 2020 21:32:04 -0400 Message-Id: <20200929013205.2407201-3-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200929013205.2407201-1-sashal@kernel.org> References: <20200929013205.2407201-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xie He [ Upstream commit 83f9a9c8c1edc222846dc1bde6e3479703e8e5a3 ] This driver is a virtual driver stacked on top of Ethernet interfaces. When this driver transmits data on the Ethernet device, the skb->protocol setting is inconsistent with the Ethernet header prepended to the skb. This causes a user listening on the Ethernet interface with an AF_PACKET socket, to see different sll_protocol values for incoming and outgoing frames, because incoming frames would have this value set by parsing the Ethernet header. This patch changes the skb->protocol value for outgoing Ethernet frames, making it consistent with the Ethernet header prepended. This makes a user listening on the Ethernet device with an AF_PACKET socket, to see the same sll_protocol value for incoming and outgoing frames. Cc: Martin Schiller Signed-off-by: Xie He Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/wan/lapbether.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c index c6db9a4e7c457..ef746ba74ab4c 100644 --- a/drivers/net/wan/lapbether.c +++ b/drivers/net/wan/lapbether.c @@ -201,8 +201,6 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) struct net_device *dev; int size = skb->len; - skb->protocol = htons(ETH_P_X25); - ptr = skb_push(skb, 2); *ptr++ = size % 256; @@ -213,6 +211,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) skb->dev = dev = lapbeth->ethdev; + skb->protocol = htons(ETH_P_DEC); + skb_reset_network_header(skb); dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0); -- 2.25.1