Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp550497imp; Thu, 21 Feb 2019 06:41:08 -0800 (PST) X-Google-Smtp-Source: AHgI3IabdZ6xgIYzsjj8P+KSugLrodvFXJpzRlv/A3fFW35TVEBwhMnt5WPa5T74LTlI0DzyaHm9 X-Received: by 2002:a17:902:6686:: with SMTP id e6mr42770575plk.208.1550760068868; Thu, 21 Feb 2019 06:41:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550760068; cv=none; d=google.com; s=arc-20160816; b=J9uhKfNMQ5ECzCxri4mcrsKR6J4mOa9uk0d/fKcpXKzuz7zOCBJry6S6mboY4n6fAS B7aXwGJit5NgtPwu2tasIMceE2pF6KgCop06dAM1koOyzdHsSO1EGAfGaVW6DcUYx90L mrK3+3PciQ77/3rAhSsaWF9H7duv5qB2Bzur4wur5ATiVmkLgK1aZ7mzdNbtYewCraYb niLWQFxcJbEFCvqfuTTRAfPSaBB4SIkyxx1Y3EVO22cxMukdUtQOL/lv0P6BuuztUfWi xRr2PR3nkWCqG/29NyXzT47+S7sGvcoXBw/Eft2fi/GJE08LXlIQ1yi8d8TyKwhh18Rr jvHw== 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=WhiVwHhie7EJnxAo3GvZ0VIwLytnP+UGhyP8SEBAOLQ=; b=eKsvCVK7mCWD9NhV6BOvwarxkxc0xRNt09V3Cqliw44I+2Mz3/WuzDxtYmLxT8b6gN 0OFEeMch2DLX2NO4sro5Ytm5DS/KSQy3teEptBaWsEZrMZd+pzCYatd4fzK6ldJv3g0W 0D4aOdN7Pwdw3pxrrKvsmo9sa0Uk0KU63B+RdaWLRX3e77FPn2xVk92Ms/kuH+rkZR+q UgJa3PoNvtQR5+KLLS+t24zWCH0Jt5mLGPGv/CQc0wtGT9ljZKEGcUYAkaQuAbGK/uOL ORWV30FtcG74J4hTdsEFxpGY+Vz9y7NhlwqFbrwuXleNeVtVcvtICF252I5w/GSw7pcz XSpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=e3D04zON; 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 p1si20872135pgb.192.2019.02.21.06.40.53; Thu, 21 Feb 2019 06:41:08 -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; dkim=pass header.i=@kernel.org header.s=default header.b=e3D04zON; 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 S1728975AbfBUOjm (ORCPT + 99 others); Thu, 21 Feb 2019 09:39:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:33698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728968AbfBUOjk (ORCPT ); Thu, 21 Feb 2019 09:39:40 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 CC17A20838; Thu, 21 Feb 2019 14:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550759979; bh=ZNfSQmJKJDhPC9HngVAz5BAmQOiIVtF0/GbSBiI78p4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e3D04zONYZ8c9Pau/Iuix4mlhQzFBvQ998Ui0uLYBzsBATeapUxpKSQSMmgf+QFF1 mQsyxejRO7Ht1yGbgOnsObO8tQm7btqi3WxpanPenUOHOelK7gHBVEvPcA6CkrdBFj rbt2TVMFJBoFOBAWiHctsI0Zr951k+FyGFeGEvzg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandre Torgue , "David S. Miller" Subject: [PATCH 4.14 12/23] net: stmmac: handle endianness in dwmac4_get_timestamp Date: Thu, 21 Feb 2019 15:35:54 +0100 Message-Id: <20190221125247.243572967@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221125246.162644302@linuxfoundation.org> References: <20190221125246.162644302@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexandre Torgue [ Upstream commit 224babd62d6f19581757a6d8bae3bf9501fc10de ] GMAC IP is little-endian and used on several kind of CPU (big or little endian). Main callbacks functions of the stmmac drivers take care about it. It was not the case for dwmac4_get_timestamp function. Fixes: ba1ffd74df74 ("stmmac: fix PTP support for GMAC4") Signed-off-by: Alexandre Torgue Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c @@ -238,15 +238,18 @@ static inline u64 dwmac4_get_timestamp(v static int dwmac4_rx_check_timestamp(void *desc) { struct dma_desc *p = (struct dma_desc *)desc; + unsigned int rdes0 = le32_to_cpu(p->des0); + unsigned int rdes1 = le32_to_cpu(p->des1); + unsigned int rdes3 = le32_to_cpu(p->des3); u32 own, ctxt; int ret = 1; - own = p->des3 & RDES3_OWN; - ctxt = ((p->des3 & RDES3_CONTEXT_DESCRIPTOR) + own = rdes3 & RDES3_OWN; + ctxt = ((rdes3 & RDES3_CONTEXT_DESCRIPTOR) >> RDES3_CONTEXT_DESCRIPTOR_SHIFT); if (likely(!own && ctxt)) { - if ((p->des0 == 0xffffffff) && (p->des1 == 0xffffffff)) + if ((rdes0 == 0xffffffff) && (rdes1 == 0xffffffff)) /* Corrupted value */ ret = -EINVAL; else