From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=148.163.154.28 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796325501; b=sdBZXKQExCfiatUm5zqJdPretRR/cfyuk4oCMZHFJAOrbudg1cle0ZN2KNWl3xXvi9mq Xo2iPrGaGIQrB61U4etFblQYuxL5sXBuBl3znyPZthrOHlE25xzImwBi3o6YwnIMyHliL bYhzP2H9FwBVq5Z40WGYoPU9lS67bMMaSPN8iffX5umVYMv7kzoo7o+w2A1pbjfMUyHyW 1zwr0RxSTfozcadDP6bAC2DXrHcidLU5NOeo75XNo8gIkuI3cKkX8zTocTM3v6JWEJmys VCyyqgKlAgTKxGD9DtUur/alNT/yGA4OCf86ir3cxMDtBpQPOveOe8zVyTB3YKXHVjA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796325501; h=DMARC-Filter:Received:DKIM-Signature:Received:DKIM-Signature: Received:Received:X-MS-Exchange-Authentication-Results:Received-SPF: Received:Received:Received:Received:Received:Message-ID:Date: MIME-Version:User-Agent:Subject:To:CC:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding: X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-Exchange-RoutingPolicyChecked: X-OriginatorOrg:X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped: X-Proofpoint-Spam-Info:X-Proofpoint-GUID:X-Authority-Analysis: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-ORIG-GUID: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=mXdjtMO+7KKm0fQIJn/aKBaP0/GZkylenv268tV54XI=; b=VzJzw8UhLStDsmsO1Lbm9MYRjdvfgmrlEW4BjtoeaY+/Vs3qo0quiNjNB7EytP2LYDih 6mrmuxPYvZEbfZVBXHhiXxifkDbN9WGBHK66l4YrG+mXAqYpBOtRt0zpSzrwc4T0uD56x cvhF3Bgblj/wichFZbJ0AnhGMUUyAbAX+eDVSIyzy7/5Kem4OdB5Me5ZDjfeVBzowxmKo QGhaQv+nXkFTu/6amcvIP64rZGk/H3zZkh5Y9JAx0eDz/5CBQKTMdf9ZMijOaq3Lqau9+ I0rZZB2fwrHpGNlScL5PFS56N3ymQ1svMgV+BbJcysPOUWld4zcXM6Q/BHzLGGQeU+g== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=proofpoint-05-2026 header.b=KXL17JeM; dkim=pass header.d=ticloud.onmicrosoft.com header.i=@ticloud.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-ticloud-onmicrosoft-com header.b=JZ9GihRQ; arc=pass header.oldest-pass=0 smtp.remote-ip=148.163.154.28 Received: from mx0b-0002e601.pphosted.com (mx0b-0002e601.pphosted.com [148.163.154.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B810606A32D; Thu, 3 Dec 2026 19:18:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5B810606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=proofpoint-05-2026 header.b=KXL17JeM; dkim=pass (1024-bit key) header.d=ticloud.onmicrosoft.com header.i=@ticloud.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-ticloud-onmicrosoft-com header.b=JZ9GihRQ Received: from pps.filterd (m0374956.ppops.net [127.0.0.1]) by mx0b-0002e601.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B3IKK7J2027093; Thu, 3 Dec 2026 13:18:13 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= proofpoint-05-2026; bh=mXdjtMO+7KKm0fQIJn/aKBaP0/GZkylenv268tV54 XI=; b=KXL17JeMDSZI7zT+7NF9AMpJ/+bO3Yqg2wcUVRBFMeZnrhyjIgRzLnPvG fCEqfoaCGYGtl3BxxD7FptVTSEhqQOd8AZgxhPKHCcfbwgCH0SiuBHLk/Dm0m3W+ quRZ9NOo+8PYMzOE8AXo0D5gYPwU+O6pfpekRFPPoTF7eBYA340/7rxJgu5HNoCa VmLMebfiVm4p2mHnMhNhnOMYVCMCGrAKOZ3KoPsS9Ox00MOT1tPZu6gZcMQ0E3/V YNvqMJYTEOJzvfUsthSMuQvVBt8eaJy78w3wFn/Z1mz7YiqM1q9D2UcQaPjAlFNv VOGCqeJvC0RHkOmfnc1U1hobP1bjA== Received: from dm1pr04cu001.outbound.protection.outlook.com (mail-centralusazon11010004.outbound.protection.outlook.com [52.101.61.4]) by mx0b-0002e601.pphosted.com (PPS) with ESMTPS id 4jbby9gyvd-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 03 Dec 2026 13:18:13 -0600 (CST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nIgajsoR98Y6pa4mQSdA2i0bCi1v49vQEwj31RyA+2Fg5YSDMiv3bUIeedZHLfVDfmw5wkXjutl9COv8OoxWpP+UrabnTmd4W2zVdCwsvEAkC1XrHUsBeDc5YF0tGJBAx9nJ0L9w3xsCcNhZQoWt4gpvDyzGfI52T+uBrNi85sh8a7jpfTcujwA7KGCoF+RynbhA5MivUQfDa2IOAYaQOA67SX4IZ4ThE/tIVzV41vHaXat5/QyC97L93FdxtBtYR5o0Pg4e5mOSsSHvf7qZUQvDQm1wHmsv2ZrZmXrJt6GVtxnnYagqOuN9zSUzo/wKWyX2bSXRy8TNxLHxJXae9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mXdjtMO+7KKm0fQIJn/aKBaP0/GZkylenv268tV54XI=; b=npS6+l6HfycVRjBJXfvEDIC0FFsvGqNZiYmaqY6DNyDIfsegKyMdzitbLeeB/s1DBLX+l14VkM2V94kCOKLn6tqfFHcFNdZ42gVAwpthf4rb5oU6+3IclMnKKw7NZnBucYnjGQnI6uZC16akp6BG7mZPWuInZvHJSuE3RzsCJvSRmaPgHr8YBj+ZVMKnKli+efraR4rzDZNQK0CpuFZPC2gvbXa9V8htKqMVTiARmH0md77PuM0w5NR1/kYTGt5YsA3K5RLX6Fj0avNNe+1rf7F2GwVhaVp8OUC/DktoDFHqqx6gC2MLoHQFH6hhS5ZV9t4kdlAxlirAoDOcnBpaJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 198.47.23.195) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=ti.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ticloud.onmicrosoft.com; s=selector1-ticloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mXdjtMO+7KKm0fQIJn/aKBaP0/GZkylenv268tV54XI=; b=JZ9GihRQ5T8aY1XmDIRkJj2D2kz1dqgHas46TGtyTt9gF4IwNt3cfuyQFoplPRYg4lPO+pmoPSxVAvAiXDjje1Nrifca4IC9sLgZBV8hCOC0ZGiBRpFgp+KA91fBrbvMudZr2V7PHDNGD76N8lKIGEz7tNJgoAGKS5Z1a9zplzE= Received: from PH8P221CA0019.NAMP221.PROD.OUTLOOK.COM (2603:10b6:510:2d8::8) by CH2PR10MB4390.namprd10.prod.outlook.com (2603:10b6:610:af::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.12; Thu, 3 Dec 2026 19:18:08 +0000 Received: from PH1PEPF00062F2E.namprd03.prod.outlook.com (2603:10b6:510:2d8:cafe::a2) by PH8P221CA0019.outlook.office365.com (2603:10b6:510:2d8::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.12 via Frontend Transport; Thu, 3 Dec 2026 19:18:08 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 198.47.23.195) smtp.mailfrom=ti.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ti.com; Received-SPF: Pass (protection.outlook.com: domain of ti.com designates 198.47.23.195 as permitted sender) receiver=protection.outlook.com; client-ip=198.47.23.195; helo=lewvzet201.ext.ti.com; pr=C Received: from lewvzet201.ext.ti.com (198.47.23.195) by PH1PEPF00062F2E.mail.protection.outlook.com (10.167.243.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.6 via Frontend Transport; Thu, 3 Dec 2026 19:18:08 +0000 Received: from DLEE203.ent.ti.com (157.170.170.78) by lewvzet201.ext.ti.com (10.4.14.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45; Thu, 3 Dec 2026 13:17:35 -0600 Received: from DLEE205.ent.ti.com (157.170.170.85) by DLEE203.ent.ti.com (157.170.170.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45; Thu, 3 Dec 2026 13:17:35 -0600 Received: from lelvem-mr06.itg.ti.com (10.180.75.8) by DLEE205.ent.ti.com (157.170.170.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45 via Frontend Transport; Thu, 3 Dec 2026 13:17:35 -0600 Received: from [10.249.32.128] ([10.249.32.128]) by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 6B3JHYi13210492; Thu, 3 Dec 2026 13:17:34 -0600 Message-ID: <80ed8a58-7c48-4374-8dfb-f931406c35c8@ti.com> Date: Thu, 3 Dec 2026 13:17:34 -0600 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] soc: ti: wkup_m3_ipc: Fix NULL dereference when the M3 fails to boot To: Nhat Tran , , CC: , , , References: <20261203174139.55646-1-nhat.tranminhk2@gmail.com> Content-Language: en-US From: Andrew Davis In-Reply-To: <20261203174139.55646-1-nhat.tranminhk2@gmail.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH1PEPF00062F2E:EE_|CH2PR10MB4390:EE_ X-MS-Office365-Filtering-Correlation-Id: b56b3b2f-4b51-46cd-23ad-08df51722a14 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700016|23010399003|1800799024|261009223027099003|13003099007|22082099003|18002099003|56012099006|261102123227099003|261026140227099003|261028144727099003|10067099003|261021123027099003|261022105027099003|261021121427099003; X-Microsoft-Antispam-Message-Info: 7Xy9tHZV7UP6aAe50rgZMdfMRju3gE+S0cc4tT/Au2bgDf5ZxLjLjC5B0DA4uYa4JItmAfSAd5inZspA5y262JcB/QdtlWSSjcHEtNJ/0ttr8C9+DsyTtB8LY0xWEjoGYfihpXhutfCg1rd0WCdXcFYPrGijhCi/nPeHd5ffJh1kU0BOUya/lz3izketUybIXxyQy7V4rMmJ2RuM6ppkLJPJEcHkAVCNuVKa3xfPBuLuz82TvLe8o0aQ799Ytld2t8TE1q9MYnIyl+amqrtb12qO7Z7Hk6r6e38EHYpE24c/4Sg0GQbKWQdlfgXtA6C2s1udESkLkfmeZaIjxo/dy3eHkfnq1URKP3bYV44CeSBkJJCd0HoPelSKq3BBeF1HZ9UrBfWsPPSVf/Bo7EDPt7jUdFuBrhXxFPdItvAW+XAhF777G7Y78j7FJfupjq+L0VqYVpln+vqAMzbPjpApBVt5P8txp6h9g4hQbs/tVJeCS+f/a1+c5qSTX61EXN59XyzrAkTNp1iTakjKN5UNIlfKgvZcI+PhHSww5s6wxHtggWXfbzflX7x7O1Uyu+RPMd3DbO7q971aIFApLAl0tZpqFakOfF9BpeuB3zideIqx41T0S20Wiyz+v+j5x5KORyQLZGWf7qxwEsh8e+8nQWGrAJPNza6yT29YuETeF0k= X-Forefront-Antispam-Report: CIP:198.47.23.195;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:lewvzet201.ext.ti.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700016)(23010399003)(1800799024)(261009223027099003)(13003099007)(22082099003)(18002099003)(56012099006)(261102123227099003)(261026140227099003)(261028144727099003)(10067099003)(261021123027099003)(261022105027099003)(261021121427099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0OzVaKDyWzRnsnItUsfwhh/m5lx2YT/5sB3lvxtQtTcsS0pUhdDTdhGGCWIn71y3wRsn7vM59J0UKkrKx4WbMoTXZqdDxMOrGe8gglE5W7YKsqqBeBxPWWI5NHVoNV6+QuPtLs89w2ZMi4vXUh4hOq0VyvkT9YhKodNYL/p1Fz2vdv4U0JPWwKtpFY7ca5tD4d6/l3bM4HIj4jHO6Uit8L1bg2zaN4ESgIUoR6u4DcROIEigiJl+YzEJ2onTyo72xiL8eBICyfUtkMbAUtcN5S2ppA9q8loIxVui+r8fpKsmosjKblNN0GVh2etMXBN2kFjUN+MwJkMLUxlg0JrwP7viykCekWL6Pa2wIfAZuVsvdqp2LsJ7NvnenUtsJtU1nB4CSC9TQB2zlp/W2fd29grw2TRoj3Q+QAywcCQyPsOrTwYsmEEHWt1i24uIjBQ5 X-Exchange-RoutingPolicyChecked: WYElo01L/i1s2J3nR+bAhPvO8PxbytIaBoVRkXtuYKsZPKacUvgjL7+xYS4PCOyZJ9m19VUQ8SyNRapnEdX4tfhcDQoIvzH3lLnl+qnbKryNRNPxjGPomQvesHkczVfSyk73+VqpQHdBB5xLdc2wNsTJG/jAmZwdXzZHpxMX+IIdv9O0f5gZQPww+pnSCGhx8+OSuG56grKbBmsu/r/jbtREt0ZW9yKNYLlJONRVtzzGwP/FIrYZB2Jl/EfAkYUI0yqZSSQRU65g+a/QG0FZUpK09ncb0NNnGROkZ2HM4grSVYPVyqX1EBspn0S/IS2OO69EeVFpEDkdu/lT9cuxJg== X-OriginatorOrg: ti.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2026 19:18:08.2931 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b56b3b2f-4b51-46cd-23ad-08df51722a14 X-MS-Exchange-CrossTenant-Id: e5b49634-450b-4709-8abb-1e2b19b982b7 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=e5b49634-450b-4709-8abb-1e2b19b982b7;Ip=[198.47.23.195];Helo=[lewvzet201.ext.ti.com] X-MS-Exchange-CrossTenant-AuthSource: PH1PEPF00062F2E.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4390 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDA3NiBTYWx0ZWRfX7tk6Rfq9D8Ry yAiNdUhuPjwSGDh/v6imyOFGCZwfIY5IBZAften8UGp7XmNYpTk2CQTXcd0m7jfn3Wz3QvOqfut mPVZ9A5MlHiCSlpaJROMfly7wOMmOmw= X-Proofpoint-GUID: o6q8Sp3J9WPFIN1OYuPIbtDBOFdZ-PxU X-Authority-Analysis: v=2.4 cv=OoTaWC/t c=1 sm=1 tr=0 ts=6b11c075 cx=c_pps a=R4qMYQySjg0trGpnu7oNJw==:117 a=f+v6EHfkeJbVwR46tk4DMg==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s63m1ICgrNkA:10 a=AlMIdn_sM9wA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Z8NIEmU8O1QQgoT56wFK:22 a=jwouBfj2j3NM8CExmVVE:22 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=sozttTNsAAAA:8 a=K8KnfoipKHI0cPEVpEAA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDA3NiBTYWx0ZWRfXyIAf/W8eXSZS cHHSy4A5ECPhtYTqcdxh+5ozfknvGeAA4krqWtDSE27hgqvznRWooddfinJSFbBWEHlpZv0fAQH OdE25k18JARlvL0qSUjITOadRCVr2hwW1fAKewDQZrFgkvq5z6BvwnVNrYkShHwCZQX92FZBTET NKg3mupzUnfaYqXl5DGnVoIRThVMTlOdXRxu7v1q69E/rPsLbhDPwN9ETNb5NskaYnxbvLrgPYf VayKrHaZnWsstV88rQwwWlZb7pC/LZAL9bEA2n7f30hDJ4BEGk8yb1E4RWaOap9un5gLdFM1mSH GLLAyIvgQpNDz9hFNkiOvbSVmu9ra0MYLVdkST8N+fcYmBm2yhjVTiBznjWgOR4Ve54OCFkGQmL xnbREPt5RTV5Vg3ZP0uNKzeFZVaGoG07SYLqcKby6ZfGRwsnwvqoN6tw894xoCzDcrmupJgp11W izw7fL1a9v+4jZ/nG6w== X-Proofpoint-ORIG-GUID: o6q8Sp3J9WPFIN1OYuPIbtDBOFdZ-PxU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-03_05,2026-12-03_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 bulkscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 priorityscore=1501 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612030076 On 12/3/26 11:41 AM, Nhat Tran wrote: > m3_ipc_state is set by the rproc boot thread only once rproc_boot() > succeeds, while probe returns success regardless of the boot result. > The pointer is used both to tell wkup_m3_ipc_get() that the M3 is > available and as the only way remove() and the resume callback reach > the driver state. If the wkup_m3 firmware cannot be loaded, for example > because the driver is built in and probes before the root filesystem > holding am335x-pm-firmware.elf is mounted, m3_ipc_state stays NULL and > both resuming from system sleep and unbinding the driver dereference it. > > On a BeagleBone Black (AM335x) with the firmware missing: > > wkup_m3_ipc 44e11324.wkup_m3_ipc: rproc_boot failed > # echo devices > /sys/power/pm_test > # echo freeze > /sys/power/state > Unable to handle kernel NULL pointer dereference at virtual address 00000060 when read > Internal error: Oops: 5 [#1] SMP ARM > PC is at wkup_m3_ipc_resume+0xc/0x44 [wkup_m3_ipc] > LR is at dpm_run_callback+0x4c/0x208 > Call trace: > wkup_m3_ipc_resume [wkup_m3_ipc] from dpm_run_callback+0x4c/0x208 > dpm_run_callback from device_resume+0xf0/0x298 > device_resume from dpm_resume+0x178/0x2dc > dpm_resume from dpm_resume_end+0xc/0x1c > dpm_resume_end from suspend_devices_and_enter+0x25c/0x9d4 > suspend_devices_and_enter from pm_suspend+0x2f8/0x340 > pm_suspend from state_store+0x68/0xc8 > > Unbinding the driver, directly or through the mailbox it depends on, > oopses the same way in wkup_m3_ipc_remove(). > > Split the two uses. Set m3_ipc_state at the end of probe so it is valid > for as long as the driver is bound, and add an 'available' flag that the > boot thread sets once the M3 is running and remove() clears. > wkup_m3_ipc_get() checks the flag, so pm33xx still defers its probe > until the M3 has booted. The boot thread sets the flag through its own > pointer because it is started before probe assigns m3_ipc_state. > wkup_m3_ipc_put() keeps checking only the pointer, as it has to drop > the reference taken by wkup_m3_ipc_get() whether or not the M3 is still > running. > > Tested on a BeagleBone Black: > - firmware missing: s2idle with pm_test=devices resumes without an > oops, and repeated unbind/bind cycles no longer oops > - firmware present: the M3 boots, pm33xx probes, and s2idle still > suspends and resumes > > Fixes: cdd5de500b2c ("soc: ti: Add wkup_m3_ipc driver") > Cc: stable@vger.kernel.org > Suggested-by: Andrew Davis > Signed-off-by: Nhat Tran > --- Acked-by: Andrew Davis > v1 -> v2: > - Instead of passing the state to remove() as driver data, keep > m3_ipc_state set from probe and track whether the M3 is running in a > separate flag, as suggested by Andrew Davis. This also fixes > the same NULL dereference in the resume callback, which v1 missed. > - Retitled from "Use the device's own state in remove()". > v1: https://lore.kernel.org/r/20261120141139.55783-1-nhat.tranminhk2@gmail.com > --- > drivers/soc/ti/wkup_m3_ipc.c | 8 ++++++-- > include/linux/wkup_m3_ipc.h | 1 + > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c > index eb6074a67ba3..7f9d67115ebf 100644 > --- a/drivers/soc/ti/wkup_m3_ipc.c > +++ b/drivers/soc/ti/wkup_m3_ipc.c > @@ -569,7 +569,7 @@ static struct wkup_m3_ipc_ops ipc_ops = { > */ > struct wkup_m3_ipc *wkup_m3_ipc_get(void) > { > - if (m3_ipc_state) > + if (m3_ipc_state && m3_ipc_state->available) > get_device(m3_ipc_state->dev); > else > return NULL; > @@ -601,7 +601,7 @@ static int wkup_m3_rproc_boot_thread(void *arg) > if (ret) > dev_err(dev, "rproc_boot failed\n"); > else > - m3_ipc_state = m3_ipc; > + m3_ipc->available = true; > > return 0; > } > @@ -695,6 +695,8 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) > goto err_put_rproc; > } > > + m3_ipc_state = m3_ipc; > + > wkup_m3_ipc_dbg_init(m3_ipc); > > return 0; > @@ -708,6 +710,8 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) > > static void wkup_m3_ipc_remove(struct platform_device *pdev) > { > + m3_ipc_state->available = false; > + > wkup_m3_ipc_dbg_destroy(m3_ipc_state); > > mbox_free_channel(m3_ipc_state->mbox); > diff --git a/include/linux/wkup_m3_ipc.h b/include/linux/wkup_m3_ipc.h > index 5e1b26f988e2..f4a8ab45ee30 100644 > --- a/include/linux/wkup_m3_ipc.h > +++ b/include/linux/wkup_m3_ipc.h > @@ -29,6 +29,7 @@ struct wkup_m3_ipc { > int isolation_conf; > int state; > u32 halt; > + bool available; > > unsigned long volt_scale_offsets; > const char *sd_fw_name;