SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment()
authorChuck Lever <chuck.lever@oracle.com>
Thu, 25 Jun 2020 15:32:34 +0000 (11:32 -0400)
committerSasha Levin <sashal@kernel.org>
Tue, 30 Jun 2020 19:37:12 +0000 (15:37 -0400)
commit7b99577ff376d58addf149eebe0ffff46351b3d7
treefea34e0dd554996b02e7d414af615a0d2508e4a2
parentc27d205baa8255ad152f26064ecf1fddd0258a5f
SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment()

commit 89a3c9f5b9f0bcaa9aea3e8b2a616fcaea9aad78 upstream.

@subbuf is an output parameter of xdr_buf_subsegment(). A survey of
call sites shows that @subbuf is always uninitialized before
xdr_buf_segment() is invoked by callers.

There are some execution paths through xdr_buf_subsegment() that do
not set all of the fields in @subbuf, leaving some pointer fields
containing garbage addresses. Subsequent processing of that buffer
then results in a page fault.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sunrpc/xdr.c