[Devel] [PATCH RHEL9 COMMIT] ms/devtmpfs: fix the dangling pointer of global devtmpfsd thread

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 29 20:40:00 MSK 2022


The commit is pushed to "branch-rh9-5.14.0-70.22.1.vz9.17.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-70.22.1.vz9.17.11
------>
commit 57bfe1f9bb14ba6d9b86e01fe1d973b9eed1ff5d
Author: Yangxi Xiang <xyangxi5 at gmail.com>
Date:   Mon Jun 27 20:04:09 2022 +0800

    ms/devtmpfs: fix the dangling pointer of global devtmpfsd thread
    
    When the devtmpfs fails to mount, a dangling pointer still remains in
    global. Specifically, the err variable is passed by a pointer to the
    devtmpfsd. When the devtmpfsd exits, it sets the error and completes the
    setup_done. In this situation, the thread pointer is not set to null.
    After the devtmpfsd exited, the devtmpfs can wakes up the destroyed
    devtmpfsd thread by wake_up_process if a device change event comes.
    
    Signed-off-by: Yangxi Xiang <xyangxi5 at gmail.com>
    Link: https://lore.kernel.org/r/20220627120409.11174-1-xyangxi5@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
    
    (cherry picked from commit 31c779f293b343577690c01369a5019ca6ec5de9)
    https://jira.sw.ru/browse/PSBM-142996
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    
    Feature: fix ms/devtmpfs
---
 drivers/base/devtmpfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 6d6236318d83..5f6e2da2e162 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -495,6 +495,7 @@ int __init devtmpfs_init(void)
 	if (err) {
 		printk(KERN_ERR "devtmpfs: unable to create devtmpfs %i\n", err);
 		unregister_filesystem(&dev_fs_type);
+		thread = NULL;
 		return err;
 	}
 


More information about the Devel mailing list