linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Sean Anderson <seanga2@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>, Jakub Kicinski <kuba@kernel.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.14 34/40] net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD
Date: Mon, 26 Sep 2022 12:12:02 +0200	[thread overview]
Message-ID: <20220926100739.622384540@linuxfoundation.org> (raw)
In-Reply-To: <20220926100738.148626940@linuxfoundation.org>

From: Sean Anderson <seanga2@gmail.com>

[ Upstream commit 878e2405710aacfeeb19364c300f38b7a9abfe8f ]

There is a separate receive path for small packets (under 256 bytes).
Instead of allocating a new dma-capable skb to be used for the next packet,
this path allocates a skb and copies the data into it (reusing the existing
sbk for the next packet). There are two bytes of junk data at the beginning
of every packet. I believe these are inserted in order to allow aligned DMA
and IP headers. We skip over them using skb_reserve. Before copying over
the data, we must use a barrier to ensure we see the whole packet. The
current code only synchronizes len bytes, starting from the beginning of
the packet, including the junk bytes. However, this leaves off the final
two bytes in the packet. Synchronize the whole packet.

To reproduce this problem, ping a HME with a payload size between 17 and
214

	$ ping -s 17 <hme_address>

which will complain rather loudly about the data mismatch. Small packets
(below 60 bytes on the wire) do not have this issue. I suspect this is
related to the padding added to increase the minimum packet size.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20220920235018.1675956-1-seanga2@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/sun/sunhme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index 7522f277e912..bfa8c0424913 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -2065,9 +2065,9 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev)
 
 			skb_reserve(copy_skb, 2);
 			skb_put(copy_skb, len);
-			dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE);
+			dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len + 2, DMA_FROM_DEVICE);
 			skb_copy_from_linear_data(skb, copy_skb->data, len);
-			dma_sync_single_for_device(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE);
+			dma_sync_single_for_device(hp->dma_dev, dma_addr, len + 2, DMA_FROM_DEVICE);
 			/* Reuse original ring buffer. */
 			hme_write_rxd(hp, this,
 				      (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)),
-- 
2.35.1




  parent reply	other threads:[~2022-09-26 10:25 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 10:11 [PATCH 4.14 00/40] 4.14.295-rc1 review Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 01/40] of: fdt: fix off-by-one error in unflatten_dt_nodes() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 02/40] gpio: mpc8xxx: Fix support for IRQ_TYPE_LEVEL_LOW flow_type in mpc85xx Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 03/40] drm/meson: Correct OSD1 global alpha value Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 04/40] parisc: ccio-dma: Add missing iounmap in error path in ccio_probe() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 05/40] efi/libstub: Disable Shadow Call Stack Greg Kroah-Hartman
2022-09-26 11:14   ` Pavel Machek
2022-09-26 15:56     ` Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 06/40] efi: libstub: Disable struct randomization Greg Kroah-Hartman
2022-09-26 11:08   ` Pavel Machek
2022-09-26 14:16     ` Ard Biesheuvel
2022-09-26 15:53       ` Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 07/40] cifs: dont send down the destination address to sendmsg for a SOCK_STREAM Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 08/40] ASoC: nau8824: Fix semaphore unbalance at error paths Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 09/40] regulator: pfuze100: Fix the global-out-of-bounds access in pfuze100_regulator_probe() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 10/40] ALSA: hda/sigmatel: Keep power up while beep is enabled Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 11/40] net: usb: qmi_wwan: add Quectel RM520N Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 12/40] MIPS: OCTEON: irq: Fix octeon_irq_force_ciu_mapping() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 13/40] mksysmap: Fix the mismatch of L0 symbols in System.map Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 14/40] video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 15/40] ALSA: hda/sigmatel: Fix unused variable warning for beep power change Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 16/40] wifi: mac80211: Fix UAF in ieee80211_scan_rx() Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 17/40] USB: core: Fix RST error in hub.c Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 18/40] USB: serial: option: add Quectel BG95 0x0203 composition Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 19/40] USB: serial: option: add Quectel RM520N Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 20/40] ALSA: hda/tegra: set depop delay for tegra Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 21/40] ALSA: hda: add Intel 5 Series / 3400 PCI DID Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 22/40] mm/slub: fix to return errno if kmalloc() fails Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 23/40] arm64: dts: rockchip: Remove enable-active-low from rk3399-puma Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 24/40] netfilter: nf_conntrack_sip: fix ct_sip_walk_headers Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 25/40] netfilter: nf_conntrack_irc: Tighten matching on DCC message Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 26/40] iavf: Fix cached head and tail value for iavf_get_tx_pending Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 27/40] ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 28/40] net: team: Unsync device addresses on ndo_stop Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 29/40] MIPS: lantiq: export clk_get_io() for lantiq_wdt.ko Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 30/40] of: mdio: Add of_node_put() when breaking out of for_each_xx Greg Kroah-Hartman
2022-09-26 10:11 ` [PATCH 4.14 31/40] netfilter: ebtables: fix memory leak when blob is malformed Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.14 32/40] can: gs_usb: gs_can_open(): fix race dev->can.state condition Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.14 33/40] perf kcore_copy: Do not check /proc/modules is unchanged Greg Kroah-Hartman
2022-09-26 10:12 ` Greg Kroah-Hartman [this message]
2022-09-26 10:12 ` [PATCH 4.14 35/40] serial: Create uart_xmit_advance() Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.14 36/40] serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.14 37/40] s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.14 38/40] Drivers: hv: Never allocate anything besides framebuffer from framebuffer memory region Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.14 39/40] ext4: make directory inode spreading reflect flexbg size Greg Kroah-Hartman
2022-09-26 10:12 ` [PATCH 4.14 40/40] media: em28xx: initialize refcount before kref_get Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220926100739.622384540@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=andrew@lunn.ch \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=seanga2@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).