From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D3A5C433E2 for ; Mon, 14 Sep 2020 06:35:44 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD53720771 for ; Mon, 14 Sep 2020 06:35:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0D9UJgqg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD53720771 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dGFVae+49LbIWf6KNONA06WtVZSHRjOSCPrQXzsmUHA=; b=0D9UJgqgUfodtTw2EJMcIX2uHL KPKEbNjCq7NRly5fgLyPhyIPIZ5PXRt33puJ48mxYMW2AgU1hyrnq9PnM5BCXVcCbJRNQaT2RziDp 3B/cBbx+H9STHgEiMbAyfPaThFAeMFe2i7CxpRVYP8k93gbcyIxv0+GBprIW/jxQt6z/lCcOOANHl pir+Aa/JqkOriT7Q2gf0mRbcD1l4mwTze/GckOaTb7KIK99NassxolCEoOsVXM4Uw33b7k+C9n4MQ m3VzBcpavWwBFJDfsA4evmpGBhOk7hXTYwongidxMVkhb9zyr1CXPab+17wdfETsP/JX1AevvjxBb 7+DH5OCQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHi4W-0004mu-9u; Mon, 14 Sep 2020 06:34:40 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHi4T-0004mP-TJ for linux-arm-kernel@lists.infradead.org; Mon, 14 Sep 2020 06:34:38 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6D579D6E; Sun, 13 Sep 2020 23:34:30 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BBE783F73B; Sun, 13 Sep 2020 23:34:29 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, Sudeep Holla Subject: Re: [PATCH] firmware: arm_scmi: Fix NULL pointer dereference in mailbox_chan_free Date: Mon, 14 Sep 2020 07:34:23 +0100 Message-Id: <160006520686.28306.2580641037987580617.b4-ty@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908112611.31515-1-sudeep.holla@arm.com> References: <20200908112611.31515-1-sudeep.holla@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200914_023437_999658_11AC0CC6 X-CRM114-Status: GOOD ( 12.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Viresh Kumar , Cristian Marussi MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 8 Sep 2020 12:26:11 +0100, Sudeep Holla wrote: > scmi_mailbox is obtained from cinfo->transport_info and the first > call to mailbox_chan_free frees the channel and sets cinfo->transport_info > to NULL. Care is taken to check for non NULL smbox->chan but smbox can > itself be NULL. Fix it by checking for it without which, kernel crashes > with below NULL pointer dereference and eventually kernel panic. > > Unable to handle kernel NULL pointer dereference at > virtual address 0000000000000038 > Modules linked in: scmi_module(-) > Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno > Development Platform, BIOS EDK II Sep 2 2020 > pstate: 80000005 (Nzcv daif -PAN -UAO BTYPE=--) > pc : mailbox_chan_free+0x2c/0x70 [scmi_module] > lr : idr_for_each+0x6c/0xf8 > Call trace: > mailbox_chan_free+0x2c/0x70 [scmi_module] > idr_for_each+0x6c/0xf8 > scmi_remove+0xa8/0xf0 [scmi_module] > platform_drv_remove+0x34/0x58 > device_release_driver_internal+0x118/0x1f0 > driver_detach+0x58/0xe8 > bus_remove_driver+0x64/0xe0 > driver_unregister+0x38/0x68 > platform_driver_unregister+0x1c/0x28 > scmi_driver_exit+0x38/0x44 [scmi_module] > ---[ end trace 17bde19f50436de9 ]--- > Kernel panic - not syncing: Fatal exception > SMP: stopping secondary CPUs > Kernel Offset: 0x1d0000 from 0xffff800010000000 > PHYS_OFFSET: 0x80000000 > CPU features: 0x0240022,25806004 > Memory Limit: none > ---[ end Kernel panic - not syncing: Fatal exception ]--- Applied to sudeep.holla/linux (for-next/scmi), thanks! [1/1] firmware: arm_scmi: Fix NULL pointer dereference in mailbox_chan_free https://git.kernel.org/sudeep.holla/c/6ed6c55823 -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel