[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191017103822.8610-1-cgxu519@mykernel.net>
Date: Thu, 17 Oct 2019 18:38:22 +0800
From: Chengguang Xu <cgxu519@...ernel.net>
To: mike.kravetz@...cle.com
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Chengguang Xu <cgxu519@...ernel.net>
Subject: [PATCH] hugetlbfs: fix error handling in init_hugetlbfs_fs()
In order to avoid using incorrect mnt, we should set
mnt to NULL when we get error from mount_one_hugetlbfs().
Signed-off-by: Chengguang Xu <cgxu519@...ernel.net>
---
fs/hugetlbfs/inode.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index a478df035651..427d845e7706 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -1470,9 +1470,12 @@ static int __init init_hugetlbfs_fs(void)
i = 0;
for_each_hstate(h) {
mnt = mount_one_hugetlbfs(h);
- if (IS_ERR(mnt) && i == 0) {
- error = PTR_ERR(mnt);
- goto out;
+ if (IS_ERR(mnt)) {
+ if (i == 0) {
+ error = PTR_ERR(mnt);
+ goto out;
+ }
+ mnt = NULL;
}
hugetlbfs_vfsmount[i] = mnt;
i++;
--
2.20.1
Powered by blists - more mailing lists