[Devel] [PATCH RHEL7 COMMIT] sync: sync_collect_filesystems: fix possible infinite loop

Vasily Averin vvs at virtuozzo.com
Tue Mar 30 10:28:19 MSK 2021


The commit is pushed to "branch-rh7-3.10.0-1160.21.1.vz7.174.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.21.1.vz7.174.3
------>
commit 9f4f95d6878e315b30c41e69b9c9d5e6cd628192
Author: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
Date:   Tue Mar 30 10:28:19 2021 +0300

    sync: sync_collect_filesystems: fix possible infinite loop
    
    https://jira.sw.ru/browse/PSBM-127599
    Fixes baf4647b669 "proc/mounts: add cursor"
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
---
 fs/sync.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/sync.c b/fs/sync.c
index d994e5b..6d8f5b0 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -145,7 +145,7 @@ static int sync_collect_filesystems(struct ve_struct *ve, struct list_head *sync
 	mnt = mnt_list_next(mnt_ns, &mnt_ns->list);
 	while (mnt) {
 		if (sync_filesystem_collected(sync_list, mnt->mnt.mnt_sb))
-			continue;
+			goto next;
 
 		ss = kmalloc(sizeof(*ss), GFP_KERNEL);
 		if (ss == NULL) {
@@ -163,6 +163,7 @@ static int sync_collect_filesystems(struct ve_struct *ve, struct list_head *sync
 		spin_unlock(&sb_lock);
 		list_add_tail(&ss->list, sync_list);
 
+next:
 		mnt = mnt_list_next(mnt_ns, &mnt->mnt_list);
 	}
 	up_read(&namespace_sem);


More information about the Devel mailing list