Skip to content

Commit b9f83ff

Browse files
wyjwangchucklever
authored andcommitted
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: 5191955 ("SUNRPC: Prepare for xdr_stream-style decoding on the server-side") Signed-off-by: Yunjian Wang <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent cb57908 commit b9f83ff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/sunrpc/svc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,8 @@ void
846846
svc_rqst_free(struct svc_rqst *rqstp)
847847
{
848848
svc_release_buffer(rqstp);
849-
put_page(rqstp->rq_scratch_page);
849+
if (rqstp->rq_scratch_page)
850+
put_page(rqstp->rq_scratch_page);
850851
kfree(rqstp->rq_resp);
851852
kfree(rqstp->rq_argp);
852853
kfree(rqstp->rq_auth_data);

0 commit comments

Comments
 (0)