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:
commit
c94faa7cc4
2 changed files with 5 additions and 12 deletions
|
|
@ -93,12 +93,14 @@ static void coda_flag_children(struct dentry *parent, int flag)
|
||||||
struct dentry *de;
|
struct dentry *de;
|
||||||
|
|
||||||
spin_lock(&parent->d_lock);
|
spin_lock(&parent->d_lock);
|
||||||
|
rcu_read_lock();
|
||||||
hlist_for_each_entry(de, &parent->d_children, d_sib) {
|
hlist_for_each_entry(de, &parent->d_children, d_sib) {
|
||||||
struct inode *inode = d_inode_rcu(de);
|
struct inode *inode = d_inode_rcu(de);
|
||||||
/* don't know what to do with negative dentries */
|
/* don't know what to do with negative dentries */
|
||||||
if (inode)
|
if (inode)
|
||||||
coda_flag_inode(inode, flag);
|
coda_flag_inode(inode, flag);
|
||||||
}
|
}
|
||||||
|
rcu_read_unlock();
|
||||||
spin_unlock(&parent->d_lock);
|
spin_unlock(&parent->d_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -449,8 +449,6 @@ static int coda_dentry_revalidate(struct inode *dir, const struct qstr *name,
|
||||||
inode = d_inode(de);
|
inode = d_inode(de);
|
||||||
if (!inode || is_root_inode(inode))
|
if (!inode || is_root_inode(inode))
|
||||||
goto out;
|
goto out;
|
||||||
if (is_bad_inode(inode))
|
|
||||||
goto bad;
|
|
||||||
|
|
||||||
cii = ITOC(d_inode(de));
|
cii = ITOC(d_inode(de));
|
||||||
if (!(cii->c_flags & (C_PURGE | C_FLUSH)))
|
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);
|
spin_lock(&cii->c_lock);
|
||||||
cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
|
cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
|
||||||
spin_unlock(&cii->c_lock);
|
spin_unlock(&cii->c_lock);
|
||||||
bad:
|
|
||||||
return 0;
|
return 0;
|
||||||
out:
|
out:
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -482,18 +479,12 @@ out:
|
||||||
*/
|
*/
|
||||||
static int coda_dentry_delete(const struct dentry * dentry)
|
static int coda_dentry_delete(const struct dentry * dentry)
|
||||||
{
|
{
|
||||||
struct inode *inode;
|
struct inode *inode = d_inode(dentry);
|
||||||
struct coda_inode_info *cii;
|
|
||||||
|
|
||||||
if (d_really_is_negative(dentry))
|
if (!inode)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
inode = d_inode(dentry);
|
if (ITOC(inode)->c_flags & C_PURGE)
|
||||||
if (!inode || is_bad_inode(inode))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
cii = ITOC(inode);
|
|
||||||
if (cii->c_flags & C_PURGE)
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue