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:
Linus Torvalds
2026-10-20 15:56:04 -10:00
4 changed files with 13 additions and 3 deletions
+5
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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);