From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpbgeu2.qq.com (smtpbgeu2.qq.com [18.194.254.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A615E3F65FC for ; Mon, 27 Jul 2026 10:44:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=18.194.254.142 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785149045; cv=none; b=MZ+NcOZJYkRze6Q74V1PSxPFtOjY5MU3E1ZvqVV+6nArDSD7LYaE2gHYZ4SgUDi3K6WKXSM4znlZxTN6+nT0z0mR+mVZDP9GI0ZPOtAsIVoM/+x2Epjgjda3lLDT9lXTSIm4U8pytrS5YcVRVWsri7+oj3R2PxxLEae9TCmGS7k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785149045; c=relaxed/simple; bh=D3+w2wvjQRROVr0KQKpVOZZA5OXXGU0XMgZ8VNSyJXo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dWohIoxG/HbMmIiQlR1dy8flJWY7gmlJjLowqi77NlyQ2TkVs0Wz0cx9zPVDRHROedDlnJ9iKtTY8uo8RdryFpDwrBT+N8VF9chC5Es4JJTU/is8byek/w93psIzxm+1IKnKIfzIHRpgKsID1jLlq75+p4hMJ8jwxCr/BmubHHM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com; spf=pass smtp.mailfrom=uniontech.com; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b=R0X/gpQF; arc=none smtp.client-ip=18.194.254.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniontech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b="R0X/gpQF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1785148975; bh=ls2JxttOX9m/OH0Ji2giU8VW2A62OMMFfToSeR4oAHQ=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=R0X/gpQF5HrO1GZYnK0NTgZnMWP4rn+8VuAjJGZ6NyISiUnRexpZ3Qwrn1rk4Byew cBQoKj2y8ZWW5cx3I6MgZIjq1h+lAq/2UWyL3uAUnk8vHcz1lxLnJqQNTWHzp5x1kG QTSuv0ULv67bRmoev1FJiphQsFAVPthSAYKa5Vcc= X-QQ-mid: zesmtpip2t1785148963t9475962f X-QQ-Originating-IP: ockOe7XHHARhEMveJ2Rfcx2IR/gFdsOpyasST/oAAwA= Received: from localhost.localdomain ( [localhost]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 27 Jul 2026 18:42:41 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 1 X-BIZMAIL-ID: 16030799654733497151 EX-QQ-RecipientCnt: 21 From: Gou Hao To: maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, namcao@linutronix.de, peterz@infradead.org, sshegde@linux.ibm.com, kees@kernel.org, lgs201920130244@gmail.com, srikar@linux.ibm.com, ynorov@nvidia.com, nilay@linux.ibm.com, clg@kaod.org, benh@kernel.crashing.org, miltonm@bga.com, mkchauras@gmail.com, akpm@linux-foundation.org Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, gouhaojake@163.com, kernel@uniontech.com Subject: [PATCH v3 5/5] powerpc/smp: add NULL guard for cause_ipi in smp_muxed_ipi_message_pass Date: Mon, 27 Jul 2026 18:42:15 +0800 Message-Id: <20260727104215.184786-6-gouhao@uniontech.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20260727104215.184786-1-gouhao@uniontech.com> References: <20260727104215.184786-1-gouhao@uniontech.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: zesmtpip:uniontech.com:qybglogicsvrgz:qybglogicsvrgz5b-2 X-QQ-XMAILINFO: MQPu5pFEJFN4oG81pN7JVHui50BiujakWoOdlLfz9aeK7vwFVZDZ6h8m vTrYF9H9BrOHEmauDwk5L56ec7IDT1+43oAMlcTc5NUBwHMBdeOUve5UG3ymZhu0lY/4QBD lk9k31OJZJSJ7IJjCggognhwD/iq73ELVPaAeH33kI403v+xeo5XQVgM7r10hpZO/i+95+W c0tDhFRXOG56fy0DmwU97+XhehnWVzdSeHXFlke5tcQN1XbP9e+Cds5Tx1O0vLAQa9CSgha WBuHT9zen4yBFwStbnAoIxH8VqB56JCvEavfu8IHUULR8+34mLN+hIi8WS5VLsZXUUeOe5M JUtbvBVTGlVpVVRxfzVD9rSBo6cTRMMxfxEsISIsZfG/oEnFBZEzAWkHckhytpHMnl7IO/T u+Arn6qKbwzkGCk7/nGO9yEQlI6Z5lrPzyGMpEQG8q5pWm4VHK+a0NSG+u8CH0ZmEIQjCO/ OzxF6a1AR8PF6G5mA2SRDcFHRhmIvoeJvrsjoPReia7pjyspCU5j07IndXLfyHIxCNRKQ4z KmYZDY6UC1eT63ioW0tgZ+MWQPLF7JdBtHkveJQ3Wt/VvtatHv/vyOsY12TUKGj6cooWBZn 5MwLQCQydpHVYw1rf3PazyjOFxgKb0D4mIX2Q97r3HtnXRx4iAIBcnV5CBURott0Bo6atIh +krUV8BDi6Vz0PVc3y4cISOgDk+8OIekUrN79p8DTro16t7FTyHA2FHjia1NoZOtecssdYM 8vlCSGfoplvJS2C6IvV2bBS0CQj5M1p+Sg4cpBphlBuNOKYji9/56naNBVwV4+43oAHukxA jl95ypLSTSu+U/c1kbgkwgu9y6IYBti0ZzLrE8RIFDikWSYXmMGau6ill8PhAz4YAEWeJxn MaPofpXBl6YPpamm7Ef6gllWa1R5obgHsAvqGbzuByv84QM858IlTWGvFFxDxkxNZ17V1dg odTPxlNdNT9kezhDjHrIRC8BjX5Wne/BQtPJMOIsZi9TRVFCu5iL/YRimDsZHkU/r1o4cG2 a2xvBsCuzP7Co1S3owZ45ZqzcN2EZUDxdZiXYeaQ== X-QQ-XMRINFO: NS+P29fieYNwqS3WCnRCOn9D1NpZuCnCRA== X-QQ-RECHKSPAM: 0 smp_muxed_ipi_message_pass() calls smp_ops->cause_ipi() without checking whether it has been set. On platforms using muxed IPI (e.g. powernv/pseries), smp_ops->cause_ipi is initialized to NULL in the static smp_ops and only assigned during the platform smp_probe() handler. If the IPI subsystem fails to initialize -- for example when xive_init_ipis() fails and xive_smp_probe() returns an error -- the probe handler returns early and cause_ipi is never set. Any subsequent IPI send (e.g. arch_smp_send_reschedule()) would dereference the NULL pointer. Add a NULL check to avoid the crash in that situation. Fixes: 23d72bfd8f9f ("powerpc: Consolidate ipi message mux and demux") Signed-off-by: Gou Hao Reviewed-by: jiazhenyuan --- arch/powerpc/kernel/smp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 3467f86fd78f..6a5a5469aaae 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -289,6 +289,9 @@ void smp_muxed_ipi_set_message(int cpu, int msg) void smp_muxed_ipi_message_pass(int cpu, int msg) { + if (!smp_ops->cause_ipi) + return; + smp_muxed_ipi_set_message(cpu, msg); /* -- 2.20.1