Patch "pinctrl: renesas: checker: Limit cfg reg enum checks to provided IDs" 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

    pinctrl: renesas: checker: Limit cfg reg enum checks to provided IDs

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:
     pinctrl-renesas-checker-limit-cfg-reg-enum-checks-to.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 710363145b6f3ec1e50b2f8f5d724b7d82ef8c74
Author: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
Date:   Mon Jan 22 14:43:38 2024 +0100

    pinctrl: renesas: checker: Limit cfg reg enum checks to provided IDs
    
    [ Upstream commit 3803584a4e9b65bb5b013f862f55c5055aa86c25 ]
    
    If the number of provided enum IDs in a variable width config register
    description does not match the expected number, the checker uses the
    expected number for validating the individual enum IDs.
    
    However, this may cause out-of-bounds accesses on the array holding the
    enum IDs, leading to bogus enum_id conflict warnings.  Worse, if the bug
    is an incorrect bit field description (e.g. accidentally using "12"
    instead of "-12" for a reserved field), thousands of warnings may be
    printed, overflowing the kernel log buffer.
    
    Fix this by limiting the enum ID check to the number of provided enum
    IDs.
    
    Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
    Link: https://lore.kernel.org/r/c7385f44f2faebb8856bcbb4e908d846fc1531fb.1705930809.git.geert+renesas@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pinctrl/renesas/core.c b/drivers/pinctrl/renesas/core.c
index 54f1a7334027a..c390854483680 100644
--- a/drivers/pinctrl/renesas/core.c
+++ b/drivers/pinctrl/renesas/core.c
@@ -868,9 +868,11 @@ static void __init sh_pfc_check_cfg_reg(const char *drvname,
 		sh_pfc_err("reg 0x%x: var_field_width declares %u instead of %u bits\n",
 			   cfg_reg->reg, rw, cfg_reg->reg_width);
 
-	if (n != cfg_reg->nr_enum_ids)
+	if (n != cfg_reg->nr_enum_ids) {
 		sh_pfc_err("reg 0x%x: enum_ids[] has %u instead of %u values\n",
 			   cfg_reg->reg, cfg_reg->nr_enum_ids, n);
+		n = cfg_reg->nr_enum_ids;
+	}
 
 check_enum_ids:
 	sh_pfc_check_reg_enums(drvname, cfg_reg->reg, cfg_reg->enum_ids, n);




[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