mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user