Patch "video: hyperv_fb: Fix a double free in hvfb_probe" has been added to the 5.11-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

    video: hyperv_fb: Fix a double free in hvfb_probe

to the 5.11-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:
     video-hyperv_fb-fix-a-double-free-in-hvfb_probe.patch
and it can be found in the queue-5.11 subdirectory.

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



commit 5be5befb43d9d73072053f94e309ef69bf2c7361
Author: Lv Yunlong <lyl2019@xxxxxxxxxxxxxxxx>
Date:   Wed Mar 24 03:37:24 2021 -0700

    video: hyperv_fb: Fix a double free in hvfb_probe
    
    [ Upstream commit 37df9f3fedb6aeaff5564145e8162aab912c9284 ]
    
    Function hvfb_probe() calls hvfb_getmem(), expecting upon return that
    info->apertures is either NULL or points to memory that should be freed
    by framebuffer_release().  But hvfb_getmem() is freeing the memory and
    leaving the pointer non-NULL, resulting in a double free if an error
    occurs or later if hvfb_remove() is called.
    
    Fix this by removing all kfree(info->apertures) calls in hvfb_getmem().
    This will allow framebuffer_release() to free the memory, which follows
    the pattern of other fbdev drivers.
    
    Fixes: 3a6fb6c4255c ("video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.")
    Signed-off-by: Lv Yunlong <lyl2019@xxxxxxxxxxxxxxxx>
    Reviewed-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210324103724.4189-1-lyl2019@xxxxxxxxxxxxxxxx
    Signed-off-by: Wei Liu <wei.liu@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index c8b0ae676809..4dc9077dd2ac 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -1031,7 +1031,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
 			PCI_DEVICE_ID_HYPERV_VIDEO, NULL);
 		if (!pdev) {
 			pr_err("Unable to find PCI Hyper-V video\n");
-			kfree(info->apertures);
 			return -ENODEV;
 		}
 
@@ -1129,7 +1128,6 @@ getmem_done:
 	} else {
 		pci_dev_put(pdev);
 	}
-	kfree(info->apertures);
 
 	return 0;
 
@@ -1141,7 +1139,6 @@ err2:
 err1:
 	if (!gen2vm)
 		pci_dev_put(pdev);
-	kfree(info->apertures);
 
 	return -ENOMEM;
 }



[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