Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5179849ybv; Mon, 17 Feb 2020 14:09:15 -0800 (PST) X-Google-Smtp-Source: APXvYqzl+ypFJUlZ1ZOIOOAro03nja8IiYH9oFVqjmwyRbMeebavrpt/Rd7PgPZcBX/V9sf8yIXG X-Received: by 2002:a05:6830:1d8b:: with SMTP id y11mr14284773oti.4.1581977354953; Mon, 17 Feb 2020 14:09:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581977354; cv=none; d=google.com; s=arc-20160816; b=mpc4wlfEtQrYtpvBlfjsjrPPQthVRaU2koRp9qbXudOMc7/qB26Uu3xEnsHHjGZL47 2+Fj3giToNmIvW90Ml1BUXSM/EDqKQBDdgWK0dsAZyW1zqvjThr++l8Riflz9++QdTEC 4z6bVHCnZYJjWhqhMtt+md1i0uA5/0ZZQxrfXv4vOj63olnnp+nzGGDNJuuJDVzJUGoX AjzjGibLPut1y8XoOf+XqfE+zX11cDXCaIv7lD3TKFSoLOC2FG+4S7uFLGwj+mtc0GaU VXpUpuwYFboQyhkMt+oqyuq+MAK5iOxRWqdaB5vhLEGyucphUXCUF2zkmQYPsGLo/6wn 7D5g== 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:from:subject:cc:to:message-id:date; bh=DPh3RIp/KDfCepWmGluzgKBfnY5jfEaOeR+bB23LyWg=; b=vMTQuvsv9NUNfcP798LJLk6SRfWRshqEHN+s1N/0oHaRDvv9JpSNh9xFpgbMs1Kble tV85ko5TzO11tyyu6d5CALDa0tsB6Rpvc1j5YKbOzEmcmIQDknT9u8y5J46EOaVGoN7m 0E0lsVBlg13B+gc5A4vkmcjunM6w2oPgVZ/SH5aa3dXYnDVj91I9C+6aI+gAKHSnkD2Z nC9pOoMTBxF5d1l0VIuH8TfYJFDsk0dYjvvEiZtPQLg4z0IkM3FSy3KuHBm2M7lu3a5v NQFzdgld9SovDYDHDm1tm3AbUzA9uFrokTCxyZY00fBUP9isw3H+zVfxF4sZM6AIIzbJ y8DQ== ARC-Authentication-Results: i=1; mx.google.com; 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 a14si877868otk.2.2020.02.17.14.09.02; Mon, 17 Feb 2020 14:09:14 -0800 (PST) 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; 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 S1726245AbgBQWGw (ORCPT + 99 others); Mon, 17 Feb 2020 17:06:52 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:55950 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726025AbgBQWGw (ORCPT ); Mon, 17 Feb 2020 17:06:52 -0500 Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 5648815A9FC28; Mon, 17 Feb 2020 14:06:51 -0800 (PST) Date: Mon, 17 Feb 2020 14:06:50 -0800 (PST) Message-Id: <20200217.140650.510071134243739795.davem@davemloft.net> To: horatiu.vultur@microchip.com Cc: alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: mscc: fix in frame extraction From: David Miller In-Reply-To: <20200217083133.20828-1-horatiu.vultur@microchip.com> References: <20200217083133.20828-1-horatiu.vultur@microchip.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 17 Feb 2020 14:06:51 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Horatiu Vultur Date: Mon, 17 Feb 2020 09:31:33 +0100 > Each extracted frame on Ocelot has an IFH. The frame and IFH are extracted > by reading chuncks of 4 bytes from a register. > > In case the IFH and frames were read corretly it would try to read the next > frame. In case there are no more frames in the queue, it checks if there > were any previous errors and in that case clear the queue. But this check > will always succeed also when there are no errors. Because when extracting > the IFH the error is checked against 4(number of bytes read) and then the > error is set only if the extraction of the frame failed. So in a happy case > where there are no errors the err variable is still 4. So it could be > a case where after the check that there are no more frames in the queue, a > frame will arrive in the queue but because the error is not reseted, it > would try to flush the queue. So the frame will be lost. > > The fix consist in resetting the error after reading the IFH. > > Signed-off-by: Horatiu Vultur Applied and queued up for -stable.