Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3041928pxb; Mon, 18 Oct 2021 07:09:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4Ihp4ObHu0eRf8umNoOuM901HHTyM6GxwZzEaaCoZLcw4VhfD0CkJ15VGkBVoVHQr7d25 X-Received: by 2002:a17:90a:1504:: with SMTP id l4mr33527694pja.181.1634566161482; Mon, 18 Oct 2021 07:09:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634566161; cv=none; d=google.com; s=arc-20160816; b=UZ58qA/o5xI5krh/PbnoZFOyzx+vMm10TrIYRYjU5OUFhRE1QMK3BJlZlXE0pGTCWL Cp5scWNIjxEEvttY5yCe8kdFEtP9vvTQNw3fvwaffU2ec8IAdoy3HtWJIBS51IV7z1ZC JpKEOJAstdpoEBnfA9sznXagfnQXP5djryaOVZQFYCKs8l3Vcywe9Kotfr6v5FZLb1aF SZ7Kh8FG8jmXIC2WENZHsFEuo17zIkU6/RyoO03ZR5PGpixdfCHpOo2bdukxQcYQ+3+f fPVXkh4bTB1AF532Lcuimxwo+NeAqRKaa4gibHMaSOqVR6QpJWEVQ+zh4/x7FfguwsLn XAgQ== 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=uq5Uld++8JBUZ5nPuV3qgsWsxE9T6KLH82Xu3DPSAw0=; b=oFMkFKhuweO/RWsYzsdHsltHgdt7WEZoqE9GDjA/WTDqPPS+pjvWVmdVFrtwkkBXMf QvXAmTdpmi8ivX0Cl48Pmjttpn1y7RALY8yoG12MBxM5JBP815plLJqIiIvvU+xXxfKQ 279TzKyY23eiIlBXzZ0EzGa1HAR3LfFwQKcgjh91lP/WQJQ3sHxqC1VqjhnXtuXpL+mH lazRMYBzGcVHzuW1C2cUG6aRlwzFTv/uWmR4/kFBFogsf+PVtuM6IAXZj73kPLRgAGRC ESVUPaiUNRk1hAyop6GyFuoCQ+A/G5YxawmBOY9l3u3AfB3PXfVOk36xU6JrFXQyW8xI 83tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2FffR0Jx; 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 z6si26445139pjq.23.2021.10.18.07.09.06; Mon, 18 Oct 2021 07:09:21 -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=2FffR0Jx; 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 S234584AbhJROHX (ORCPT + 99 others); Mon, 18 Oct 2021 10:07:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:40764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234952AbhJRODg (ORCPT ); Mon, 18 Oct 2021 10:03:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A7AFC6126A; Mon, 18 Oct 2021 13:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564622; bh=Fi64Q8ZsCDKutGISlLyTFeer8JG6+hIhUUf8Llc5CRo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2FffR0JxmwnCkGoNsuaHjnMnIEJBV6KYdpjwOzqOUlNZJTqBurDWil6QXDVHK5kKS PajUcnbwjtlC7aPDf8qvUJZKFZqf/9tNjVw+Zi12umptiFKFaKWwtTuFX3K6nPbWfW UAg4hnt/Cpd6MTozCxkQC4PeQM7W4yJKbEAjEkL8= 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.14 147/151] net: mscc: ocelot: warn when a PTP IRQ is raised for an unknown skb Date: Mon, 18 Oct 2021 15:25:26 +0200 Message-Id: <20211018132345.438962735@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132340.682786018@linuxfoundation.org> References: <20211018132340.682786018@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 @@ -714,12 +714,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);