coda cleanups and fixes

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQqUNBr3gm4hGXdBJlZ7Krx/gZQ6wUCaefXWAAKCRBZ7Krx/gZQ
 6xunAP4oQllf7EXF3pGmLcVSqG8O08FXvvgaTrIG5s89cpXL5QEAz8//D6i7lsj9
 MyfQ6RiL4v2AOQm90SxCtJPHZ1LJYAM=
 =ZVnL
 -----END PGP SIGNATURE-----

Merge tag 'pull-coda' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull coda dcache updates from Al Viro:
 "Coda dcache-related cleanups and fixes"

* tag 'pull-coda' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  coda_flag_children(): fix a UAF
  sanitize coda_dentry_delete()
  coda: is_bad_inode() is always false there
This commit is contained in:
Linus Torvalds 2026-04-21 14:03:10 -07:00
commit c94faa7cc4
2 changed files with 5 additions and 12 deletions

View File

@ -93,12 +93,14 @@ static void coda_flag_children(struct dentry *parent, int flag)
struct dentry *de;
spin_lock(&parent->d_lock);
rcu_read_lock();
hlist_for_each_entry(de, &parent->d_children, d_sib) {
struct inode *inode = d_inode_rcu(de);
/* don't know what to do with negative dentries */
if (inode)
coda_flag_inode(inode, flag);
}
rcu_read_unlock();
spin_unlock(&parent->d_lock);
}

View File

@ -449,8 +449,6 @@ static int coda_dentry_revalidate(struct inode *dir, const struct qstr *name,
inode = d_inode(de);
if (!inode || is_root_inode(inode))
goto out;
if (is_bad_inode(inode))
goto bad;
cii = ITOC(d_inode(de));
if (!(cii->c_flags & (C_PURGE | C_FLUSH)))
@ -470,7 +468,6 @@ static int coda_dentry_revalidate(struct inode *dir, const struct qstr *name,
spin_lock(&cii->c_lock);
cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
spin_unlock(&cii->c_lock);
bad:
return 0;
out:
return 1;
@ -482,18 +479,12 @@ static int coda_dentry_revalidate(struct inode *dir, const struct qstr *name,
*/
static int coda_dentry_delete(const struct dentry * dentry)
{
struct inode *inode;
struct coda_inode_info *cii;
struct inode *inode = d_inode(dentry);
if (d_really_is_negative(dentry))
if (!inode)
return 0;
inode = d_inode(dentry);
if (!inode || is_bad_inode(inode))
return 1;
cii = ITOC(inode);
if (cii->c_flags & C_PURGE)
if (ITOC(inode)->c_flags & C_PURGE)
return 1;
return 0;