Patch "drm/crc-debugfs: Fix memleak in crc_control_write" has been added to the 5.9-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

    drm/crc-debugfs: Fix memleak in crc_control_write

to the 5.9-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:
     drm-crc-debugfs-fix-memleak-in-crc_control_write.patch
and it can be found in the queue-5.9 subdirectory.

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



commit 9f0e489c2b16648542cc30f79b9365746ea70ea0
Author: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
Date:   Wed Aug 19 16:22:28 2020 +0800

    drm/crc-debugfs: Fix memleak in crc_control_write
    
    [ Upstream commit f7ec68b341dbd5da13d4c65ce444dcd605f1c42e ]
    
    When verify_crc_source() fails, source needs to be freed.
    However, current code is returning directly and ends up
    leaking memory.
    
    Fixes: d5cc15a0c66e ("drm: crc: Introduce verify_crc_source callback")
    Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
    [danvet: change Fixes: tag per Laurent's review]
    Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200819082228.26847-1-dinghao.liu@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
index 5d67a41f7c3a8..3dd70d813f694 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -144,8 +144,10 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf,
 		source[len - 1] = '\0';
 
 	ret = crtc->funcs->verify_crc_source(crtc, source, &values_cnt);
-	if (ret)
+	if (ret) {
+		kfree(source);
 		return ret;
+	}
 
 	spin_lock_irq(&crc->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