]> git.karo-electronics.de Git - linux-beck.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)
commit2876a34466ce382a76b9ffb34757bb48928ac743
tree3ef99967d3cf3c5dc577432b73b3e4b03d43df5b
parent0cc11a61b80a1ab1d12f1597b27b8b45ef8bac4a
sunrpc: don't pass on-stack memory to sg_set_buf

As of ac4e97abce9b "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