Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2836414pxb; Mon, 1 Nov 2021 02:53:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3L4kurtwzUemF9p6vJwX6z+cjpc99swEZCTfoxqRFy7KTOVOBYU2Wh02Fp2m3lvrh6PKN X-Received: by 2002:a17:906:9501:: with SMTP id u1mr34264244ejx.496.1635760408262; Mon, 01 Nov 2021 02:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635760408; cv=none; d=google.com; s=arc-20160816; b=k3GdYaMxpAlltqjPRDtRWmYfVS3O7D6Jv70Tyg05WwmKF9Q5bNSgiaY2yQOugVyN2e PxHfd00gBUGVcXZuwBAM8YDK99yHmAhoQHJJqR5HbzlRorUnfxH2e3sfy7TF2/VoPzNd So6jc5dTsqEAWFPJLoYA9efF2w7yi+eAdAri9Sbc5haTr1CAGOKD0Tq+CWMLPCnYWt8t dJ7VSqTMv/HFnSRSZAoexZz4w4Ae9SNP8eH/V1Pkcc4NITGUia9rl8xRjDD2x9wbCdNb HTDvuz31CS4fM1/mML64SI038C0f363MkMhDRft3ZJEzbqeOI4TYyuujpd2LHzWI4/RI 6eaQ== 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=t9xhj/4PVm9CpqtEHI3p/ljRjxo93gjJ71+4eIkCWl8=; b=KgLpGsahBydBjLX6ENrcTJDOpMk/iSYXPo4DJ+96L7oAgk9B1SUR9maouez/+bmuUb taLYydvxz/RAlhRcLErTqWmBOWm0M6pENyQbCH2azFu5aUk1sdUTM1lkX5hYrcZktOrU O0B4EGUPk31yp8MHKxwnF/dDvb+7/K0GaR/1x90mnkX4fMkQyRHLpKnobLBX9xFIATRK Bf3RWj5nqkoHW2a8EaWUaLEB79PCSseiu8GjhAerMV/8Z3UBo/sqSVgkfLFU2r0JCub2 4Z3Z4X9GW5eRRmrvLnE5oUmVeU9rAyqULNUg4dEItPfmq/4P3sZRPuTfB4lTKUZ9VUcz pVyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KgawaKnx; 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 4si21392217ejc.763.2021.11.01.02.53.03; Mon, 01 Nov 2021 02:53:28 -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=KgawaKnx; 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 S234816AbhKAJxL (ORCPT + 99 others); Mon, 1 Nov 2021 05:53:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:52288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234732AbhKAJss (ORCPT ); Mon, 1 Nov 2021 05:48:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 79840610E8; Mon, 1 Nov 2021 09:31:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635759075; bh=BrOIcfZkfakfLm2U32HmhYXzwiyAaowKAZcqcGPr2uU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KgawaKnxC74rlfwCDkK0tsbk+oqDOhSFLZuLwClXTU4IwmFUHd6q9LHltA2n4aO0V 0+pM02L32NFS98t5EQz6qeOXQgrT0WGmShylZoz5wdLMND6+9qpLrjQEom/78BFOP7 xCdbqKU5PCAuiyvATXUk/ykNldlMSLiToZPMXWfU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yongxin Liu , Jacob Keller , Gurucharan G , Tony Nguyen Subject: [PATCH 5.14 072/125] ice: check whether PTP is initialized in ice_ptp_release() Date: Mon, 1 Nov 2021 10:17:25 +0100 Message-Id: <20211101082546.836982281@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082533.618411490@linuxfoundation.org> References: <20211101082533.618411490@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: Yongxin Liu commit fd1b5beb177a8372cea2a0d014835491e4886f77 upstream. PTP is currently only supported on E810 devices, it is checked in ice_ptp_init(). However, there is no check in ice_ptp_release(). For other E800 series devices, ice_ptp_release() will be wrongly executed. Fix the following calltrace. INFO: trying to register non-static key. The code is fine but needs lockdep annotation, or maybe you didn't initialize this object before use? turning off the locking correctness validator. Workqueue: ice ice_service_task [ice] Call Trace: dump_stack_lvl+0x5b/0x82 dump_stack+0x10/0x12 register_lock_class+0x495/0x4a0 ? find_held_lock+0x3c/0xb0 __lock_acquire+0x71/0x1830 lock_acquire+0x1e6/0x330 ? ice_ptp_release+0x3c/0x1e0 [ice] ? _raw_spin_lock+0x19/0x70 ? ice_ptp_release+0x3c/0x1e0 [ice] _raw_spin_lock+0x38/0x70 ? ice_ptp_release+0x3c/0x1e0 [ice] ice_ptp_release+0x3c/0x1e0 [ice] ice_prepare_for_reset+0xcb/0xe0 [ice] ice_do_reset+0x38/0x110 [ice] ice_service_task+0x138/0xf10 [ice] ? __this_cpu_preempt_check+0x13/0x20 process_one_work+0x26a/0x650 worker_thread+0x3f/0x3b0 ? __kthread_parkme+0x51/0xb0 ? process_one_work+0x650/0x650 kthread+0x161/0x190 ? set_kthread_struct+0x40/0x40 ret_from_fork+0x1f/0x30 Fixes: 4dd0d5c33c3e ("ice: add lock around Tx timestamp tracker flush") Signed-off-by: Yongxin Liu Reviewed-by: Jacob Keller Tested-by: Gurucharan G Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/ice/ice_ptp.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -1582,6 +1582,9 @@ err_kworker: */ void ice_ptp_release(struct ice_pf *pf) { + if (!test_bit(ICE_FLAG_PTP, pf->flags)) + return; + /* Disable timestamping for both Tx and Rx */ ice_ptp_cfg_timestamp(pf, false);