Patch "virtio-gpu: fix a missing check to avoid NULL dereference" 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

    virtio-gpu: fix a missing check to avoid NULL dereference

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:
     virtio-gpu-fix-a-missing-check-to-avoid-null-derefer.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 882fa0312ae6b1e6f964480032203b6758688fcd
Author: Xiaomeng Tong <xiam0nd.tong@xxxxxxxxx>
Date:   Sun Mar 27 13:09:45 2022 +0800

    virtio-gpu: fix a missing check to avoid NULL dereference
    
    [ Upstream commit bd63f11f4c3c46afec07d821f74736161ff6e526 ]
    
    'cache_ent' could be set NULL inside virtio_gpu_cmd_get_capset()
    and it will lead to a NULL dereference by a lately use of it
    (i.e., ptr = cache_ent->caps_cache). Fix it with a NULL check.
    
    Fixes: 62fb7a5e10962 ("virtio-gpu: add 3d/virgl support")
    Signed-off-by: Xiaomeng Tong <xiam0nd.tong@xxxxxxxxx>
    Reviewed-by: Chia-I Wu <olvaffe@xxxxxxxxx>
    Link: http://patchwork.freedesktop.org/patch/msgid/20220327050945.1614-1-xiam0nd.tong@xxxxxxxxx
    
    [ kraxel: minor codestyle fixup ]
    
    Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index c8da7adc6b30..33b8ebab178a 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -470,8 +470,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
 	spin_unlock(&vgdev->display_info_lock);
 
 	/* not in cache - need to talk to hw */
-	virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver,
-				  &cache_ent);
+	ret = virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver,
+					&cache_ent);
+	if (ret)
+		return ret;
 	virtio_gpu_notify(vgdev);
 
 copy_exit:



[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