Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/sys/opencrypto
On Sun, 19 Jan 2014, Christos Zoulas wrote:
Module Name: src
Committed By: christos
Date: Sun Jan 19 18:16:13 UTC 2014
Modified Files:
src/sys/opencrypto: cryptodev.c
Log Message:
bail out unloading for now
How about the following changes?
@@ -143,6 +143,8 @@ static int cryptoread(dev_t dev, struct
static int cryptowrite(dev_t dev, struct uio *uio, int ioflag);
static int cryptoselect(dev_t dev, int rw, struct lwp *l);
+static int crypto_refcount = 0; /* Prevent detaching while in use */
+
/* Declaration of cloned-device (per-ctxt) entrypoints */
static int cryptof_read(struct file *, off_t *, struct uio *,
kauth_cred_t, int);
@@ -262,6 +264,7 @@ cryptof_ioctl(struct file *fp, u_long cm
*/
criofcr->sesn = 1;
criofcr->requestid = 1;
+ crypto_refcount++;
mutex_exit(&crypto_mtx);
(void)fd_clone(criofp, criofd, (FREAD|FWRITE),
&cryptofops, criofcr);
@@ -951,6 +954,7 @@ cryptof_close(struct file *fp)
}
seldestroy(&fcr->sinfo);
fp->f_data = NULL;
+ crypto_refcount--;
mutex_exit(&crypto_mtx);
pool_put(&fcrpl, fcr);
@@ -1080,6 +1084,7 @@ cryptoopen(dev_t dev, int flag, int mode
*/
fcr->sesn = 1;
fcr->requestid = 1;
+ crypto_refcount++;
mutex_exit(&crypto_mtx);
return fd_clone(fp, fd, flag, &cryptofops, fcr);
}
@@ -2109,6 +2114,10 @@ int crypto_detach(device_t, int);
int
crypto_detach(device_t self, int num)
{
+
+ if (crypto_refcount != 0 || self->dv_unit != 0)
+ return EBUSY;
+
pool_destroy(&fcrpl);
pool_destroy(&csepl);
To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/opencrypto/cryptodev.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
!DSPAM:52dc1675236281199521295!
-------------------------------------------------------------------------
| Paul Goyette | PGP Key fingerprint: | E-mail addresses: |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer | | pgoyette at netbsd.org |
-------------------------------------------------------------------------
Home |
Main Index |
Thread Index |
Old Index