Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1110888pxx; Tue, 27 Oct 2020 08:29:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrK/e0MH1OgOAlKszUhgcLAfKW7+L+J3uXHsoEI7l2EslzzyWrfSIzw3G2qiSlML2+5xjV X-Received: by 2002:a17:906:3e17:: with SMTP id k23mr3072279eji.414.1603812564299; Tue, 27 Oct 2020 08:29:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603812564; cv=none; d=google.com; s=arc-20160816; b=A079RyAf5yZXxgtZtGIeA7uC6AhcNOnZMr2UWsD9KoyTyFTDX5PYlxXM+aM5IKpLca jATtknw53ykv8lOivEaOuO/p7C6c+AUBsPTMbq5lQLCySn6t4WxmwJqSlVLAVGdOPUb1 PUSDT+n+X0A8pXR2D08/kJWvIHxxbrwO7ifPk+Rv1ThtV9/Y4PDqNrDjePj888CyZtb5 9IK8dA0S/3baZnVRvaZ9CjdrtLoI6/mL3yVAwJ+JgCTJxDY3f6FHSaQT0x5SV0GDs503 fQDDUj1vjJ2iF242hy8pyJO4HdqhMxblSd5qboOpF46M+VopUu5FjQLD+V8DGl4cDi9c rUjg== 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=jJA3SV+PbcPm8Psw/qjK/aksHJ3prpJHVaQG8tSCfEY=; b=bkIptZxy/dFT2kvnuZjCLeYAPWRj/zYFiGBYDQV8DvdNjjjI0kzv7HRyuJdEhiAtLX 31uNv97EcnpoE0Myr7EFzgA8mkdXQdF9cWPIyB3K2HeaF2zJzex+jVoZaJjSDCX4bcp1 +9u2dT/h23X1FFuPSw0k+iBZonvPPzWkPvwlU+mVwfNt0yv1hZ2HfHBaBxvyYLI2Z0RC EZd+Mrv0C17r/pTj1RJ7UW7tKDDUHrUVHbSwQC3VrM5fzSsV6dtAlhwKieWtdsAnC+6z b1IjAMg4iEq7xtd5FpxrycjnwoQg7aFcRXfLgRdIKTAFzrawvm2zu8kfBj/f3nPGEELk Gv1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rjcmAj0f; 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=fail (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 d12si1234294eje.365.2020.10.27.08.29.01; Tue, 27 Oct 2020 08:29:24 -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=@kernel.org header.s=default header.b=rjcmAj0f; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760664AbgJ0Ofq (ORCPT + 99 others); Tue, 27 Oct 2020 10:35:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:33760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760507AbgJ0Oe7 (ORCPT ); Tue, 27 Oct 2020 10:34:59 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 52E0C20773; Tue, 27 Oct 2020 14:34:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809298; bh=rvMm1XsSXWUkksChRmqskzbESuq/QSuuYlr8g/lzIiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rjcmAj0ftQGyb+0Wn4n+XkKi4ewrwEw1TR2Grhm7WPilPj9V2dZZC/Cb3cveicpGg jf0kB6ifu+yHjhZWnrSoTJKPqg9SmhF2sVD0siPcO2ZD3VKL4pEZCo6ZjcZoxxLylQ Vkq2JxqzBnyC9ojKtQiX9aX84I8SWBJg5PtDNNLQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eran Ben Elisha , Sasha Levin Subject: [PATCH 5.4 145/408] net/mlx5: Dont call timecounter cyc2time directly from 1PPS flow Date: Tue, 27 Oct 2020 14:51:23 +0100 Message-Id: <20201027135501.823655640@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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: Eran Ben Elisha [ Upstream commit 0d2ffdc8d4002a62de31ff7aa3bef28c843c3cbe ] Before calling timecounter_cyc2time(), clock->lock must be taken. Use mlx5_timecounter_cyc2time instead which guarantees a safe access. Fixes: afc98a0b46d8 ("net/mlx5: Update ptp_clock_event foreach PPS event") Signed-off-by: Eran Ben Elisha Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c index 75fc283cacc36..492ff2ef9a404 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c @@ -498,8 +498,9 @@ static int mlx5_pps_event(struct notifier_block *nb, switch (clock->ptp_info.pin_config[pin].func) { case PTP_PF_EXTTS: ptp_event.index = pin; - ptp_event.timestamp = timecounter_cyc2time(&clock->tc, - be64_to_cpu(eqe->data.pps.time_stamp)); + ptp_event.timestamp = + mlx5_timecounter_cyc2time(clock, + be64_to_cpu(eqe->data.pps.time_stamp)); if (clock->pps_info.enabled) { ptp_event.type = PTP_CLOCK_PPSUSR; ptp_event.pps_times.ts_real = -- 2.25.1