Skip to content

Commit bb366dc

Browse files
tooteagregkh
authored andcommitted
sunrpc: fix stripping of padded MIC tokens
commit c0cb8bf upstream. The length of the GSS MIC token need not be a multiple of four bytes. It is then padded by XDR to a multiple of 4 B, but unwrap_integ_data() would previously only trim mic.len + 4 B. The remaining up to three bytes would then trigger a check in nfs4svc_decode_compoundargs(), leading to a "garbage args" error and mount failure: nfs4svc_decode_compoundargs: compound not properly padded! nfsd: failed to decode arguments! This would prevent older clients using the pre-RFC 4121 MIC format (37-byte MIC including a 9-byte OID) from mounting exports from v3.9+ servers using krb5i. The trimming was introduced by commit 4c190e2 ("sunrpc: trim off trailing checksum before returning decrypted or integrity authenticated buffer"). Fixes: 4c190e2 "unrpc: trim off trailing checksum..." Signed-off-by: Tomáš Trnka <[email protected]> Acked-by: Jeff Layton <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 345de6e commit bb366dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/sunrpc/auth_gss/svcauth_gss.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,8 @@ unwrap_integ_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct g
857857
goto out;
858858
if (svc_getnl(&buf->head[0]) != seq)
859859
goto out;
860-
/* trim off the mic at the end before returning */
861-
xdr_buf_trim(buf, mic.len + 4);
860+
/* trim off the mic and padding at the end before returning */
861+
xdr_buf_trim(buf, round_up_to_quad(mic.len) + 4);
862862
stat = 0;
863863
out:
864864
kfree(mic.data);

0 commit comments

Comments
 (0)