Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2534359yba; Mon, 6 May 2019 07:37:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwshOkRVd8MUZleZPPAUgaburfEMDZ/dIhffRT/LRgIMAx6L13TItm3R/GYeMsPv5iqaA7 X-Received: by 2002:a17:902:7d83:: with SMTP id a3mr2864248plm.305.1557153466436; Mon, 06 May 2019 07:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557153466; cv=none; d=google.com; s=arc-20160816; b=D8UBWpEiUcq1hmUbIkpgrhQW9aZWnec3IPKTalh+df4HaGQeduiNMD/wXpz/tQgjkp veRDRfR5zSI4wFybeg5awShScv67GF+9DGoJXHb0XpGM1/mxK9QZNkEuWAeWXqj3eu5m JX10yf4rfbZAwqXQutPR5ptoedjc/hMpozYUfVnBYQqVjA+7yLitSezPKdRft8CXVqLL OSDR5odgRiinuxgnnXNeHf0LPkUaNTyO3WQxeJ5gcDGlDtvXsl4upaLNCOIEPP71FUzK JVp9ofimgur5agA1ykiDOr6dAULKOj4sv0P77raY6fzFUPyrRQ3Jr0YI6rboX+re67oI 5dMw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vSlBZvRbILHp2qsKgP876Rw6idV4JUziDufTqzWa0HY=; b=fqHZncgkRBsfbBVI0ZeqmW8rm5aTpJUgT6I4dKnE3ZAb301tbGpGlb8XBsjZaHML51 BVV1/IbzxZ6akENI+uk2qU4TEDsccWfFN6qqPy39G025SJQK7vjgLlMTAxSgheGRBIV6 iI87cgvRkakYGZT4cBbmHZKlMLkOaBpFf3JZzNx83MQRunMcxkBvOWWoex92ebG/dXtL XyT+vx6OMBeAC6kqbUjfGAPprNN9WqQ5hSzSVtmFo795k6mjWVI5H2l1nKLeqWN6DKpj MS5nmi5kW1fiJKFR0ewdDaiKZUvFFq/nqQvuonpgypboAVlbTtE+kvBNbXIx4zDgw2xP nIgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t2CdfFK5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si13997618pgr.167.2019.05.06.07.37.30; Mon, 06 May 2019 07:37:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t2CdfFK5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726999AbfEFOfr (ORCPT + 99 others); Mon, 6 May 2019 10:35:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:55934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726460AbfEFOfp (ORCPT ); Mon, 6 May 2019 10:35:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5EAC020C01; Mon, 6 May 2019 14:35:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153344; bh=fswLb29KFSWxhWuB7kR8SScaaOcEFb4ErFrPM2jSrw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t2CdfFK5UDttxSrm7ro3JGe+RdTZ7FsyS7RXPs1RHreu+G4PJVFOMjBZJuhKrNRoH IMKTJShqK7vRO+gjkIca0FW1oTyTMzyqV4Y+tk5+dJeP2Sem5TtgwTXr7F4dGqEL/6 vpvJ/JYkvintNPpk9TZWvZledO7uZY6RGHenVceU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaro Koskinen , "David S. Miller" , "Sasha Levin (Microsoft)" Subject: [PATCH 5.0 054/122] net: stmmac: fix dropping of multi-descriptor RX frames Date: Mon, 6 May 2019 16:31:52 +0200 Message-Id: <20190506143059.782324555@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 8ac0c24fe1c256af6644caf3d311029440ec2fbd ] Packets without the last descriptor set should be dropped early. If we receive a frame larger than the DMA buffer, the HW will continue using the next descriptor. Driver mistakes these as individual frames, and sometimes a truncated frame (without the LD set) may look like a valid packet. This fixes a strange issue where the system replies to 4098-byte ping although the MTU/DMA buffer size is set to 4096, and yet at the same time it's logging an oversized packet. Signed-off-by: Aaro Koskinen Signed-off-by: David S. Miller Signed-off-by: Sasha Levin (Microsoft) --- drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c index c42ef6c729c0..5202d6ad7919 100644 --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c @@ -201,6 +201,11 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, if (unlikely(rdes0 & RDES0_OWN)) return dma_own; + if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) { + stats->rx_length_errors++; + return discard_frame; + } + if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) { if (unlikely(rdes0 & RDES0_DESCRIPTOR_ERROR)) { x->rx_desc++; -- 2.20.1