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