Patch "firmware: arm_scmi: Fix NULL pointer dereference in mailbox_chan_free" has been added to the 5.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    firmware: arm_scmi: Fix NULL pointer dereference in mailbox_chan_free

to the 5.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     firmware-arm_scmi-fix-null-pointer-dereference-in-ma.patch
and it can be found in the queue-5.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 735d9dc71927cf15b81a28b531802959b12b9f5d
Author: Sudeep Holla <sudeep.holla@xxxxxxx>
Date:   Tue Sep 8 12:26:11 2020 +0100

    firmware: arm_scmi: Fix NULL pointer dereference in mailbox_chan_free
    
    [ Upstream commit 6ed6c558234f0b6c22e47a3c2feddce3d02324dd ]
    
    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 ]---
    
    Link: https://lore.kernel.org/r/20200908112611.31515-1-sudeep.holla@xxxxxxx
    Fixes: 5c8a47a5a91d ("firmware: arm_scmi: Make scmi core independent of the transport type")
    Cc: Cristian Marussi <cristian.marussi@xxxxxxx>
    Cc: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
    Tested-by: Cristian Marussi <cristian.marussi@xxxxxxx>
    Reviewed-by: Cristian Marussi <cristian.marussi@xxxxxxx>
    Reviewed-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
    Signed-off-by: Sudeep Holla <sudeep.holla@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c
index 6998dc86b5ce8..b797a713c3313 100644
--- a/drivers/firmware/arm_scmi/mailbox.c
+++ b/drivers/firmware/arm_scmi/mailbox.c
@@ -110,7 +110,7 @@ static int mailbox_chan_free(int id, void *p, void *data)
 	struct scmi_chan_info *cinfo = p;
 	struct scmi_mailbox *smbox = cinfo->transport_info;
 
-	if (!IS_ERR(smbox->chan)) {
+	if (smbox && !IS_ERR(smbox->chan)) {
 		mbox_free_channel(smbox->chan);
 		cinfo->transport_info = NULL;
 		smbox->chan = NULL;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux