mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
Merge tag 'affs-for-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull affs updates from David Sterba: "AFFS has attracted the AI security scanners but there's probably little real impact. A few fixes, more will come in the future, but it's low priority" * tag 'affs-for-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: affs: validate blocks before freeing them affs: split hash-lock subclass and reject self-referencing dir entry affs: don't instantiate dentry if affs_insert_hash failed
This commit is contained in:
@@ -306,6 +306,11 @@ affs_lock_dir(struct inode *inode)
|
||||
mutex_lock_nested(&AFFS_I(inode)->i_hash_lock, SINGLE_DEPTH_NESTING);
|
||||
}
|
||||
static inline void
|
||||
affs_lock_subdir(struct inode *inode)
|
||||
{
|
||||
mutex_lock_nested(&AFFS_I(inode)->i_hash_lock, SINGLE_DEPTH_NESTING + 1);
|
||||
}
|
||||
static inline void
|
||||
affs_unlock_dir(struct inode *inode)
|
||||
{
|
||||
mutex_unlock(&AFFS_I(inode)->i_hash_lock);
|
||||
|
||||
+5
-1
@@ -293,7 +293,11 @@ affs_remove_header(struct dentry *dentry)
|
||||
* i_hash_lock of the inode must only be
|
||||
* taken after some checks
|
||||
*/
|
||||
affs_lock_dir(inode);
|
||||
if (inode == dir) {
|
||||
retval = -EIO;
|
||||
goto done_unlock;
|
||||
}
|
||||
affs_lock_subdir(inode);
|
||||
retval = affs_empty_dir(inode);
|
||||
affs_unlock_dir(inode);
|
||||
if (retval)
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ affs_free_block(struct super_block *sb, u32 block)
|
||||
|
||||
pr_debug("%s(%u)\n", __func__, block);
|
||||
|
||||
if (block > sbi->s_partition_size)
|
||||
if (!affs_validblock(sb, block))
|
||||
goto err_range;
|
||||
|
||||
blk = block - sbi->s_reserved;
|
||||
|
||||
+2
-1
@@ -404,7 +404,8 @@ affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s3
|
||||
affs_unlock_dir(dir);
|
||||
affs_unlock_link(inode);
|
||||
|
||||
d_instantiate(dentry, inode);
|
||||
if (!retval)
|
||||
d_instantiate(dentry, inode);
|
||||
done:
|
||||
affs_brelse(inode_bh);
|
||||
affs_brelse(bh);
|
||||
|
||||
Reference in New Issue
Block a user