+10
-2
fs/ecryptfs/inode.c
+10
-2
fs/ecryptfs/inode.c
···
319
319
static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry,
320
320
struct dentry *lower_dentry)
321
321
{
322
-
struct inode *inode, *lower_inode = d_inode(lower_dentry);
322
+
struct inode *inode, *lower_inode;
323
323
struct ecryptfs_dentry_info *dentry_info;
324
324
struct vfsmount *lower_mnt;
325
325
int rc = 0;
···
339
339
dentry_info->lower_path.mnt = lower_mnt;
340
340
dentry_info->lower_path.dentry = lower_dentry;
341
341
342
-
if (d_really_is_negative(lower_dentry)) {
342
+
/*
343
+
* negative dentry can go positive under us here - its parent is not
344
+
* locked. That's OK and that could happen just as we return from
345
+
* ecryptfs_lookup() anyway. Just need to be careful and fetch
346
+
* ->d_inode only once - it's not stable here.
347
+
*/
348
+
lower_inode = READ_ONCE(lower_dentry->d_inode);
349
+
350
+
if (!lower_inode) {
343
351
/* We want to add because we couldn't find in lower */
344
352
d_add(dentry, NULL);
345
353
return NULL;