Patch "drm/rockchip: vop: fix possible null-ptr-deref in vop_bind()" 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

    drm/rockchip: vop: fix possible null-ptr-deref in vop_bind()

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:
     drm-rockchip-vop-fix-possible-null-ptr-deref-in-vop_.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 dbda9a5b588efb6e7b8f033cd068ea04d71f93dc
Author: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Date:   Fri Apr 22 11:28:54 2022 +0800

    drm/rockchip: vop: fix possible null-ptr-deref in vop_bind()
    
    [ Upstream commit f8c242908ad15bbd604d3bcb54961b7d454c43f8 ]
    
    It will cause null-ptr-deref in resource_size(), if platform_get_resource()
    returns NULL, move calling resource_size() after devm_ioremap_resource() that
    will check 'res' to avoid null-ptr-deref.
    
    Fixes: 2048e3286f34 ("drm: rockchip: Add basic drm driver")
    Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
    Signed-off-by: Heiko Stuebner <heiko@xxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20220422032854.2995175-1-yangyingliang@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index a25b98b7f5bd..8b4287d40379 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -2116,10 +2116,10 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
 	vop_win_init(vop);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	vop->len = resource_size(res);
 	vop->regs = devm_ioremap_resource(dev, res);
 	if (IS_ERR(vop->regs))
 		return PTR_ERR(vop->regs);
+	vop->len = resource_size(res);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 	if (res) {



[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