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:
committed by
Blagovest Kolenichev
parent
0c8cc33df1
commit
db0a5eca91
@@ -180,6 +180,7 @@ struct data_file *incfs_open_data_file(struct mount_info *mi, struct file *bf)
|
|||||||
out:
|
out:
|
||||||
if (error) {
|
if (error) {
|
||||||
incfs_free_bfc(bfc);
|
incfs_free_bfc(bfc);
|
||||||
|
if (df)
|
||||||
df->df_backing_file_context = NULL;
|
df->df_backing_file_context = NULL;
|
||||||
incfs_free_data_file(df);
|
incfs_free_data_file(df);
|
||||||
return ERR_PTR(error);
|
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);
|
error = mutex_lock_interruptible(&bfc->bc_mutex);
|
||||||
if (!error)
|
if (!error) {
|
||||||
error = incfs_write_hash_block_to_backing_file(
|
error = incfs_write_hash_block_to_backing_file(
|
||||||
bfc, range(data, block->data_len), block->block_index,
|
bfc, range(data, block->data_len), block->block_index,
|
||||||
hash_area_base, df->df_blockmap_off, df->df_size);
|
hash_area_base, df->df_blockmap_off, df->df_size);
|
||||||
mutex_unlock(&bfc->bc_mutex);
|
mutex_unlock(&bfc->bc_mutex);
|
||||||
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1151,6 +1153,9 @@ static int process_file_signature_md(struct incfs_file_signature *sg,
|
|||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
ssize_t read;
|
ssize_t read;
|
||||||
|
|
||||||
|
if (!signature)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
if (!df || !df->df_backing_file_context ||
|
if (!df || !df->df_backing_file_context ||
|
||||||
!df->df_backing_file_context->bc_file) {
|
!df->df_backing_file_context->bc_file) {
|
||||||
error = -ENOENT;
|
error = -ENOENT;
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ static inline struct inode_info *get_incfs_node(struct inode *inode)
|
|||||||
if (!inode)
|
if (!inode)
|
||||||
return NULL;
|
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. */
|
/* This inode doesn't belong to us. */
|
||||||
pr_warn_once("incfs: %s on an alien inode.", __func__);
|
pr_warn_once("incfs: %s on an alien inode.", __func__);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user