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=1796312446; b=LXkDBzQe+TrGWWxmNSJENEx6sFQ0cN58nJK8Rsz3t26NfStOCqgchXStENYOziw8lmVk JaSXLxNAqZfIzrSoYm7h4pjaDYOtcN40xtQzNZA2fGr28pfejO2YuK88dVukw73ZdN2O2 hAeOnUP5HzxTHAsVefDbXePZvvaAxofeUxukUmzBE7sJ0of9it/Gc690qhBX7+suIhkfn qZ1IUwmPSHGMpd6PUyo8uzbEhqQw9vKKW38MKHwX3p+IbIEel4D9nPoklqszhkRiBP53a JRkZInOc0ekVt4WuDRMVTsTBOWgsGMbfHRTxPOmAKE1FA5GLHyn8+VAMV7rnIBBVDvg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796312446; 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-ORIG-GUID:X-Authority-Analysis: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-GUID: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=vA9iuKo0FiAIwRMeglLyyXE+/y0namQhghzC7nDHpIo=; b=YThZbYwBWtiaCSzzm1Cbe3GkU1bjNUJsXdlQFcH9TEhyqBQL7lpY6+DA+t8HSYiqrtEM BIQXOljIB5QtycFsFobs8QGvtDBSUC7VGuPCAVI/6U0oBJ0rBVAcoKlJHNZ/EzSNKAP/L Rc6dUfojsC2m0RhQvOFbbSZX5CBgVDBp+uL+7xeO2fIGUXZ5cDvOK4XqZeiK4Z/sg7ogH +AbfgIO1/gDyDs+JIrvIx3fKKuPcxDUytrOizVHkZ2Z1LEx8zRx1vT4hWyhdZV8t8rz8K p3nt7iIZdrtdES3YKVNDtyl49lb56i7oDa1mtv0JPhB8dexehu8DJkbaRIJnq3bUGkQ== 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="GlZmEjz/"; dkim=pass header.d=ticloud.onmicrosoft.com header.i=@ticloud.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-ticloud-onmicrosoft-com header.b=XD+jT51L; 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 620EA606A32C; Thu, 3 Dec 2026 15:40:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 620EA606A32C 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, unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=proofpoint-05-2026 header.b=GlZmEjz/; dkim=pass (1024-bit key, unprotected) header.d=ticloud.onmicrosoft.com header.i=@ticloud.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-ticloud-onmicrosoft-com header.b=XD+jT51L 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 6B3EtjH61604969; Thu, 3 Dec 2026 09:40:26 -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=vA9iuKo0FiAIwRMeglLyyXE+/y0namQhghzC7nDHp Io=; b=GlZmEjz/azQuCSzsItMzCGmCawjWiIPf8ZYKDyibUOPfBuKUAtNXm1pBm +xToGRzC7PR/a1GTA6F2PIXZbVXq/flHD9q0e4IBBbxLMQS/BK3pwm1NK/gl12Q8 +6gPRka2vnaHJLP5DuFrg8yikBpO3ekSrA3eHbZiTcm6G3Y13teV/Y6B3ZZQm72M FmWWx3Fyr/l0EoSwmDjd+uZu6gDibRC51ZR12NpUdXhUgvDQ3VfcAygD2UeG6cNl rOxyRH4z6PF8+1z69p15m4zD+0/HTDhT/Xyg7xR012GPD984W+4KBkP5u8HlXNu1 cgEDMFW2YEfH6o+Kn3jyQreYznFRA== Received: from ch4pr04cu002.outbound.protection.outlook.com (mail-northcentralusazon11013054.outbound.protection.outlook.com [40.107.201.54]) by mx0b-0002e601.pphosted.com (PPS) with ESMTPS id 4jay943w8u-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 03 Dec 2026 09:40:25 -0600 (CST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hcnHMLk5COvyi3y1MDJ6HlgQVawQY2dzXHfMaTM7O+pN8JrQMM2Kb6qafA6qgOGfCCIETms+3qp1ger84+M3BXUHLGba/I7bj3n6js0VbE5wthrjYaFog2pLlRxpL8fnEw1d3ZV7BxNn3xY4NUbZMAewDDg4X72s62BcP84ovRNDjOoQ2ba1IgUyI3ocnHDrL5HqZqyHwo3mYrhuHPVswk2kdpfYt6bPbR29nxmuqGtzbheUAzLi9hWAVRShoGZDgTBLvth07bANzs3FYWVhVTPup7AsCDPp1XVgXBp50oVgrkaEJra5CVARdbnOfBEk+UjeEHx4/MqrNlfRGaDKbw== 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=vA9iuKo0FiAIwRMeglLyyXE+/y0namQhghzC7nDHpIo=; b=LErCcrt8+wQL+XxRQFo+56PpVipoXrnU6UVtaUQDIN/ShwwKhPD6MLB+CuZHYPomDuu4qADw9Wq01mwHvXVd4vnA3GvF0uhVPBfVBbkjhGVKeDOlhtw3s6+d3h1+Fy3xUy5xrSZYiDmPwWkKUK76sRTHZXLgML7C+6FgrkUNTflbQmin17hFjQa3zRbtbF9cBhB4mleuvpeBL7rEB5212/fIRNKEcX298tDgVy6zgJ1wtQNuBpZrwXe9GnNK8aArfh5olm2YQmZo1mbs6nqF3ePf6U4+hUflo8KL+oMVeavPI/Nx9CEvH2ppaHxkSIyJOi0EjsM5h5fqUNq9W3tXzg== 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=vA9iuKo0FiAIwRMeglLyyXE+/y0namQhghzC7nDHpIo=; b=XD+jT51LKrZjoqRoORMW2Gf1oYYmTZJ7+Zv6Zb+XrLoQFa/0wywvqts3KfkoLTqIiVY3X4KpTvpmO1SZBJeQ7M6G95I3TU1snJoab7nw9vUwAwD+rL+NFLIGFOR51bY6PZ2Gfu3DMHoE5OpmoViuIGhUfjDN7eSZrpUoLM7cTlw= Received: from MW4PR03CA0078.namprd03.prod.outlook.com (2603:10b6:303:b6::23) by IA3PR10MB8705.namprd10.prod.outlook.com (2603:10b6:208:583::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.11; Thu, 3 Dec 2026 15:40:18 +0000 Received: from SJ1PEPF00002318.namprd03.prod.outlook.com (2603:10b6:303:b6:cafe::88) by MW4PR03CA0078.outlook.office365.com (2603:10b6:303:b6::23) 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 15:40:17 +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 SJ1PEPF00002318.mail.protection.outlook.com (10.167.242.228) 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 15:40:17 +0000 Received: from DLEE214.ent.ti.com (157.170.170.117) 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 09:39:49 -0600 Received: from DLEE210.ent.ti.com (157.170.170.112) by DLEE214.ent.ti.com (157.170.170.117) 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 09:39:49 -0600 Received: from lelvem-mr05.itg.ti.com (10.180.75.9) by DLEE210.ent.ti.com (157.170.170.112) 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 09:39:49 -0600 Received: from [10.249.32.128] ([10.249.32.128]) by lelvem-mr05.itg.ti.com (8.18.1/8.18.1) with ESMTP id 6B3FdmoE3828280; Thu, 3 Dec 2026 09:39:48 -0600 Message-ID: Date: Thu, 3 Dec 2026 09:39:48 -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] soc: ti: wkup_m3_ipc: Use the device's own state in remove() To: Nhat Tran , Nishanth Menon , "Santosh Shilimkar" CC: , , , References: <20261120141139.55783-1-nhat.tranminhk2@gmail.com> Content-Language: en-US From: Andrew Davis In-Reply-To: <20261120141139.55783-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: SJ1PEPF00002318:EE_|IA3PR10MB8705:EE_ X-MS-Office365-Filtering-Correlation-Id: 64ea4fab-255e-49ec-8c69-08df5153bb13 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|23010399003|376014|82310400026|1800799024|10067099003|56012099006|261009223027099003|261022105027099003|261021121427099003|261102123227099003|261102130727099003|261026140227099003|261028144727099003|261026121527099003|18002099003|22082099003|6133799003; X-Microsoft-Antispam-Message-Info: logy2urEV9HaYONIhwMKaLdqEGAts5j0VkmYFGgtAe9xU6a13+qaRZ3hMESDtaFAZzdkRyFXSn+pdFStdirqdhZWX+nA9aVtlfhm11RIn38WkWSDob5OusHZrLJbwD+XAgAVlNR8aAK88eDEpUtPOWFmv4Tuu/QorXiPwvXN3QK85kp/weADMyJ28jwKgq6CqSXbQwDupzt+qiQBzAWITjD0RgJUl+netnTltx7qHNTeSsbN+nqItEHTEXh4mvGHwMNMdxEs7Icq4UdkRnXsAmwgWc13fdSR84Jiut8kP2K4Pwj156IYrV95IWtRttKu3+bdGj/QbO6t0l57eJ/OaJYpTcvV2UFemA5LW8IwBOx6U98AWBnSqXXoEbh06bVsceyWAEI3mApiY0p9a4HYyQnQCu6wGYRpD0a68s2wiCwok1f/iHOnaJJOvOTX5cgTuNYm1f0VMHlp96Qgt60nrWnh97TIWq4y1xJch4Zi39NJsatHztM0xLM5pROCKSPTAJ+bL34KhS17xbeAAqw59CMA6/vNikuvE8iAGEwAJdVqWcYygM9zntM6meGL+cKpOH4/dR+jAGmyRC3G3EWFT4xj1ZeSeJZsbm1U8NHQWpUAlhGePEUpzyXeA3O1KZyg/8nDjhnDdRUcWW4LQaxFUbpJs4cbDzSiHvr7pngipUF7TODYDAP6xEXjyNhiFNhVxYQIPs0JD6dM2SyS+CMOCQ== 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)(36860700016)(23010399003)(376014)(82310400026)(1800799024)(10067099003)(56012099006)(261009223027099003)(261022105027099003)(261021121427099003)(261102123227099003)(261102130727099003)(261026140227099003)(261028144727099003)(261026121527099003)(18002099003)(22082099003)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j6i3fIRGoaT6IdWIemnpW8CnSnf5d4f9QE5HI722KLhuSVSYtczpo5F2irZ3RvqUWeSDkSpdZKrkpIwpxPwpXETtcEYe9Att8nu12gnHRCR4bmTZ6bOpJFACsCMHieKhdH4qgoparyifNnxHshihVy4Frbt+/q4vQ5okkwKSxYST56s6KU28jWGQDxsAa/SwaEHpm/GCVmfG+soznUWsCGh4DJ/agV/N50UgcvFQXr8wKzCDwPRMNimk6jpiwbhn55c5sEoFQexA9hceoruYbsd3AoWdze7OG37XgHgwUP43FpiH7BvNFoomvTP5YMFoUL531BY8/CcoWnNpu0SDgBvZSXpYzvZJNWeVQZrUJdTvDaWoAbTAn3c9uNbA+8H9eT1nedXJYF9HVSpN8uPRB7psNodkbG6wniew/zONZMlDJzOxw6hOI4YEDKUY8ztm X-Exchange-RoutingPolicyChecked: Im3dq2b9jxgMTZF+chRFs2q8DB/8olsxhWqur/w4VfGUnNy3o0NL5X/wHG7rfcffssJoC3hXu4us9Ge1gpn1CElb47/EoFq/NWKIpmdAjsW7DQnbnvmS+u6oAnS63G4UD6l5xRqhW7XebvnOte0A5eFkOEOHj/dugVik5ByI03bfl6pIiZ79aAkQizM/lmyPBU2PRsj0Gj3z4TQ8iE5qV22KchFrDY6jJFF0UvEPFH1jNqgLVsSOsW9+KVqjmjX2j/h+RRl3vps45dsvHH5CPjvk4CbkBAoM6DRUCCu8RGJzOP15jZ6y7I7BTcmVDdIiyljZPPEeC5D/J1g6QiFVTg== X-OriginatorOrg: ti.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2026 15:40:17.1292 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64ea4fab-255e-49ec-8c69-08df5153bb13 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: SJ1PEPF00002318.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR10MB8705 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDA2MiBTYWx0ZWRfX0XTltuDQILay WpBNDJs1WKpHYP4UWB/7Cr+Vy1YpO+fC+Hz65rsDBr1+sskurgnMnkA9fSvYwj1F/6HgoCVBog7 dvGZws+RczXXHx9Dkhq83QccsusSVKM= X-Proofpoint-ORIG-GUID: wKxJECZBD2are3ta2BXNHwe9KdRMZxeX X-Authority-Analysis: v=2.4 cv=XNil2ghE c=1 sm=1 tr=0 ts=6b118d6a cx=c_pps a=ikWRpWbkSoEIfbFFe8At+Q==: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=dzBAFaJc3rahMIb3_dMA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDA2MiBTYWx0ZWRfX+f9pJ418TUz1 Nso0C02Xh0mug7TjQSCiM5EAb0+28zpvE+w3yc0ZWqaPl02L0D7gUS5LRVsE7PKiT/k32GFHtOy QNRFKs6mTyZNPe8rOCJI/EY0QrEzZMd60sQf8LzRj0H/+xGoBr5tn82MGtcpCyogQLM8122w+ju uQDkGqsdd7kfEhZaUM2O5tBqWr7Iwe/bjYsr4i0wqBnxX7mAjaTKMUoU9kzdmpU6KR/DArojZAI uTQLClArUNSoLurzZV4DtAHtUIU5sNTxeIS+arbOkMvFDrvaAUXsCf1b/mCF/celW8KLkkrXJqC YzDw8LU+rdSEd3nZegio7q7Oe5Wi370tMJNR5SyvgfNEr8Olabq2GngOUqgjCoWenXEW7fAXLxc Mgp35aVcS6AZEOwT3V+UlS7csR4aPRXzL8SOlg84a1Xr36v2tiN15lN/gqM8TKH/3Wav4AfKcTY scruftuJbWu8PaBd0RQ== X-Proofpoint-GUID: wKxJECZBD2are3ta2BXNHwe9KdRMZxeX 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_04,2026-12-03_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 adultscore=0 clxscore=1011 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612030062 On 11/20/26 8:11 AM, Nhat Tran wrote: > wkup_m3_ipc_remove() tears down the driver through the global > m3_ipc_state pointer. That pointer is only set by the rproc boot thread > once rproc_boot() succeeds, while probe returns success regardless of > the boot result. 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 > unbinding the driver dereferences it. > > On a BeagleBone Black (AM335x): > > wkup_m3_ipc 44e11324.wkup_m3_ipc: rproc_boot failed > # cd /sys/bus/platform/drivers/wkup_m3_ipc > # echo 44e11324.wkup_m3_ipc > unbind > Unable to handle kernel NULL pointer dereference at virtual address 00000064 when read > Internal error: Oops: 5 [#1] SMP ARM > PC is at wkup_m3_ipc_remove+0xc/0x48 > LR is at device_release_driver_internal+0xbc/0x144 > Call trace: > wkup_m3_ipc_remove from device_release_driver_internal+0xbc/0x144 > device_release_driver_internal from unbind_store+0x50/0x74 > unbind_store from kernfs_fop_write_iter+0x11c/0x1d4 > kernfs_fop_write_iter from vfs_write+0x2a8/0x3f8 > vfs_write from ksys_write+0x60/0xe0 > ksys_write from ret_fast_syscall+0x0/0x54 > > The same happens when the mailbox the driver depends on is unbound. > > Store the per-device state as driver data in probe and use it in > remove(), so the debugfs entries, the mailbox channel and the rproc > reference taken in probe are released whether or not the M3 was > booted. rproc_shutdown() already returns -EINVAL for a remote processor > that is not running. > > Tested on a BeagleBone Black with the firmware not loaded at probe > time: unbinding the driver directly or through the mailbox no longer > oopses, and repeated unbind/bind cycles rebind and boot the M3 again. > > Fixes: cdd5de500b2c ("soc: ti: Add wkup_m3_ipc driver") > Cc: stable@vger.kernel.org > Signed-off-by: Nhat Tran > --- Good find, but this fix is incomplete. You'll end up with the same NULL dereference in `wkup_m3_ipc_resume()` should we go into suspend before firmware is loaded, same for debugfs access before firmware. The core issue is that `m3_ipc_state` being set is used both to signal the core is available, and access the device structure in functions that can't get it through other means. It would be betterto split these two which also solves the issue here. Basically after probe `m3_ipc_state` should always be set to prevent NULL dereference and a different signal variable added/used for available check, something like: > diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c > index eb6074a67ba3b..b351623079f16 100644 > --- a/drivers/soc/ti/wkup_m3_ipc.c > +++ b/drivers/soc/ti/wkup_m3_ipc.c > @@ -547,7 +547,7 @@ static const char *wkup_m3_request_wake_src(struct wkup_m3_ipc *m3_ipc) > */ > static void wkup_m3_set_rtc_only(struct wkup_m3_ipc *m3_ipc) > { > - if (m3_ipc_state) > + if (m3_ipc_state->available) > m3_ipc_state->is_rtc_only = true; > } > > @@ -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->available) > get_device(m3_ipc_state->dev); > else > return NULL; > @@ -584,7 +584,7 @@ EXPORT_SYMBOL_GPL(wkup_m3_ipc_get); > */ > void wkup_m3_ipc_put(struct wkup_m3_ipc *m3_ipc) > { > - if (m3_ipc_state) > + if (m3_ipc_state->available) > put_device(m3_ipc_state->dev); > } > EXPORT_SYMBOL_GPL(wkup_m3_ipc_put); > @@ -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_state->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 5e1b26f988e22..f4a8ab45ee306 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;