From: Petr Vandrovec Date: Mon, 7 Nov 2016 20:11:29 +0000 (-0800) Subject: NFS: Ignore connections that have cl_rpcclient uninitialized X-Git-Tag: v4.9-rc5~23^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ef3295530ddc969ea9a3f307d94df97fcbc0629;p=platform%2Fkernel%2Flinux-amlogic.git NFS: Ignore connections that have cl_rpcclient uninitialized cl_rpcclient starts as ERR_PTR(-EINVAL), and connections like that are floating freely through the system. Most places check whether pointer is valid before dereferencing it, but newly added code in nfs_match_client does not. Which causes crashes when more than one NFS mount point is present. Signed-off-by: Petr Vandrovec Signed-off-by: Anna Schumaker --- diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 7555ba8..ebecfb8 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -314,7 +314,8 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat /* Match the full socket address */ if (!rpc_cmp_addr_port(sap, clap)) /* Match all xprt_switch full socket addresses */ - if (!rpc_clnt_xprt_switch_has_addr(clp->cl_rpcclient, + if (IS_ERR(clp->cl_rpcclient) || + !rpc_clnt_xprt_switch_has_addr(clp->cl_rpcclient, sap)) continue;