diff options
author | Yunjian Wang <wangyunjian@huawei.com> | 2021-04-23 17:42:58 +0800 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2021-04-23 10:43:05 -0400 |
commit | b9f83ffaa0c096b4c832a43964fe6bff3acffe10 (patch) | |
tree | f1a9a914fdf8921546748669858823868db60098 /net | |
parent | cb579086536f6564f5846f89808ec394ef8b8621 (diff) | |
download | linux-stable-b9f83ffaa0c096b4c832a43964fe6bff3acffe10.tar.gz linux-stable-b9f83ffaa0c096b4c832a43964fe6bff3acffe10.tar.bz2 linux-stable-b9f83ffaa0c096b4c832a43964fe6bff3acffe10.zip |
SUNRPC: Fix null pointer dereference in svc_rqst_free()
When alloc_pages_node() returns null in svc_rqst_alloc(), the
null rq_scratch_page pointer will be dereferenced when calling
put_page() in svc_rqst_free(). Fix it by adding a null check.
Addresses-Coverity: ("Dereference after null check")
Fixes: 5191955d6fc6 ("SUNRPC: Prepare for xdr_stream-style decoding on the server-side")
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/svc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index d76dc9d95d16..0de918cb3d90 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -846,7 +846,8 @@ void svc_rqst_free(struct svc_rqst *rqstp) { svc_release_buffer(rqstp); - put_page(rqstp->rq_scratch_page); + if (rqstp->rq_scratch_page) + put_page(rqstp->rq_scratch_page); kfree(rqstp->rq_resp); kfree(rqstp->rq_argp); kfree(rqstp->rq_auth_data); |