Patch "platform/olpc: Fix uninitialized data in debugfs write" has been added to the 4.19-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

    platform/olpc: Fix uninitialized data in debugfs write

to the 4.19-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:
     platform-olpc-fix-uninitialized-data-in-debugfs-writ.patch
and it can be found in the queue-4.19 subdirectory.

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



commit 722e7ac8a81085b8952a01927aad1383bc656450
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Wed Jul 20 21:23:38 2022 +0300

    platform/olpc: Fix uninitialized data in debugfs write
    
    [ Upstream commit 40ec787e1adf302c11668d4cc69838f4d584187d ]
    
    The call to:
    
            size = simple_write_to_buffer(cmdbuf, sizeof(cmdbuf), ppos, buf, size);
    
    will succeed if at least one byte is written to the "cmdbuf" buffer.
    The "*ppos" value controls which byte is written.  Another problem is
    that this code does not check for errors so it's possible for the entire
    buffer to be uninitialized.
    
    Inintialize the struct to zero to prevent reading uninitialized stack
    data.
    
    Debugfs is normally only writable by root so the impact of this bug is
    very minimal.
    
    Fixes: 6cca83d498bd ("Platform: OLPC: move debugfs support from x86 EC driver")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/YthIKn+TfZSZMEcM@kili
    Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c
index 374a8028fec7..b36a000ed969 100644
--- a/drivers/platform/olpc/olpc-ec.c
+++ b/drivers/platform/olpc/olpc-ec.c
@@ -170,7 +170,7 @@ static ssize_t ec_dbgfs_cmd_write(struct file *file, const char __user *buf,
 	int i, m;
 	unsigned char ec_cmd[EC_MAX_CMD_ARGS];
 	unsigned int ec_cmd_int[EC_MAX_CMD_ARGS];
-	char cmdbuf[64];
+	char cmdbuf[64] = "";
 	int ec_cmd_bytes;
 
 	mutex_lock(&ec_dbgfs_lock);



[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