Freeing bm_data on mount error path is wrong because it could be
allocated on older mount and store valid data.

The object will be freed at ve destruction time.

Signed-off-by: Nikita Yushchenko <nikita.yushche...@virtuozzo.com>
---
 fs/binfmt_misc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 75cc8c279412..8b6665bfe066 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -722,13 +722,12 @@ static int bm_fill_super(struct super_block * sb, void * 
data, int silent)
                rwlock_init(&bm_data->entries_lock);
 
                ve->binfmt_misc = bm_data;
+               /* this will be freed in ve_destroy() */
        }
 
        err = simple_fill_super(sb, BINFMTFS_MAGIC, bm_files);
-       if (err) {
-               kfree(bm_data);
+       if (err)
                return err;
-       }
 
        sb->s_op = &s_ops;
 
-- 
2.30.2

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to