]> git.baikalelectronics.ru Git - kernel.git/commit
nfs: fix possible null-ptr-deref when parsing param
authorHawkins Jiawei <yin31149@gmail.com>
Sun, 23 Oct 2022 16:39:45 +0000 (00:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:33:04 +0000 (13:33 +0100)
commit1d9369ef89af885c313eb558cdb350a81126a001
tree5d9f1b1ea5dd4c38d26e26d5a6988bfa711c3076
parentba3086361eb98a0e3c9eaa607530137b0dbf35a0
nfs: fix possible null-ptr-deref when parsing param

[ Upstream commit 5559405df652008e56eee88872126fe4c451da67 ]

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, nfs_fs_context_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 nfs_fs_context_parse_param().

Signed-off-by: Hawkins Jiawei <yin31149@gmail.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/fs_context.c