summaryrefslogtreecommitdiffstats
path: root/sys/dev
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
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')
-rw-r--r--sys/dev/vinum/vinumconfig.c6
-rw-r--r--sys/dev/vinum/vinumlock.c5
2 files changed, 3 insertions, 8 deletions
diff --git a/sys/dev/vinum/vinumconfig.c b/sys/dev/vinum/vinumconfig.c
index 5d2277d..0fc1e1e 100644
--- a/sys/dev/vinum/vinumconfig.c
+++ b/sys/dev/vinum/vinumconfig.c
@@ -1352,12 +1352,6 @@ config_plex(int update)
sprintf(plexsuffix, ".p%d", pindex); /* form the suffix */
strcat(plex->name, plexsuffix); /* and add it to the name */
}
- if (plex->organization == plex_raid5) { /* RAID-5 plex, */
- plex->lock = (struct rangelock *)
- Malloc(sizeof(struct rangelock) * INITIAL_LOCKS); /* allocate lock table */
- bzero(plex->lock, sizeof(struct rangelock) * INITIAL_LOCKS); /* zero it */
- plex->alloclocks = INITIAL_LOCKS; /* and note how many there are */
- }
/* Note the last plex we configured */
current_plex = plexno;
plex->state = state; /* set whatever state we chose */
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