Messages in this thread Patch in this message | | | From | Rickard Strandqvist <> | Subject | [PATCH] fs: ntfs: file.c: Fix for possible null pointer dereference | Date | Thu, 22 May 2014 22:45:14 +0200 |
| |
There is otherwise a risk of a possible null pointer dereference.
Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> --- fs/ntfs/file.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index db9bd8a..99394b4 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c @@ -308,10 +308,11 @@ do_non_resident_extend: BUG_ON(!a->non_resident); a->data.non_resident.initialized_size = cpu_to_sle64(new_init_size); done: - flush_dcache_mft_record_page(ctx->ntfs_ino); - mark_mft_record_dirty(ctx->ntfs_ino); - if (ctx) + if (ctx) { + flush_dcache_mft_record_page(ctx->ntfs_ino); + mark_mft_record_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); + } if (m) unmap_mft_record(base_ni); ntfs_debug("Done, initialized_size 0x%llx, i_size 0x%llx.", -- 1.7.10.4
| |