Patch "auxdisplay: charlcd: checking for pointer reference before dereferencing" has been added to the 5.15-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

    auxdisplay: charlcd: checking for pointer reference before dereferencing

to the 5.15-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:
     auxdisplay-charlcd-checking-for-pointer-reference-be.patch
and it can be found in the queue-5.15 subdirectory.

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



commit b637f956500cf4fce047ab5fe998fe4c6d84c2be
Author: Luiz Sampaio <sampaio.ime@xxxxxxxxx>
Date:   Tue Nov 9 19:07:32 2021 -0300

    auxdisplay: charlcd: checking for pointer reference before dereferencing
    
    [ Upstream commit 4daa9ff89ef27be43c15995412d6aee393a78200 ]
    
    Check if the pointer lcd->ops->init_display exists before dereferencing it.
    If a driver called charlcd_init() without defining the ops, this would
    return segmentation fault, as happened to me when implementing a charlcd
    driver.  Checking the pointer before dereferencing protects from
    segmentation fault.
    
    Signed-off-by: Luiz Sampaio <sampaio.ime@xxxxxxxxx>
    Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
index 304accde365c8..6c010d4efa4ae 100644
--- a/drivers/auxdisplay/charlcd.c
+++ b/drivers/auxdisplay/charlcd.c
@@ -578,6 +578,9 @@ static int charlcd_init(struct charlcd *lcd)
 	 * Since charlcd_init_display() needs to write data, we have to
 	 * enable mark the LCD initialized just before.
 	 */
+	if (WARN_ON(!lcd->ops->init_display))
+		return -EINVAL;
+
 	ret = lcd->ops->init_display(lcd);
 	if (ret)
 		return ret;



[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