From patchwork Thu Mar 6 08:03:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manjunatha Venkatesh X-Patchwork-Id: 14005332 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58130C28B24 for ; Thu, 6 Mar 2025 21:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=jS7HShDJNxGouL6f0kINccD7pBFvuMUAoaEj0kTmzUo=; b=Ug82ACkYyVZhbV jqpp54rzUhYH01El+u1r6TvG7lwQTrNdjPWHPxaZAn6UUK8qXlcdWaryik82NG/wSIxgBdIeGjbCS joGnI77gQy+YQlN73v8LK2h0/PY3dlqBRxI76RF+PhhJtLD1XjnfThGJGukjPvc/6aXo25urd8Va1 gSjNwjRPuHBN77zL9pl1Cyc18OjbCCJkT3oDG28+zWaU/kuv7X3QPEc4XLXx4cvZ1llndqAR6MHd1 l7vSbfE0W53NnlU8/Kv8Xe2sjzh95TUhLU0ORp057CLlxY2ayshkKoKFy7ruGfBKX3Wziela+osVX y+8y94+g2s8SoizhYxOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tqIKW-0000000CC8D-0RaL; Thu, 06 Mar 2025 21:00:32 +0000 Received: from inva020.nxp.com ([92.121.34.13]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tq6Cz-0000000AHGf-2NRM for linux-i3c@lists.infradead.org; Thu, 06 Mar 2025 08:03:58 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 7443C1A1021; Thu, 6 Mar 2025 09:03:52 +0100 (CET) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 3B8D91A1018; Thu, 6 Mar 2025 09:03:52 +0100 (CET) Received: from lsv03121.swis.in-blr01.nxp.com (lsv03121.swis.in-blr01.nxp.com [92.120.146.118]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 693181800257; Thu, 6 Mar 2025 16:03:50 +0800 (+08) From: Manjunatha Venkatesh To: miquel.raynal@bootlin.com, conor.culhane@silvaco.com, alexandre.belloni@bootlin.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, manjunatha.venkatesh@nxp.com, rvmanjumce@gmail.com Subject: [PATCH v2] svc-i3c-master: Fix read from unreadable memory at svc_i3c_master_ibi_work() Date: Thu, 6 Mar 2025 13:33:45 +0530 Message-ID: <20250306080345.243957-1-manjunatha.venkatesh@nxp.com> X-Mailer: git-send-email 2.46.1 MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250306_000357_732793_86032D8E X-CRM114-Status: UNSURE ( 8.23 ) X-CRM114-Notice: Please train this message. X-Mailman-Approved-At: Thu, 06 Mar 2025 12:56:28 -0800 X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org As part of I3C driver probing sequence for particular device instance, While adding to queue it is trying to access ibi variable of dev which is not yet initialized causing "Unable to handle kernel read from unreadable memory" resulting in kernel panic. Signed-off-by: Manjunatha Venkatesh --- Changes since v1: - Patch tittle updated as per the review feedback drivers/i3c/master/svc-i3c-master.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index d6057d8c7dec..98c4d2e5cd8d 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -534,8 +534,11 @@ static void svc_i3c_master_ibi_work(struct work_struct *work) switch (ibitype) { case SVC_I3C_MSTATUS_IBITYPE_IBI: if (dev) { - i3c_master_queue_ibi(dev, master->ibi.tbq_slot); - master->ibi.tbq_slot = NULL; + data = i3c_dev_get_master_data(dev); + if (master->ibi.slots[data->ibi]) { + i3c_master_queue_ibi(dev, master->ibi.tbq_slot); + master->ibi.tbq_slot = NULL; + } } svc_i3c_master_emit_stop(master); break;