mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
fs/ntfs3: Add NULL ptr dereference checking at the end of attr_allocate_frame()
[ Upstream commit aaab47f204aaf47838241d57bf8662c8840de60a ] It is preferable to exit through the out: label because internal debugging functions are located there. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
95bad562e5
commit
50545eb6cd
@@ -1658,8 +1658,10 @@ repack:
|
|||||||
le_b = NULL;
|
le_b = NULL;
|
||||||
attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL,
|
attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL,
|
||||||
0, NULL, &mi_b);
|
0, NULL, &mi_b);
|
||||||
if (!attr_b)
|
if (!attr_b) {
|
||||||
return -ENOENT;
|
err = -ENOENT;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
attr = attr_b;
|
attr = attr_b;
|
||||||
le = le_b;
|
le = le_b;
|
||||||
@@ -1740,13 +1742,15 @@ ins_ext:
|
|||||||
ok:
|
ok:
|
||||||
run_truncate_around(run, vcn);
|
run_truncate_around(run, vcn);
|
||||||
out:
|
out:
|
||||||
if (new_valid > data_size)
|
if (attr_b) {
|
||||||
new_valid = data_size;
|
if (new_valid > data_size)
|
||||||
|
new_valid = data_size;
|
||||||
|
|
||||||
valid_size = le64_to_cpu(attr_b->nres.valid_size);
|
valid_size = le64_to_cpu(attr_b->nres.valid_size);
|
||||||
if (new_valid != valid_size) {
|
if (new_valid != valid_size) {
|
||||||
attr_b->nres.valid_size = cpu_to_le64(valid_size);
|
attr_b->nres.valid_size = cpu_to_le64(valid_size);
|
||||||
mi_b->dirty = true;
|
mi_b->dirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
Reference in New Issue
Block a user