]> git.baikalelectronics.ru Git - kernel.git/commit
xprtrdma: Replace use of xdr_stream_pos in rpcrdma_marshal_req
authorChuck Lever <chuck.lever@oracle.com>
Wed, 19 Jun 2019 14:32:43 +0000 (10:32 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 9 Jul 2019 14:30:11 +0000 (10:30 -0400)
commit3c1b8ee332fdca141cfa9768c76a9d34989dd09d
tree4a1c7eff7b5bb8ed39f1bdd3c8441664eeb62a64
parent74463afdd97d0c9103b0ea3926e0aed2281d665b
xprtrdma: Replace use of xdr_stream_pos in rpcrdma_marshal_req

This is a latent bug. xdr_stream_pos works by subtracting
xdr_stream::nwords from xdr_buf::len. But xdr_stream::nwords is not
initialized by xdr_init_encode().

It works today only because all fields in rpcrdma_req::rl_stream
are initialized to zero by rpcrdma_req_create, making the
subtraction in xdr_stream_pos always a no-op.

I found this issue via code inspection. It was introduced by commit
7ab21cbf19df ("xprtrdma: Harden chunk list encoding against send
buffer overflow"), but the code has changed enough since then that
this fix can't be automatically applied to stable.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
include/trace/events/rpcrdma.h
net/sunrpc/xprtrdma/rpc_rdma.c