diff --git a/fs/exec.c b/fs/exec.c index 3c3c366a9bcf58..3c2d339c971f84 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1896,6 +1896,10 @@ static int do_execveat_common(int fd, struct filename *filename, } retval = count(argv, MAX_ARG_STRINGS); + if (retval == 0) { + pr_warn_once("Attempted to run process '%s' with NULL argv\n", bprm->filename); + retval = -EINVAL; + } if (retval < 0) goto out_free; bprm->argc = retval;