rpcrdma_decode_msg: check xdr_inline_decode result
Subsystems (4)
PATCH 1/1 rpcrdma_decode_msg: check xdr_inline_decode result
xdr_inline_decode may return NULL, so the check is necessary. The base pointer will be dereferenced later in rpcrdma_inline_fixup.
Signed-off-by Navid Emamdoost <[email protected]>
--- net/sunrpc/xprtrdma/rpc_rdma.c | 3 +++ 1 file changed, 3 insertions(+)
net/sunrpc/xprtrdma/rpc_rdma.c +3 -0
@@ -1160,6 +1160,9 @@ rpcrdma_decode_msg(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep,/* Build the RPC reply's Payload stream in rqst->rq_rcv_buf */ base = (char *)xdr_inline_decode (xdr,0 ); +if (!base) +return -EIO ; + rpclen =xdr_stream_remaining (xdr); r_xprt->rx_stats.fixup_copy_count +=rpcrdma_inline_fixup (rqst, base, rpclen, writelist &3 );
Signature · 1 line
2.17.1
Quoted 6 lines · Navid Emamdoost
xdr_inline_decodemay return NULL, so the check is necessary. The base pointer will be dereferenced later inrpcrdma_inline_fixup.
NACK. When xdr_inline_decode is passed a zero “length” argument, it can never return NULL.
Quoted 22 lines
Signed-off-by Navid Emamdoost <[email protected]>---
net/sunrpc/xprtrdma/rpc_rdma.c| 3 +++1 file changed, 3 insertions(+)net/sunrpc/xprtrdma/rpc_rdma.c +3
-0@@ -1160,6 +1160,9 @@ rpcrdma_decode_msg(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep,/* Build the RPC reply's Payload stream in rqst->rq_rcv_buf */ base = (char *)xdr_inline_decode (xdr,0 ); +if (!base) +return -EIO ; + rpclen =xdr_stream_remaining (xdr); r_xprt->rx_stats.fixup_copy_count +=rpcrdma_inline_fixup (rqst, base, rpclen, writelist &3 );Signature · 1 line
2.17.1