--- x/fs/namei.c +++ y/fs/namei.c @@ -3533,6 +3533,8 @@ static const char *open_last_lookups(str if (open_flag & (O_CREAT | O_TRUNC | O_WRONLY | O_RDWR)) { got_write = !mnt_want_write(nd->path.mnt); + if (!got_write && (open_flag & O_CREAT)) + return ERR_PTR(-EISDIR); /* * do _not_ fail yet - we might not need that or fail with * a different error; let lookup_open() decide; we'll be