Patch "Revert "fbdev: Make fb_release() return -ENODEV if fbdev was unregistered"" 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

    Revert "fbdev: Make fb_release() return -ENODEV if fbdev was unregistered"

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:
     revert-fbdev-make-fb_release-return-enodev-if-fbdev-.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 520380c39bd75da5178b67d7e5f8cd682e5a81cb
Author: Javier Martinez Canillas <javierm@xxxxxxxxxx>
Date:   Wed May 4 13:59:17 2022 +0200

    Revert "fbdev: Make fb_release() return -ENODEV if fbdev was unregistered"
    
    [ Upstream commit 135332f34ba2662bc1e32b5c612e06a8cc41a053 ]
    
    This reverts commit aafa025c76dcc7d1a8c8f0bdefcbe4eb480b2f6a. That commit
    attempted to fix a NULL pointer dereference, caused by the struct fb_info
    associated with a framebuffer device to not longer be valid when the file
    descriptor was closed.
    
    The issue was exposed by commit 27599aacbaef ("fbdev: Hot-unplug firmware
    fb devices on forced removal"), which added a new path that goes through
    the struct device removal instead of directly unregistering the fb.
    
    Most fbdev drivers have issues with the fb_info lifetime, because call to
    framebuffer_release() from their driver's .remove callback, rather than
    doing from fbops.fb_destroy callback. This meant that due to this switch,
    the fb_info was now destroyed too early, while references still existed,
    while before it was simply leaked.
    
    The patch we're reverting here reinstated that leak, hence "fixed" the
    regression. But the proper solution is to fix the drivers to not release
    the fb_info too soon.
    
    Suggested-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
    Signed-off-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>
    Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20220504115917.758787-1-javierm@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 8e38a7a5cf2f..0371ad233fdf 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1436,10 +1436,7 @@ fb_release(struct inode *inode, struct file *file)
 __acquires(&info->lock)
 __releases(&info->lock)
 {
-	struct fb_info * const info = file_fb_info(file);
-
-	if (!info)
-		return -ENODEV;
+	struct fb_info * const info = file->private_data;
 
 	lock_fb_info(info);
 	if (info->fbops->fb_release)



[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