SUNRPC: Fix another issue with MIC buffer space
authorChuck Lever <chuck.lever@oracle.com>
Fri, 15 Nov 2019 13:39:07 +0000 (08:39 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Jan 2020 09:01:07 +0000 (10:01 +0100)
commite0e2379bfc70ef2d540e6f29f2aafd3c07a8026d
tree8c245926665dc3a5fa8907b0fa3f13419cae91a5
parent16128944c90749d0b88758bcf727c8e8af3b2f4e
SUNRPC: Fix another issue with MIC buffer space

[ Upstream commit e8d70b321ecc9b23d09b8df63e38a2f73160c209 ]

xdr_shrink_pagelen() BUG's when @len is larger than buf->page_len.
This can happen when xdr_buf_read_mic() is given an xdr_buf with
a small page array (like, only a few bytes).

Instead, just cap the number of bytes that xdr_shrink_pagelen()
will move.

Fixes: 5f1bc39979d ("SUNRPC: Fix buffer handling of GSS MIC ... ")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sunrpc/xdr.c