diff --git a/fs/namei.c b/fs/namei.c index be3d538d56b3..2a8ba683a888 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3111,6 +3111,10 @@ static int do_last(struct nameidata *nd, struct path *path, goto exit_fput; } out: + if (unlikely(error > 0)) { + WARN_ON(1); + error = -EINVAL; + } if (got_write) mnt_drop_write(nd->path.mnt); path_put(&save_parent);