Patch "media: atomisp: gmin_platform: fix out_len in gmin_get_config_dsm_var()" has been added to the 5.10-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

    media: atomisp: gmin_platform: fix out_len in gmin_get_config_dsm_var()

to the 5.10-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:
     media-atomisp-gmin_platform-fix-out_len-in-gmin_get_.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 24f37a094cda6fdd619038c997a39f2bd01ef57b
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Fri May 26 12:53:23 2023 +0100

    media: atomisp: gmin_platform: fix out_len in gmin_get_config_dsm_var()
    
    [ Upstream commit 1657f2934daf89e8d9fa4b2697008909eb22c73e ]
    
    Ideally, strlen(cur->string.pointer) and strlen(out) would be the same.
    But this code is using strscpy() to avoid a potential buffer overflow.
    So in the same way we should take the strlen() of the smaller string to
    avoid a buffer overflow in the caller, gmin_get_var_int().
    
    Link: https://lore.kernel.org/r/26124bcd-8132-4483-9d67-225c87d424e8@kili.mountain
    
    Fixes: 387041cda44e ("media: atomisp: improve sensor detection code to use _DSM table")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index c9ee85037644f..f0387486eb174 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -1198,7 +1198,7 @@ static int gmin_get_config_dsm_var(struct device *dev,
 	dev_info(dev, "found _DSM entry for '%s': %s\n", var,
 		 cur->string.pointer);
 	strscpy(out, cur->string.pointer, *out_len);
-	*out_len = strlen(cur->string.pointer);
+	*out_len = strlen(out);
 
 	ACPI_FREE(obj);
 	return 0;



[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