{"id":2232319,"url":"http://patchwork.ozlabs.org/api/patches/2232319/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260504110058.2373236-3-sergey.temerkhanov@intel.com/","project":{"id":46,"url":"http://patchwork.ozlabs.org/api/projects/46/?format=json","name":"Intel Wired Ethernet development","link_name":"intel-wired-lan","list_id":"intel-wired-lan.osuosl.org","list_email":"intel-wired-lan@osuosl.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260504110058.2373236-3-sergey.temerkhanov@intel.com>","list_archive_url":null,"date":"2026-05-04T11:00:57","name":"[iwl-net,v1,2/3] ice: Zero out the PTP control PF pointer at ice_adapter cleanup","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"81b690758ccd0366cbbe23f1f0bdd8c6ce1c2ef1","submitter":{"id":85162,"url":"http://patchwork.ozlabs.org/api/people/85162/?format=json","name":"Temerkhanov, Sergey","email":"sergey.temerkhanov@intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260504110058.2373236-3-sergey.temerkhanov@intel.com/mbox/","series":[{"id":502644,"url":"http://patchwork.ozlabs.org/api/series/502644/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=502644","date":"2026-05-04T11:00:55","name":"Rework ctrl_pf pointer usage in struct ice_adapter","version":1,"mbox":"http://patchwork.ozlabs.org/series/502644/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2232319/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2232319/checks/","tags":{},"related":[],"headers":{"Return-Path":"<intel-wired-lan-bounces@osuosl.org>","X-Original-To":["incoming@patchwork.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256\n header.s=default header.b=4bUYzyBt;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g8Jbr4X36z1yJV\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 04 May 2026 21:01:12 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id 49EB78451C;\n\tMon,  4 May 2026 11:01:05 +0000 (UTC)","from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id ZR1-oFEqDnDQ; Mon,  4 May 2026 11:01:04 +0000 (UTC)","from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id 961768451D;\n\tMon,  4 May 2026 11:01:04 +0000 (UTC)","from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])\n by lists1.osuosl.org (Postfix) with ESMTP id 565F225D\n for <intel-wired-lan@lists.osuosl.org>; Mon,  4 May 2026 11:01:03 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp4.osuosl.org (Postfix) with ESMTP id 38F8C41A4A\n for <intel-wired-lan@lists.osuosl.org>; Mon,  4 May 2026 11:01:03 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id PjnzYJ6mqZhk for <intel-wired-lan@lists.osuosl.org>;\n Mon,  4 May 2026 11:01:02 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [198.175.65.16])\n by smtp4.osuosl.org (Postfix) with ESMTPS id 21DA741A48\n for <intel-wired-lan@lists.osuosl.org>; Mon,  4 May 2026 11:01:01 +0000 (UTC)","from orviesa004.jf.intel.com ([10.64.159.144])\n by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 04 May 2026 04:01:02 -0700","from gnrd8.igk.intel.com (HELO GNRD8) ([10.123.232.137])\n by orviesa004.jf.intel.com with ESMTP; 04 May 2026 04:01:01 -0700"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp1.osuosl.org 961768451D","OpenDKIM Filter v2.11.0 smtp4.osuosl.org 21DA741A48"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1777892464;\n\tbh=INriOp2xI/MeFcW23xGddT0du5qeLVJlXRDIucelsrk=;\n\th=From:To:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=4bUYzyBtz+w8w+OIcnnv2haWyn4bmLi0C5TN8/hzahWRwfmk5NZMuhmMCaYeheJv+\n\t zaehgyzis3V5/e37HGtTPZS3bfWoE4ZZVoF9DAoxVSKdKa3FPUHgvhcyHUr36lmx7c\n\t GrLx2oVzgljBg4IGZnj57IaRmnyQbdWwsYYhG/S/gHbzUQ6sJspumiSAboLHib8ZEU\n\t GxRykgFWw7Tj7v85AxnaJGVwiI4aRigkHNZMieX9//frICsJWJ/+5SojMvnWAGSnVb\n\t 09xcg7xkjNXmYQ5+VXKiuaHGsQ349A2iST3xNMIbjsC1axu+o4VNsEVBhxZpiyUhyv\n\t a7ZvbHQae5CKA==","Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=198.175.65.16;\n helo=mgamail.intel.com; envelope-from=sergey.temerkhanov@intel.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp4.osuosl.org 21DA741A48","X-CSE-ConnectionGUID":["ELUsJV77TYaUmuIIjVl5Cw==","v2JZYHBpQj60zBsH0LCR6g=="],"X-CSE-MsgGUID":["Qb5L/ZihQ0mpwTj06UDh0A==","F8ybxhVbSwmJjkTR2ZoW4w=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11775\"; a=\"78939689\"","E=Sophos;i=\"6.23,215,1770624000\"; d=\"scan'208\";a=\"78939689\"","E=Sophos;i=\"6.23,215,1770624000\"; d=\"scan'208\";a=\"239792123\""],"X-ExtLoop1":"1","From":"Sergey Temerkhanov <sergey.temerkhanov@intel.com>","To":"intel-wired-lan@lists.osuosl.org","Date":"Mon,  4 May 2026 11:00:57 +0000","Message-ID":"<20260504110058.2373236-3-sergey.temerkhanov@intel.com>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260504110058.2373236-1-sergey.temerkhanov@intel.com>","References":"<20260504110058.2373236-1-sergey.temerkhanov@intel.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Original-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1777892463; x=1809428463;\n h=from:to:subject:date:message-id:in-reply-to:references:\n mime-version:content-transfer-encoding;\n bh=sxjykjgBCLVR0+8qf0+QS7+ogMK1l6RLYYcd7zzzzpk=;\n b=nQernlpLsD69s3D25WTreIre9bQzWmHfeTSFKufoyM+1MnCkB8A02DBO\n iKV3Dbq5Ke3lh36tLSA+L4cfS4oZSD/D6qkWC1fyyJqLyUY0GlC+1x/+f\n oR0ed4QEXvhiH80L6G0b+yPD78quig+yMak9uM+gFJktvVSTIGH57f0e0\n XKnUeiL1PskR03Pc/HeWChUmZwxt3qlLKo8zg3MXNzXIisVzOLR463A9w\n iJeyeLfQ5gO1xRP3FR2uBw55l4mZaGMw98Vr/hUuP8VRzddgILx9bB95b\n MEdR0vOMdGAbPnsXxEpP8tL/OVYP8c0zWQ2CaqQym437fTw8RwtGg9PqC\n Q==;","X-Mailman-Original-Authentication-Results":["smtp4.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=intel.com","smtp4.osuosl.org;\n dkim=pass (2048-bit key,\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=nQernlpL"],"Subject":"[Intel-wired-lan] [PATCH iwl-net v1 2/3] ice: Zero out the PTP\n control PF pointer at ice_adapter cleanup","X-BeenThere":"intel-wired-lan@osuosl.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>","List-Unsubscribe":"<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>","List-Archive":"<http://lists.osuosl.org/pipermail/intel-wired-lan/>","List-Post":"<mailto:intel-wired-lan@osuosl.org>","List-Help":"<mailto:intel-wired-lan-request@osuosl.org?subject=help>","List-Subscribe":"<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>","Errors-To":"intel-wired-lan-bounces@osuosl.org","Sender":"\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"},"content":"Zero out the ctrl_pf pointer in ice_adapter when the control PF is removed.\nThis prevents potential dangling pointer dereference when accessing\nPTP-related structures from other PFs of the same adapter.\n\nFixes: e800654e85b5b (\"ice: Use ice_adapter for PTP shared data instead of auxdev\")\n\nSigned-off-by: Sergey Temerkhanov <sergey.temerkhanov@intel.com>\nReported-by: Frederick Lawler <fred@cloudflare.com>\nCloses: https://lkml.indiana.edu/2507.3/01388.html\nReviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\nReviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_ptp.c | 17 +++++++++++++++++\n 1 file changed, 17 insertions(+)","diff":"diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c\nindex 1114a862c27b..68e87e267825 100644\n--- a/drivers/net/ethernet/intel/ice/ice_ptp.c\n+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c\n@@ -3104,6 +3104,18 @@ static void ice_ptp_setup_adapter(struct ice_pf *pf)\n \trcu_assign_pointer(pf->adapter->ctrl_pf, pf);\n }\n \n+static void ice_ptp_cleanup_adapter(struct ice_pf *pf)\n+{\n+\t/* Zero out adapter->ctrl_pf pointer when the ctrl_pf itself\n+\t * is being removed to prevent any secondary PFs from accessing\n+\t * it after it is deleted.\n+\t */\n+\tif (cmpxchg(&pf->adapter->ctrl_pf,\n+\t\t    (struct ice_pf __rcu *)pf, NULL) ==\n+\t\t\t(struct ice_pf __rcu *)pf)\n+\t\tsynchronize_rcu();\n+}\n+\n static int ice_ptp_setup_pf(struct ice_pf *pf)\n {\n \tstruct ice_ptp *ptp = &pf->ptp;\n@@ -3384,6 +3396,8 @@ void ice_ptp_init(struct ice_pf *pf)\n err_clean_pf:\n \tmutex_destroy(&ptp->port.ps_lock);\n \tice_ptp_cleanup_pf(pf);\n+\n+\tice_ptp_cleanup_adapter(pf);\n err_exit:\n \t/* If we registered a PTP clock, release it */\n \tif (pf->ptp.clock) {\n@@ -3412,6 +3426,7 @@ void ice_ptp_release(struct ice_pf *pf)\n \tif (pf->ptp.state != ICE_PTP_READY) {\n \t\tmutex_destroy(&pf->ptp.port.ps_lock);\n \t\tice_ptp_cleanup_pf(pf);\n+\t\tice_ptp_cleanup_adapter(pf);\n \t\tif (pf->ptp.clock) {\n \t\t\tptp_clock_unregister(pf->ptp.clock);\n \t\t\tpf->ptp.clock = NULL;\n@@ -3426,6 +3441,8 @@ void ice_ptp_release(struct ice_pf *pf)\n \n \tice_ptp_cleanup_pf(pf);\n \n+\tice_ptp_cleanup_adapter(pf);\n+\n \tice_ptp_release_tx_tracker(pf, &pf->ptp.port.tx);\n \n \tice_ptp_disable_all_extts(pf);\n","prefixes":["iwl-net","v1","2/3"]}