Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3440706pxk; Mon, 28 Sep 2020 18:33:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSCn9tBitEB+soiTscWbGqZAvgct7iPx/9kq9pTkWIX3QZctSGZyX2j0uUlQBF7vYAgKxm X-Received: by 2002:aa7:d1d5:: with SMTP id g21mr479184edp.207.1601343185422; Mon, 28 Sep 2020 18:33:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601343185; cv=none; d=google.com; s=arc-20160816; b=gw0W1nD7p/BCYeZ0/W6wSn32JWWO6cbIYFj6/LuGH3smDoBNftuSCCb9LzYV2C6ARv EPhNjM71KmLdng28jcFLwZBCTjzlJC7jC+G+YE0bhzwcxw/5K+TNReXbuyfsbsfGHqDz HNp52922suuIBSkbQvUQwUjgGe1WRI8vnkUhiDaMpq+1EZIQArRp/uRkRnTPgDkHHMnf zp5069ZPl6LMu1p/lgSS0T0K3jvd8Rr53OsXLOb8q4DiX0t4PCeQfVjsfjzn4SOP0b3i FLWexq+cT/JDY7ChA54a7p49jCew5S7ZhyqbokL1QCtuT9/J7FjxzY7jjRpFaV0jdn/b 9O+w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zTJDXGhLHHFUEArHoADU//FeI5hA7DxmrRiebQrx+9s=; b=RVchgLXMwDTm0Rvm2s+P2YPhMHsma23Ar+VVUAyrzwoWEtaFzo8Ua2lPpLlWSUoNgM nIsTxpgy8cdJGclri/5iP1fR4TauckUg7Iy5Poj36DeRLCkQ05DypCPWQAdCuy3UV1U9 Anyp1CxVAXNngwG97vNLHTrgXKDWmT2Cum07mRtIIvwlmacMnL22D9UdwlzoHEv/Mfyz ETACwcOx6aXRs51xh/A7PAA/QfVGp9OO091oYIMf5DuLliWLhgbUEDrZtbQXEvqqfWRn 8JnTC8x4VMkYGDQ2mmXrGA2IzfQiwqv8yrZvEYW5O+kYuHQxFd6k/IjZhU9gKh6wxp7P x6bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NWslRM2b; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h17si1707078ejq.747.2020.09.28.18.32.37; Mon, 28 Sep 2020 18:33:05 -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=@kernel.org header.s=default header.b=NWslRM2b; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727471AbgI2Ba7 (ORCPT + 99 others); Mon, 28 Sep 2020 21:30:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:39928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727410AbgI2Baw (ORCPT ); Mon, 28 Sep 2020 21:30:52 -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 110EA21D46; Tue, 29 Sep 2020 01:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601343048; bh=vCcve0wi8t7ey0BmtIhX6anlHczScg0Iv+pVMrRjvdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NWslRM2bOsIxUCju8cfkAK8ELDMwZ2Nr03uyjVBDkczOxvsrQ+BKeb55es7NTZWfR miRZt++H4wBjr3s8QoyUdtkxwQYy2xJwsS7ckLuoubxln5dBnmR75hLMz6HjpVrrpg 6Ttj+Aiddc99yn5s0sutRn5EXfZ9OZoH3MiImS7k= 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 5.8 16/29] drivers/net/wan/lapbether: Make skb->protocol consistent with the header Date: Mon, 28 Sep 2020 21:30:13 -0400 Message-Id: <20200929013027.2406344-16-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200929013027.2406344-1-sashal@kernel.org> References: <20200929013027.2406344-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 e61616b0b91c7..b726101d4707a 100644 --- a/drivers/net/wan/lapbether.c +++ b/drivers/net/wan/lapbether.c @@ -198,8 +198,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; @@ -210,6 +208,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