Skip to content

Commit

Permalink
ovl: add WARN_ON() for non-dir redirect cases
Browse files Browse the repository at this point in the history
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Miklos Szeredi committed Apr 12, 2018
1 parent 0471a9c commit 3a29177
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions fs/overlayfs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
d->stop = true;
if (d->is_dir)
goto put_and_out;

/*
* NB: handle failure to lookup non-last element when non-dir
* redirects become possible
*/
WARN_ON(!last_element);
goto out;
}
if (last_element)
Expand Down Expand Up @@ -1006,6 +1012,11 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
if (IS_ERR(inode))
goto out_free_oe;

/*
* NB: handle redirected hard links when non-dir redirects
* become possible
*/
WARN_ON(OVL_I(inode)->redirect);
OVL_I(inode)->redirect = upperredirect;
}

Expand Down

0 comments on commit 3a29177

Please sign in to comment.