mirror of
https://gitee.com/bianbu-linux/linux-6.6-fh
synced 2025-04-25 12:17:08 -04:00
ntfs: do not dereference a null ctx on error
In ntfs_mft_data_extend_allocation_nolock(), if an error condition occurs prior to 'ctx' being set to a non-NULL value, avoid dereferencing the NULL 'ctx' pointer in error handling. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Danila Chernetsov <listdansp@mail.ru> Reviewed-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
6405fee9b0
commit
aa4b92c523
1 changed files with 19 additions and 17 deletions
|
@ -1955,12 +1955,14 @@ undo_alloc:
|
||||||
"attribute.%s", es);
|
"attribute.%s", es);
|
||||||
NVolSetErrors(vol);
|
NVolSetErrors(vol);
|
||||||
}
|
}
|
||||||
a = ctx->attr;
|
|
||||||
if (ntfs_rl_truncate_nolock(vol, &mft_ni->runlist, old_last_vcn)) {
|
if (ntfs_rl_truncate_nolock(vol, &mft_ni->runlist, old_last_vcn)) {
|
||||||
ntfs_error(vol->sb, "Failed to truncate mft data attribute "
|
ntfs_error(vol->sb, "Failed to truncate mft data attribute "
|
||||||
"runlist.%s", es);
|
"runlist.%s", es);
|
||||||
NVolSetErrors(vol);
|
NVolSetErrors(vol);
|
||||||
}
|
}
|
||||||
|
if (ctx) {
|
||||||
|
a = ctx->attr;
|
||||||
if (mp_rebuilt && !IS_ERR(ctx->mrec)) {
|
if (mp_rebuilt && !IS_ERR(ctx->mrec)) {
|
||||||
if (ntfs_mapping_pairs_build(vol, (u8 *)a + le16_to_cpu(
|
if (ntfs_mapping_pairs_build(vol, (u8 *)a + le16_to_cpu(
|
||||||
a->data.non_resident.mapping_pairs_offset),
|
a->data.non_resident.mapping_pairs_offset),
|
||||||
|
@ -1983,8 +1985,8 @@ undo_alloc:
|
||||||
"context.%s", es);
|
"context.%s", es);
|
||||||
NVolSetErrors(vol);
|
NVolSetErrors(vol);
|
||||||
}
|
}
|
||||||
if (ctx)
|
|
||||||
ntfs_attr_put_search_ctx(ctx);
|
ntfs_attr_put_search_ctx(ctx);
|
||||||
|
}
|
||||||
if (!IS_ERR(mrec))
|
if (!IS_ERR(mrec))
|
||||||
unmap_mft_record(mft_ni);
|
unmap_mft_record(mft_ni);
|
||||||
up_write(&mft_ni->runlist.lock);
|
up_write(&mft_ni->runlist.lock);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue