]> git.baikalelectronics.ru Git - kernel.git/commit
sunrpc: don't pass on-stack memory to sg_set_buf
authorJ. Bruce Fields <bfields@redhat.com>
Tue, 18 Oct 2016 20:30:09 +0000 (16:30 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 26 Oct 2016 19:49:48 +0000 (15:49 -0400)
commit967813f42f0d34ac5cf5cfdc454ce9a2ef52e3e9
tree3ef99967d3cf3c5dc577432b73b3e4b03d43df5b
parent4998cf3460a336ea7daaf7f185e9df0160d0cfa1
sunrpc: don't pass on-stack memory to sg_set_buf

As of b68c6fd66e07 "scatterlist: sg_set_buf() argument must be in linear
mapping", sg_set_buf hits a BUG when make_checksum_v2->xdr_process_buf,
among other callers, passes it memory on the stack.

We only need a scatterlist to pass this to the crypto code, and it seems
like overkill to require kmalloc'd memory just to encrypt a few bytes,
but for now this seems the best fix.

Many of these callers are in the NFS write paths, so we allocate with
GFP_NOFS.  It might be possible to do without allocations here entirely,
but that would probably be a bigger project.

Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/auth_gss/gss_krb5_crypto.c
net/sunrpc/auth_gss/svcauth_gss.c