fs/ntfs3: handle hdr_first_de() return value
[ Upstream commit af5cab0e5b6f8edb0be51a9f47f3f620e0b4fd70 ]
The hdr_first_de() function returns a pointer to a struct NTFS_DE. This
pointer may be NULL. To handle the NULL error effectively, it is important
to implement an error handler. This will help manage potential errors
consistently.
Additionally, error handling for the return value already exists at other
points where this function is called.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 82cae269cf
("fs/ntfs3: Add initialization of super block")
Signed-off-by: Andrey Vatoropin <a.vatoropin@crpt.ru>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 701340a25b1ad210e6b8192195be21fd3fcc22c7)
This commit is contained in:
parent
2eb7bac720
commit
e391d3aa23
|
@ -2184,6 +2184,10 @@ static int indx_get_entry_to_replace(struct ntfs_index *indx,
|
|||
|
||||
e = hdr_first_de(&n->index->ihdr);
|
||||
fnd_push(fnd, n, e);
|
||||
if (!e) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!de_is_last(e)) {
|
||||
/*
|
||||
|
@ -2205,6 +2209,10 @@ static int indx_get_entry_to_replace(struct ntfs_index *indx,
|
|||
|
||||
n = fnd->nodes[level];
|
||||
te = hdr_first_de(&n->index->ihdr);
|
||||
if (!te) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
/* Copy the candidate entry into the replacement entry buffer. */
|
||||
re = kmalloc(le16_to_cpu(te->size) + sizeof(u64), GFP_NOFS);
|
||||
if (!re) {
|
||||
|
|
Loading…
Reference in New Issue