Skip to content

Commit c94faa7

Browse files
committed
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
2 parents e2683c8 + e252ed8 commit c94faa7

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

fs/coda/cache.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,14 @@ static void coda_flag_children(struct dentry *parent, int flag)
9393
struct dentry *de;
9494

9595
spin_lock(&parent->d_lock);
96+
rcu_read_lock();
9697
hlist_for_each_entry(de, &parent->d_children, d_sib) {
9798
struct inode *inode = d_inode_rcu(de);
9899
/* don't know what to do with negative dentries */
99100
if (inode)
100101
coda_flag_inode(inode, flag);
101102
}
103+
rcu_read_unlock();
102104
spin_unlock(&parent->d_lock);
103105
}
104106

fs/coda/dir.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,6 @@ static int coda_dentry_revalidate(struct inode *dir, const struct qstr *name,
449449
inode = d_inode(de);
450450
if (!inode || is_root_inode(inode))
451451
goto out;
452-
if (is_bad_inode(inode))
453-
goto bad;
454452

455453
cii = ITOC(d_inode(de));
456454
if (!(cii->c_flags & (C_PURGE | C_FLUSH)))
@@ -470,7 +468,6 @@ static int coda_dentry_revalidate(struct inode *dir, const struct qstr *name,
470468
spin_lock(&cii->c_lock);
471469
cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
472470
spin_unlock(&cii->c_lock);
473-
bad:
474471
return 0;
475472
out:
476473
return 1;
@@ -482,18 +479,12 @@ static int coda_dentry_revalidate(struct inode *dir, const struct qstr *name,
482479
*/
483480
static int coda_dentry_delete(const struct dentry * dentry)
484481
{
485-
struct inode *inode;
486-
struct coda_inode_info *cii;
482+
struct inode *inode = d_inode(dentry);
487483

488-
if (d_really_is_negative(dentry))
484+
if (!inode)
489485
return 0;
490486

491-
inode = d_inode(dentry);
492-
if (!inode || is_bad_inode(inode))
493-
return 1;
494-
495-
cii = ITOC(inode);
496-
if (cii->c_flags & C_PURGE)
487+
if (ITOC(inode)->c_flags & C_PURGE)
497488
return 1;
498489

499490
return 0;

0 commit comments

Comments
 (0)