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.2 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 DB3FBC43461 for ; Mon, 7 Sep 2020 16:53:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9BFE2207DE for ; Mon, 7 Sep 2020 16:53:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599497623; bh=OYWucVYP7dD+UA/1BSwGw/P5H+lgPztv1OB0A580bek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=JegiTq42qZ7T0qE22DfPYBrIcSDiN0EnXigSl/t52WPsB3FV2Fh4qEEbSdhz3TpOS euTphCs1P/7Be6ijz3qQzcgjdiB9ls8zZNg0946h5giDKBQ03tLeFxLntPqxVKpRn3 j36Sl6vrJbx7lgcYHpNf4ywSk5/7iBSZP/Z+tDfA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730822AbgIGQxl (ORCPT ); Mon, 7 Sep 2020 12:53:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:48568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730761AbgIGQek (ORCPT ); Mon, 7 Sep 2020 12:34:40 -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 14A3921D94; Mon, 7 Sep 2020 16:34:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599496476; bh=OYWucVYP7dD+UA/1BSwGw/P5H+lgPztv1OB0A580bek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A20kiOSuLpBt5Afsk/kK0jxO9PNUi6Qrm2PfMkNMmXRiNjSKO+ws11cv/dBR55h1K E+yjZ0o04/0slNSiIa/U1fzfe320mR5/6OUyJLAygu6TdBPzjiR1R2LclQLxZmamBL TxXvfQsOY+eG/g5AUMFaHmlSvxe7l0PZO7z9aTP4= 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.19 08/26] drivers/net/wan/lapbether: Set network_header before transmitting Date: Mon, 7 Sep 2020 12:34:08 -0400 Message-Id: <20200907163426.1281284-8-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200907163426.1281284-1-sashal@kernel.org> References: <20200907163426.1281284-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xie He [ Upstream commit 91244d108441013b7367b3b4dcc6869998676473 ] Set the skb's network_header before it is passed to the underlying Ethernet device for transmission. This patch fixes the following issue: When we use this driver with AF_PACKET sockets, there would be error messages of: protocol 0805 is buggy, dev (Ethernet interface name) printed in the system "dmesg" log. This is because skbs passed down to the Ethernet device for transmission don't have their network_header properly set, and the dev_queue_xmit_nit function in net/core/dev.c complains about this. Reason of setting the network_header to this place (at the end of the Ethernet header, and at the beginning of the Ethernet payload): Because when this driver receives an skb from the Ethernet device, the network_header is also set at this place. Cc: Martin Schiller Signed-off-by: Xie He Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/wan/lapbether.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c index 6b2553e893aca..15177a54b17d7 100644 --- a/drivers/net/wan/lapbether.c +++ b/drivers/net/wan/lapbether.c @@ -213,6 +213,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) skb->dev = dev = lapbeth->ethdev; + skb_reset_network_header(skb); + dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0); dev_queue_xmit(skb); -- 2.25.1