we may get here w/ non-sleepable locks held, so switch to _NOWAIT when

doing this memory allocation...

Reviewed by:	ae
This commit is contained in:
John-Mark Gurney 2015-07-07 18:45:32 +00:00
parent 906451276a
commit 748a12e2c3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285247
3 changed files with 9 additions and 4 deletions

View File

@ -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;
}

View File

@ -465,7 +465,7 @@ extern int cuio_apply(struct uio *uio, int off, int len,
struct mbuf;
struct iovec;
extern void crypto_mbuftoiov(struct mbuf *mbuf, struct iovec **iovptr,
extern int crypto_mbuftoiov(struct mbuf *mbuf, struct iovec **iovptr,
int *cnt, int *allocated);
extern void crypto_copyback(int flags, caddr_t buf, int off, int size,

View File

@ -147,8 +147,10 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_data *sw, caddr_t buf,
iovalloc = 0;
uio = &uiolcl;
if ((flags & CRYPTO_F_IMBUF) != 0) {
crypto_mbuftoiov((struct mbuf *)buf, &iov, &iovcnt,
error = crypto_mbuftoiov((struct mbuf *)buf, &iov, &iovcnt,
&iovalloc);
if (error)
return (error);
uio->uio_iov = iov;
uio->uio_iovcnt = iovcnt;
} else if ((flags & CRYPTO_F_IOV) != 0)