ANDROID: Incremental fs: Fix four error-path bugs

Test: incfs_test passes
Bug: 158242405
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ib53e867fb2681489f720f6255354c1bce1d33997
(cherry picked from commit 60bc6eaf985358638af7f0602a7aece907ae8207)
Git-commit: 484c5f495628bd4e22a2c7dd08d2cb43d70606c3
Git-repo: https://android.googlesource.com/kernel/common/
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
This commit is contained in:
Paul Lawrence
2020-06-04 15:35:02 -07:00
committed by Blagovest Kolenichev
parent 0c8cc33df1
commit db0a5eca91
2 changed files with 9 additions and 4 deletions

View File

@@ -180,7 +180,8 @@ struct data_file *incfs_open_data_file(struct mount_info *mi, struct file *bf)
out:
if (error) {
incfs_free_bfc(bfc);
df->df_backing_file_context = NULL;
if (df)
df->df_backing_file_context = NULL;
incfs_free_data_file(df);
return ERR_PTR(error);
}
@@ -1094,11 +1095,12 @@ int incfs_process_new_hash_block(struct data_file *df,
}
error = mutex_lock_interruptible(&bfc->bc_mutex);
if (!error)
if (!error) {
error = incfs_write_hash_block_to_backing_file(
bfc, range(data, block->data_len), block->block_index,
hash_area_base, df->df_blockmap_off, df->df_size);
mutex_unlock(&bfc->bc_mutex);
mutex_unlock(&bfc->bc_mutex);
}
return error;
}
@@ -1151,6 +1153,9 @@ static int process_file_signature_md(struct incfs_file_signature *sg,
void *buf = NULL;
ssize_t read;
if (!signature)
return -ENOMEM;
if (!df || !df->df_backing_file_context ||
!df->df_backing_file_context->bc_file) {
error = -ENOENT;

View File

@@ -315,7 +315,7 @@ static inline struct inode_info *get_incfs_node(struct inode *inode)
if (!inode)
return NULL;
if (inode->i_sb->s_magic != INCFS_MAGIC_NUMBER) {
if (inode->i_sb->s_magic != (long) INCFS_MAGIC_NUMBER) {
/* This inode doesn't belong to us. */
pr_warn_once("incfs: %s on an alien inode.", __func__);
return NULL;