[Devel] [PATCH RHEL9 COMMIT] ve/fs: don't try to sync non-existing bdev

Konstantin Khorenko khorenko at virtuozzo.com
Fri Dec 10 12:26:34 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-4.vz9.10.35
------>
commit 22abcf42eb7d7416c271435626b0635b8522edee
Author: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
Date:   Fri Dec 10 12:26:34 2021 +0300

    ve/fs: don't try to sync non-existing bdev
    
    In the implementation of per-CT sync, in non-toor VE bdev sync was
    moved to sync_fs_one_sb(). But a check for non-NULL sb->s_bdev was
    missed there, causing an attempt to fix bdev even whern there is none,
    and a null pointer dereference.
    
    https://jira.sw.ru/browse/PSBM-136885
    Fixes: adaa7cfac559 ("ve/fs: per-CT sync behavior management")
    Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 fs/sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/sync.c b/fs/sync.c
index ffe244370948..946a121361f6 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -112,7 +112,7 @@ static void sync_fs_one_sb(struct super_block *sb, void *arg)
 			sb->s_op->sync_fs(sb, sarg->wait);
 
 		/* See comment in ksys_sync() bellow */
-		if (sarg->ve) {
+		if (sarg->ve && sb->s_bdev) {
 			fdatawrite_one_bdev(sb->s_bdev, NULL);
 			fdatawait_one_bdev(sb->s_bdev, NULL);
 		}


More information about the Devel mailing list