summaryrefslogtreecommitdiffstats
path: root/sys/opencrypto/criov.c
diff options
context:
space:
mode:
authorLuiz Otavio O Souza <luiz@netgate.com>2015-09-15 16:14:16 -0500
committerLuiz Otavio O Souza <luiz@netgate.com>2015-10-20 12:06:44 -0500
commit4a5da8d970cd2aa5659b6ef40220a69671465f74 (patch)
tree3f81b076d3df7632bb50f427f8cdf77764e60763 /sys/opencrypto/criov.c
parentc34073cc8f92a0177aa3411a36197df65f68b0c0 (diff)
downloadFreeBSD-src-4a5da8d970cd2aa5659b6ef40220a69671465f74.zip
FreeBSD-src-4a5da8d970cd2aa5659b6ef40220a69671465f74.tar.gz
MFC r285247:
we may get here w/ non-sleepable locks held, so switch to _NOWAIT when doing this memory allocation... Reviewed by: ae TAG: IPSEC-HEAD Issue: #4841
Diffstat (limited to 'sys/opencrypto/criov.c')
-rw-r--r--sys/opencrypto/criov.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/opencrypto/criov.c b/sys/opencrypto/criov.c
index f94631e..499bfe3 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;
}
OpenPOWER on IntegriCloud