Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3023910pxb; Mon, 18 Oct 2021 06:49:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgjF9J/TViDYp0SpqUNcSj0Kn9ND7v0+dtRDxfoO2zspJZVQ2BT7OTBsOAytPFkS5LX2H4 X-Received: by 2002:a63:7118:: with SMTP id m24mr23947300pgc.332.1634564954059; Mon, 18 Oct 2021 06:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564954; cv=none; d=google.com; s=arc-20160816; b=m7CNUUFyuX6621McNcAVZLYa3pI9Nc8p77H2au20T1PXk0WfJeV1T0PeiT0cE3ttUF k19/9KOD66dZzFQzkHV4/NUx/pT4DlPWuYs8DielZPMTzNtn5czb4ju1G59p0AwXaSmR KzJp0x4p41WinJuxDhxsbedIdTKImhf6EwnLl0dgcKIn1L9aHPzH32phLniu25wyfmAB gSMKrSiWHlJjKWmakKDRMridqT+l61laXNsLT8jf4Xr/dxA0jrHILzBDWr73wGDsO9Me 7ztkz5Iq8Stl9t37YWMrTwUdZVaRuOrQin8WtN3nECQlAs4B34Gl5zmEN3HgeA4ZjDBX EWCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FCRyzgE01z6CVVLSJiTYmeaas//M+nLpt/4o1HbNzVA=; b=PoDW5tnyF5UXk+I31+IBxHQl7lkYvXzYgfZrLGdXwZ29+qH65Br1TSk28Q51m5+Yrv TcQ6yLuM7Tv6HUPQ9irzY5rlvWmV/AJb7ssVZmXDEl1x3qwP++d6urkiICW8EICza3SN gRUMJ+F/S9jrvW1wq0+bbnYBU8fHM+EGrOYAIhGWVs/5fxyqxtMaCBXa6NYq0EjtUFpP X1ColhIxXpPnwPwIjiZ9o6P40QL7HC3W5qbopvzA6YJip4xRTIdc+cB3zBU8BiulLeF7 6fkqSJp9osJdQd7NOaySk/7u0OwMN7UbcwSOTNBm+Erj98zs73TES7bZBObt5a+Ycb5u kDgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LAspsFv8; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 68si17937094pfe.367.2021.10.18.06.48.59; Mon, 18 Oct 2021 06:49:14 -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=@linuxfoundation.org header.s=korg header.b=LAspsFv8; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233669AbhJRNti (ORCPT + 99 others); Mon, 18 Oct 2021 09:49:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:49770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232955AbhJRNrs (ORCPT ); Mon, 18 Oct 2021 09:47:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0FDAA613DA; Mon, 18 Oct 2021 13:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564196; bh=Mj4jA815dGR6rKyRp/7j4895fyQwbPLCFgLkvi9cuqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LAspsFv8HtOsAvUQxKlVrqFoYuiZkJXprI3ry0m7MX9quxIKmI9V2wo/gX8Izx1t3 0ijSVEG3akrdWgge2VaiOikPlb71ZjGP1O6wrQhbMVgU5tMDzD8BSMGoKq5wFNi7bD db5BL2N/j4F68+lY+xJdva0S0CWPw+rbIuzExcKE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Florian Fainelli , Jakub Kicinski Subject: [PATCH 5.10 101/103] net: mscc: ocelot: warn when a PTP IRQ is raised for an unknown skb Date: Mon, 18 Oct 2021 15:25:17 +0200 Message-Id: <20211018132338.133898729@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132334.702559133@linuxfoundation.org> References: <20211018132334.702559133@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladimir Oltean commit 9fde506e0c53b8309f69b18b4b8144c544b4b3b1 upstream. When skb_match is NULL, it means we received a PTP IRQ for a timestamp ID that the kernel has no idea about, since there is no skb in the timestamping queue with that timestamp ID. This is a grave error and not something to just "continue" over. So print a big warning in case this happens. Also, move the check above ocelot_get_hwtimestamp(), there is no point in reading the full 64-bit current PTP time if we're not going to do anything with it anyway for this skb. Fixes: 4e3b0468e6d7 ("net: mscc: PTP Hardware Clock (PHC) support") Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mscc/ocelot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -594,12 +594,12 @@ void ocelot_get_txtstamp(struct ocelot * spin_unlock_irqrestore(&port->tx_skbs.lock, flags); + if (WARN_ON(!skb_match)) + continue; + /* Get the h/w timestamp */ ocelot_get_hwtimestamp(ocelot, &ts); - if (unlikely(!skb_match)) - continue; - /* Set the timestamp into the skb */ memset(&shhwtstamps, 0, sizeof(shhwtstamps)); shhwtstamps.hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec);