Blame SOURCES/0074-fs-ntfs3-Fix-a-memory-leak-on-object-opts.patch

Kmods SIG 8b815c
From 880301bb313295a65523e79bc5666f5cf49eb3ed Mon Sep 17 00:00:00 2001
Kmods SIG 8b815c
From: Colin Ian King <colin.king@canonical.com>
Kmods SIG 8b815c
Date: Fri, 10 Sep 2021 11:02:02 +0100
Kmods SIG 8b815c
Subject: [Backport 880301bb3132] src: Fix a memory leak on object opts
Kmods SIG 8b815c
Kmods SIG 8b815c
Currently a failed allocation on sbi->upcase will cause an exit via
Kmods SIG 8b815c
the label free_sbi causing a memory leak on object opts. Fix this by
Kmods SIG 8b815c
re-ordering the exit paths free_opts and free_sbi so that kfree's occur
Kmods SIG 8b815c
in the reverse allocation order.
Kmods SIG 8b815c
Kmods SIG 8b815c
Addresses-Coverity: ("Resource leak")
Kmods SIG 8b815c
Fixes: 27fac77707a1 ("src: Init spi more in init_fs_context than fill_super")
Kmods SIG 8b815c
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Kmods SIG 8b815c
Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
Kmods SIG 8b815c
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Kmods SIG 8b815c
---
Kmods SIG 8b815c
 src/super.c | 4 ++--
Kmods SIG 8b815c
 1 file changed, 2 insertions(+), 2 deletions(-)
Kmods SIG 8b815c
Kmods SIG 8b815c
diff --git a/src/super.c b/src/super.c
Kmods SIG 8b815c
index cefb9ddaf4db78890e9dc389416f47323bf33bcd..6a535b144ff961036704ba5a5ac5b1cab7ae9fb4 100644
Kmods SIG 8b815c
--- a/src/super.c
Kmods SIG 8b815c
+++ b/src/super.c
Kmods SIG 8b815c
@@ -1393,10 +1393,10 @@ static int ntfs_init_fs_context(struct fs_context *fc)
Kmods SIG 8b815c
 	fc->ops = &ntfs_context_ops;
Kmods SIG 8b815c
 
Kmods SIG 8b815c
 	return 0;
Kmods SIG 8b815c
-free_opts:
Kmods SIG 8b815c
-	kfree(opts);
Kmods SIG 8b815c
 free_sbi:
Kmods SIG 8b815c
 	kfree(sbi);
Kmods SIG 8b815c
+free_opts:
Kmods SIG 8b815c
+	kfree(opts);
Kmods SIG 8b815c
 	return -ENOMEM;
Kmods SIG 8b815c
 }
Kmods SIG 8b815c
 
Kmods SIG 8b815c
-- 
Kmods SIG 8b815c
2.31.1
Kmods SIG 8b815c