diff --git a/fs/namei.c b/fs/namei.c index d1c0b91b4534b..b1b1781faca15 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3116,6 +3116,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);