[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1400791514-12014-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
Date: Thu, 22 May 2014 22:45:14 +0200
From: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To: Anton Altaparmakov <anton@...era.com>,
linux-ntfs-dev@...ts.sourceforge.net
Cc: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>,
linux-kernel@...r.kernel.org
Subject: [PATCH] fs: ntfs: file.c: Fix for possible null pointer dereference
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@...ctrumdigital.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists