diff options
author | John-Mark Gurney <jmg@FreeBSD.org> | 2015-07-07 18:45:32 +0000 |
---|---|---|
committer | John-Mark Gurney <jmg@FreeBSD.org> | 2015-07-07 18:45:32 +0000 |
commit | 748a12e2c345e87e750c99a50f252e67bc988b13 (patch) | |
tree | e1043364630d52d1c41fa6e6a512fd955a14db9a /sys/opencrypto/criov.c | |
parent | 906451276ae1b579a75dff751fd2687b3293563d (diff) | |
download | src-748a12e2c345e87e750c99a50f252e67bc988b13.tar.gz src-748a12e2c345e87e750c99a50f252e67bc988b13.zip |
we may get here w/ non-sleepable locks held, so switch to _NOWAIT when
doing this memory allocation...
Reviewed by: ae
Notes
Notes:
svn path=/head/; revision=285247
Diffstat (limited to 'sys/opencrypto/criov.c')
-rw-r--r-- | sys/opencrypto/criov.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/opencrypto/criov.c b/sys/opencrypto/criov.c index f94631ec8ca0..499bfe34e08c 100644 --- a/sys/opencrypto/criov.c +++ b/sys/opencrypto/criov.c @@ -193,7 +193,7 @@ crypto_apply(int flags, caddr_t buf, int off, int len, return (error); } -void +int crypto_mbuftoiov(struct mbuf *mbuf, struct iovec **iovptr, int *cnt, int *allocated) { @@ -216,7 +216,9 @@ crypto_mbuftoiov(struct mbuf *mbuf, struct iovec **iovptr, int *cnt, while ((mtmp = mtmp->m_next) != NULL) j++; iov = malloc(sizeof *iov * (i + j), M_CRYPTO_DATA, - M_WAITOK); + M_NOWAIT); + if (iov == NULL) + return ENOMEM; *allocated = 1; *cnt = i + j; memcpy(iov, *iovptr, sizeof *iov * i); @@ -235,4 +237,5 @@ crypto_mbuftoiov(struct mbuf *mbuf, struct iovec **iovptr, int *cnt, *iovptr = iov; *cnt = i; + return 0; } |