diff options
author | Will Andrews <will@FreeBSD.org> | 2015-01-21 20:05:10 +0000 |
---|---|---|
committer | Will Andrews <will@FreeBSD.org> | 2015-01-21 20:05:10 +0000 |
commit | ed80123329840074d632ef16f077c84ec0dae7ac (patch) | |
tree | 8696e8210005db0e82279789139fa7468fabddf0 /sys | |
parent | 7eaab60d36eb0ea0c3e05b16db9fc2aa8a37ff63 (diff) | |
download | src-ed80123329840074d632ef16f077c84ec0dae7ac.tar.gz src-ed80123329840074d632ef16f077c84ec0dae7ac.zip |
Properly lock accesss to the firewire_comm->devices list.
sys/dev/firewire/firewire.c:
Add missing FW_GLOCK/UNLOCK() usage to fw_noderesolve_nodeid().
sys/dev/firewire/firewire.c:
sys/dev/firewire/fwmem.c:
Remove no-op splfw() calls from functions that have been
audited for proper lock usage.
Submitted by: gibbs
MFC after: 1 week
Sponsored by: Spectra Logic
MFSpectraBSD: 1110992 on 2015/01/06
Notes
Notes:
svn path=/head/; revision=277509
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/firewire/firewire.c | 18 | ||||
-rw-r--r-- | sys/dev/firewire/fwmem.c | 4 |
2 files changed, 6 insertions, 16 deletions
diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 026bd056d40f..976be69e721d 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -146,13 +146,12 @@ struct fw_device * fw_noderesolve_nodeid(struct firewire_comm *fc, int dst) { struct fw_device *fwdev; - int s; - s = splfw(); + FW_GLOCK(fc); STAILQ_FOREACH(fwdev, &fc->devices, link) if (fwdev->dst == dst && fwdev->status != FWDEVINVAL) break; - splx(s); + FW_GUNLOCK(fc); return fwdev; } @@ -164,15 +163,12 @@ struct fw_device * fw_noderesolve_eui64(struct firewire_comm *fc, struct fw_eui64 *eui) { struct fw_device *fwdev; - int s; - s = splfw(); FW_GLOCK(fc); STAILQ_FOREACH(fwdev, &fc->devices, link) if (FW_EUI64_EQUAL(fwdev->eui, *eui)) break; FW_GUNLOCK(fc); - splx(s); if (fwdev == NULL) return NULL; @@ -301,9 +297,7 @@ static void fw_asystart(struct fw_xfer *xfer) { struct firewire_comm *fc = xfer->fc; - int s; - s = splfw(); /* Protect from interrupt/timeout */ FW_GLOCK(fc); xfer->flag = FWXF_INQ; @@ -312,7 +306,6 @@ fw_asystart(struct fw_xfer *xfer) xfer->q->queued++; #endif FW_GUNLOCK(fc); - splx(s); /* XXX just queue for mbuf */ if (xfer->mbuf == NULL) xfer->q->start(fc); @@ -332,6 +325,7 @@ firewire_probe(device_t dev) return (0); } +/* Just use a per-packet callout? */ static void firewire_xfer_timeout(void *arg, int pending) { @@ -340,7 +334,7 @@ firewire_xfer_timeout(void *arg, int pending) struct timeval tv; struct timeval split_timeout; STAILQ_HEAD(, fw_xfer) xfer_timeout; - int i, s; + int i; split_timeout.tv_sec = 0; split_timeout.tv_usec = 200 * 1000; /* 200 msec */ @@ -349,9 +343,8 @@ firewire_xfer_timeout(void *arg, int pending) timevalsub(&tv, &split_timeout); STAILQ_INIT(&xfer_timeout); - s = splfw(); mtx_lock(&fc->tlabel_lock); - for (i = 0; i < 0x40; i++) { + for (i = 0; i < nitems(fc->tlabels); i++) { while ((xfer = STAILQ_FIRST(&fc->tlabels[i])) != NULL) { if ((xfer->flag & FWXF_SENT) == 0) /* not sent yet */ @@ -370,7 +363,6 @@ firewire_xfer_timeout(void *arg, int pending) } } mtx_unlock(&fc->tlabel_lock); - splx(s); fc->timeout(fc); STAILQ_FOREACH_SAFE(xfer, &xfer_timeout, tlabel, txfer) diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index 182fc8aba51a..6498daa480ab 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -348,12 +348,11 @@ fwmem_strategy(struct bio *bp) struct fw_device *fwdev; struct fw_xfer *xfer; struct cdev *dev; - int err = 0, s, iolen; + int err = 0, iolen; dev = bp->bio_dev; /* XXX check request length */ - s = splfw(); fms = dev->si_drv1; fwdev = fw_noderesolve_eui64(fms->sc->fc, &fms->eui); if (fwdev == NULL) { @@ -395,7 +394,6 @@ fwmem_strategy(struct bio *bp) /* XXX */ bp->bio_resid = bp->bio_bcount - iolen; error: - splx(s); if (err != 0) { if (fwmem_debug) printf("%s: err=%d\n", __func__, err); |