According to commit "vfs: parse: deal with zero length string value", kernel will set the param->string to null pointer in vfs_parse_fs_string() if fs string has zero length. Yet the problem is that, proc_parse_param() will dereferences the param->string, without checking whether it is a null pointer, which may trigger a null-ptr-deref bug. This patch solves it by adding sanity check on param->string in proc_parse_param(). Signed-off-by: Hawkins Jiawei <yin31149@xxxxxxxxx> --- fs/proc/root.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/proc/root.c b/fs/proc/root.c index 3c2ee3eb1138..5346809dc3c3 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -130,6 +130,9 @@ static int proc_parse_param(struct fs_context *fc, struct fs_parameter *param) break; case Opt_subset: + if (!param->string) + return invalfc(fc, "Bad value '%s' for mount option '%s'\n", + param->string, param->key); if (proc_parse_subset_param(fc, param->string) < 0) return -EINVAL; break; -- 2.25.1