]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
fs/ntfs3: Fix error handling in indx_insert_into_root()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 24 Aug 2021 07:51:04 +0000 (10:51 +0300)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Fri, 27 Aug 2021 14:05:14 +0000 (17:05 +0300)
commitb8155e95de38b25a69dfb03e4731fd6c5a28531e
treecfd1fbd953fe01926acc0c44a891ff0094679c08
parent8c83a4851da1c7eda83098ade238665b15774da3
fs/ntfs3: Fix error handling in indx_insert_into_root()

There are three bugs in this code:
1) If indx_get_root() fails, then return -EINVAL instead of success.
2) On the "/* make root external */" -EOPNOTSUPP; error path it should
   free "re" but it has a memory leak.
3) If indx_new() fails then it will lead to an error pointer dereference
   when we call put_indx_node().

I've re-written the error handling to be more clear.

Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/index.c