Patch "auxdisplay: hd44780: Fix potential memory leak in hd44780_remove()" has been added to the 6.1-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: hd44780: Fix potential memory leak in hd44780_remove()

to the 6.1-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-hd44780-fix-potential-memory-leak-in-hd44.patch
and it can be found in the queue-6.1 subdirectory.

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



commit df20efdb96f451d7f1d8e6680f9eb8c9addc2767
Author: Jianglei Nie <niejianglei2021@xxxxxxx>
Date:   Tue Nov 29 16:15:42 2022 +0800

    auxdisplay: hd44780: Fix potential memory leak in hd44780_remove()
    
    [ Upstream commit ddf75a86aba2cfb7ec4497e8692b60c8c8fe0ee7 ]
    
    hd44780_probe() allocates a memory chunk for hd with kzalloc() and
    makes "lcd->drvdata->hd44780" point to it. When we call hd44780_remove(),
    we should release all relevant memory and resource. But "lcd->drvdata
    ->hd44780" is not released, which will lead to a memory leak.
    
    We should release the "lcd->drvdata->hd44780" in hd44780_remove() to fix
    the memory leak bug.
    
    Fixes: 718e05ed92ec ("auxdisplay: Introduce hd44780_common.[ch]")
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
    Reported-by: kernel test robot <lkp@xxxxxxxxx>
    Signed-off-by: Jianglei Nie <niejianglei2021@xxxxxxx>
    Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/auxdisplay/hd44780.c b/drivers/auxdisplay/hd44780.c
index 8b2a0eb3f32a4..d56a5d508ccd7 100644
--- a/drivers/auxdisplay/hd44780.c
+++ b/drivers/auxdisplay/hd44780.c
@@ -322,8 +322,10 @@ static int hd44780_probe(struct platform_device *pdev)
 static int hd44780_remove(struct platform_device *pdev)
 {
 	struct charlcd *lcd = platform_get_drvdata(pdev);
+	struct hd44780_common *hdc = lcd->drvdata;
 
 	charlcd_unregister(lcd);
+	kfree(hdc->hd44780);
 	kfree(lcd->drvdata);
 
 	kfree(lcd);



[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