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=-8.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 75AD5C433E2 for ; Wed, 9 Sep 2020 03:49:05 +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 1303320EDD for ; Wed, 9 Sep 2020 03:49:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jx7HWYjD"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="L7Ohssb+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1303320EDD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bBTGDEdQ23GF9MNNRYv+zL84ft4y+bjka+9ExagMbBw=; b=jx7HWYjDUlF1SJAXr8mjyL4KW KgbxfaPaM9fLPuWHC3d73PknnJaNvaOcKFCTh30z/kD9I7zh0P0TCqN4qjcJujvSIxdJV3m4WZ30Y GGeK6edBdcPt6jkKgKLB0dOW43M4cIO7zejnBe3m3RRCQb4oQqdN5qtNI7/VOPY+cwN6orqsRUPja AJ/qAsrwvubxOK1wTEovsMaxen2xw52QVp5keBIVcQWNSisl2txOVvhFipJaxGicgPEkioBT5ixOC IgFwtaTkeAFRpFVxLzHQbmDFWV7BgCOwTVIKonR4A4msZAd6kALTObwpl7V8Z6cwzXjklASb5cUeE U+f67dmFg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFr5G-0004yQ-2M; Wed, 09 Sep 2020 03:47:46 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFr5B-0004xz-Ny for linux-arm-kernel@lists.infradead.org; Wed, 09 Sep 2020 03:47:43 +0000 Received: by mail-pg1-x544.google.com with SMTP id 67so1045877pgd.12 for ; Tue, 08 Sep 2020 20:47:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=OIqlhbt4n2+nNU3PcCBn41KuQ+OVaRbWWAD8tPiJ5vc=; b=L7Ohssb+RqstFw/NXhF3ebb8O+vDLrMCXPRsQe5BOJHuPzNmNRmJYzyJ2T6lUm9RCV b+GlC4UHrMwsa/UtAdat+wPlJZsy+6nM0vYlxEOKlvNwtVFtqQExo67WrkFGevIOg5Vn decsHwN8x3ql29VMSQnrxyw6rsejgYSyab5CL8pX946Qzs7woiGaJWVxk2fB2rGz/ubp 7yheyOg15ruYQB6LT52TcpeG7tLsu51SwxQn6xKIcAAyfvNxHY8EEN6pL6xkupH2zAbH 7X6vugFjxT4iUvszqoomV1ITUTdkm2KJ85hu1E5WOPpSGUvQrQcfXTwsx7kszXJrDzG1 L/PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=OIqlhbt4n2+nNU3PcCBn41KuQ+OVaRbWWAD8tPiJ5vc=; b=THLDuOme4vTe0hn2EZF9XcYP/EtGdoBd2p0H8yZHhsj/zshUZz0UbfjP9CJywDDg+f gjWg/T/HJBi04p75qcvL6abXUP6kNROAmqoecudnM5xETWaaYLNgh7FURL4vGCHhuvdW LlYEvOFmT8+Au1L2filyincqpPsmlZN+lUKkm6A5D6/WXQ0Kc/kNJPy366G/xONoo+0C +b05NiSf4wYjl16anUlR3AOjLD4ydIXS9QffhhlNoFryns0m+Aht5t2U6/ExBecSstPf rmYf/tU8Sru6m++bU6ly/RTvsqx24iV2is18rJKM9Q1a+X1HEa2kht9Hfx5KeMz6bXTw phsQ== X-Gm-Message-State: AOAM532Y+NeVCcU93kdiYySpDigZs/nZ+gafl4iUasL/RHTR6Dz8S4Wv NTuqOVh86wnyTViQdYtlpd0zdw== X-Google-Smtp-Source: ABdhPJxEwg4M86i8OO4yGQMzqMR03i7+YfEUVJaGdbuGCUgDCgPDVrCPVVALr1RlWGkuGXvK4+TCLw== X-Received: by 2002:a17:902:b90b:b029:d0:cbe1:e76f with SMTP id bf11-20020a170902b90bb02900d0cbe1e76fmr2236064plb.22.1599623259161; Tue, 08 Sep 2020 20:47:39 -0700 (PDT) Received: from localhost ([122.181.54.133]) by smtp.gmail.com with ESMTPSA id z1sm222580pfz.70.2020.09.08.20.47.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2020 20:47:38 -0700 (PDT) Date: Wed, 9 Sep 2020 09:17:32 +0530 From: Viresh Kumar To: Sudeep Holla Subject: Re: [PATCH] firmware: arm_scmi: Fix NULL pointer dereference in mailbox_chan_free Message-ID: <20200909034732.wlpc62hwodozwsuf@vireshk-i7> References: <20200908112611.31515-1-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200908112611.31515-1-sudeep.holla@arm.com> User-Agent: NeoMutt/20180716-391-311a52 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200908_234742_087573_F8C86C3E X-CRM114-Status: GOOD ( 17.75 ) 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: Cristian Marussi , linux-arm-kernel@lists.infradead.org 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 08-09-20, 12:26, 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 ]--- > > Cc: Cristian Marussi > Cc: Viresh Kumar > Fixes: 5c8a47a5a91d ("firmware: arm_scmi: Make scmi core independent of the transport type") > Signed-off-by: Sudeep Holla > --- > drivers/firmware/arm_scmi/mailbox.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Viresh Kumar -- viresh _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel