summaryrefslogtreecommitdiffstats
path: root/sys/dev/vinum/vinumlock.c
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>1999-08-26 03:25:38 +0000
committergrog <grog@FreeBSD.org>1999-08-26 03:25:38 +0000
commit1c73eada882e989c0b06bf85b3ac6d402ab8ca53 (patch)
tree1abc6e75e0fa2d81bc10f95906c61ad0eb490f06 /sys/dev/vinum/vinumlock.c
parente225ec605bdfb1478100f8c90c92118e64ef8449 (diff)
downloadFreeBSD-src-1c73eada882e989c0b06bf85b3ac6d402ab8ca53.zip
FreeBSD-src-1c73eada882e989c0b06bf85b3ac6d402ab8ca53.tar.gz
config_plex: don't allocate a rangelock struct.
lockrange: correctly expand rangelock struct, including expanding a null struct. Previously lockrange would attempt to lock a NULL pointer under these circumstances. Reported-by: Ian Freislich <iang@uunet.co.za>
Diffstat (limited to 'sys/dev/vinum/vinumlock.c')
-rw-r--r--sys/dev/vinum/vinumlock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/vinum/vinumlock.c b/sys/dev/vinum/vinumlock.c
index 9daf64d..8bc1320 100644
--- a/sys/dev/vinum/vinumlock.c
+++ b/sys/dev/vinum/vinumlock.c
@@ -268,10 +268,11 @@ lockrange(daddr_t stripe, struct buf *bp, struct plex *plex)
if (foundlocks >= plex->alloclocks) { /* searched the lot, */
newlock = plex->alloclocks;
EXPAND(plex->lock, struct rangelock, plex->alloclocks, INITIAL_LOCKS);
+ pos = &plex->lock[newlock];
while (newlock < plex->alloclocks)
plex->lock[newlock++].stripe = 0;
- }
- pos = lock; /* put it at the end */
+ } else
+ pos = lock; /* put it at the end */
}
pos->stripe = stripe;
pos->bp = bp;
OpenPOWER on IntegriCloud