Skip to content

Commit

Permalink
sunrpc: GFP_KERNEL should be GFP_NOFS in crypto code
Browse files Browse the repository at this point in the history
Writes may depend on the auth_gss crypto code, so we shouldn't be
allocating with GFP_KERNEL there.

This still leaves some crypto_alloc_* calls which end up doing
GFP_KERNEL allocations in the crypto code.  Those could probably done at
crypto import time.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
J. Bruce Fields committed Nov 1, 2016
1 parent e864c18 commit 56094ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 6 additions & 6 deletions net/sunrpc/auth_gss/gss_krb5_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ make_checksum_hmac_md5(struct krb5_ctx *kctx, char *header, int hdrlen,
if (IS_ERR(hmac_md5))
goto out_free_md5;

req = ahash_request_alloc(md5, GFP_KERNEL);
req = ahash_request_alloc(md5, GFP_NOFS);
if (!req)
goto out_free_hmac_md5;

Expand Down Expand Up @@ -230,7 +230,7 @@ make_checksum_hmac_md5(struct krb5_ctx *kctx, char *header, int hdrlen,
goto out;

ahash_request_free(req);
req = ahash_request_alloc(hmac_md5, GFP_KERNEL);
req = ahash_request_alloc(hmac_md5, GFP_NOFS);
if (!req)
goto out_free_hmac_md5;

Expand Down Expand Up @@ -299,7 +299,7 @@ make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen,
if (IS_ERR(tfm))
goto out_free_cksum;

req = ahash_request_alloc(tfm, GFP_KERNEL);
req = ahash_request_alloc(tfm, GFP_NOFS);
if (!req)
goto out_free_ahash;

Expand Down Expand Up @@ -397,7 +397,7 @@ make_checksum_v2(struct krb5_ctx *kctx, char *header, int hdrlen,
goto out_free_cksum;
checksumlen = crypto_ahash_digestsize(tfm);

req = ahash_request_alloc(tfm, GFP_KERNEL);
req = ahash_request_alloc(tfm, GFP_NOFS);
if (!req)
goto out_free_ahash;

Expand Down Expand Up @@ -963,7 +963,7 @@ krb5_rc4_setup_seq_key(struct krb5_ctx *kctx, struct crypto_skcipher *cipher,
}

desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(hmac),
GFP_KERNEL);
GFP_NOFS);
if (!desc) {
dprintk("%s: failed to allocate shash descriptor for '%s'\n",
__func__, kctx->gk5e->cksum_name);
Expand Down Expand Up @@ -1030,7 +1030,7 @@ krb5_rc4_setup_enc_key(struct krb5_ctx *kctx, struct crypto_skcipher *cipher,
}

desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(hmac),
GFP_KERNEL);
GFP_NOFS);
if (!desc) {
dprintk("%s: failed to allocate shash descriptor for '%s'\n",
__func__, kctx->gk5e->cksum_name);
Expand Down
3 changes: 1 addition & 2 deletions net/sunrpc/auth_gss/gss_krb5_mech.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,7 @@ context_derive_keys_rc4(struct krb5_ctx *ctx)
goto out_err_free_hmac;


desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(hmac),
GFP_KERNEL);
desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(hmac), GFP_NOFS);
if (!desc) {
dprintk("%s: failed to allocate hash descriptor for '%s'\n",
__func__, ctx->gk5e->cksum_name);
Expand Down

0 comments on commit 56094ed

Please sign in to comment.