Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1088466ybt; Wed, 1 Jul 2020 18:36:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxreV/MNtSnw6/mdwy4E707qJAL8K4V/pffKVWK/uJGtzW0+MacPhRCPkKVyr3yE/eE63IX X-Received: by 2002:a17:906:940f:: with SMTP id q15mr26161501ejx.470.1593653770347; Wed, 01 Jul 2020 18:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593653770; cv=none; d=google.com; s=arc-20160816; b=FzRQi/NL0lFeh6olGJWezY7ATS4VuPU6Bp+8RhtQ3rLSgJivBeY2vGVLqIboy6Yqox 4iruoGM27eAI+zcRmndF48KeTJ0l/s3/ENL5k7hGZ84oIsWJatJDE1VQ9qhzSX/gUPIx JKZnBrMiIWKMNa2ZQyx8I8xYkO7d6cTbiEOecrjr0G5K8IJmNNJuToKAKW5FHUZc4vGu zkURicGeMHnfGcnR5YJf/a2m/oNvK/fCTgl2qoanfXBHDnSXdggETQMB0vswUmwUJO0q mp2OTJ7oZJL6JHGd04VBMzjSpRgpnRWfccEpto4jl5jk9Y9qCkON/b/4Kq1rclwWSJFR IoqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yTYwcIpJz/hDIqbwlFT+9iFBeMYbassRCoixI6DI0FU=; b=igHZ79iGN5jExtqqOgLqf26HI6jLgkVas870Pc8tNgsO0W/Z6kt+Ub0iKGCGm16nMQ DNNfJCbCTuSRo/giK3l/tQeBYFglp5CczKTSAWGGDWMNVvnSQyt+5JAV5TAdTbkNZbBT JHPYW2DRfwzUzM/Bi77wqgFjZryHUoDE5RqW74T6zvChMeGEqBxR29/FRxCjKPVZlSt3 W9cDjWWdqIme51cLVGpt7orRXnh4jUozqEHQMYY5Ctxv7mb+v63LUCObo+r1WPae/pNP jM1Zk9zaxlOAY/M+ZA6f4un+QnF4419RQEqiGvGlj8wnETXlxperulA68vC2ztgNPfqp MMYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kqC8H64a; 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 v8si4917289edr.557.2020.07.01.18.35.46; Wed, 01 Jul 2020 18:36:10 -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=kqC8H64a; 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 S1728332AbgGBBXZ (ORCPT + 99 others); Wed, 1 Jul 2020 21:23:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:53746 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728256AbgGBBXR (ORCPT ); Wed, 1 Jul 2020 21:23:17 -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 8C73F20748; Thu, 2 Jul 2020 01:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593652996; bh=27HmbMVf7TIt+n99FWWFvZ4hX+iwRh6GrUkWrpJrksw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kqC8H64at90Y63t1HhXNqXBMb9XaloiEpwDvQvHowrrQppy3g8GvmrGPnx8eE+oXN I6HGaOGGI1A8rZ0DwfTUHncK9SC64HaVqlsZBaeyQ/vkS2v2GS+U2pB/wRtvG4aqDC CgB1TdFpVzVPPm1rmpOD/5jp9HMFkRi71tZUpapU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jeremy Kerr , "David S . Miller" , Sasha Levin , linux-usb@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 17/53] net: usb: ax88179_178a: fix packet alignment padding Date: Wed, 1 Jul 2020 21:21:26 -0400 Message-Id: <20200702012202.2700645-17-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200702012202.2700645-1-sashal@kernel.org> References: <20200702012202.2700645-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: Jeremy Kerr [ Upstream commit e869e7a17798d85829fa7d4f9bbe1eebd4b2d3f6 ] Using a AX88179 device (0b95:1790), I see two bytes of appended data on every RX packet. For example, this 48-byte ping, using 0xff as a payload byte: 04:20:22.528472 IP 192.168.1.1 > 192.168.1.2: ICMP echo request, id 2447, seq 1, length 64 0x0000: 000a cd35 ea50 000a cd35 ea4f 0800 4500 0x0010: 0054 c116 4000 4001 f63e c0a8 0101 c0a8 0x0020: 0102 0800 b633 098f 0001 87ea cd5e 0000 0x0030: 0000 dcf2 0600 0000 0000 ffff ffff ffff 0x0040: ffff ffff ffff ffff ffff ffff ffff ffff 0x0050: ffff ffff ffff ffff ffff ffff ffff ffff 0x0060: ffff 961f Those last two bytes - 96 1f - aren't part of the original packet. In the ax88179 RX path, the usbnet rx_fixup function trims a 2-byte 'alignment pseudo header' from the start of the packet, and sets the length from a per-packet field populated by hardware. It looks like that length field *includes* the 2-byte header; the current driver assumes that it's excluded. This change trims the 2-byte alignment header after we've set the packet length, so the resulting packet length is correct. While we're moving the comment around, this also fixes the spelling of 'pseudo'. Signed-off-by: Jeremy Kerr Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/ax88179_178a.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 93044cf1417a5..1fe4cc28d154d 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -1414,10 +1414,10 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb) } if (pkt_cnt == 0) { - /* Skip IP alignment psudo header */ - skb_pull(skb, 2); skb->len = pkt_len; - skb_set_tail_pointer(skb, pkt_len); + /* Skip IP alignment pseudo header */ + skb_pull(skb, 2); + skb_set_tail_pointer(skb, skb->len); skb->truesize = pkt_len + sizeof(struct sk_buff); ax88179_rx_checksum(skb, pkt_hdr); return 1; @@ -1426,8 +1426,9 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb) ax_skb = skb_clone(skb, GFP_ATOMIC); if (ax_skb) { ax_skb->len = pkt_len; - ax_skb->data = skb->data + 2; - skb_set_tail_pointer(ax_skb, pkt_len); + /* Skip IP alignment pseudo header */ + skb_pull(ax_skb, 2); + skb_set_tail_pointer(ax_skb, ax_skb->len); ax_skb->truesize = pkt_len + sizeof(struct sk_buff); ax88179_rx_checksum(ax_skb, pkt_hdr); usbnet_skb_return(dev, ax_skb); -- 2.25.1