Don't use an uninitialized field reserved for callers in the bio structure
passed to swap_pager_strategy(). Instead, use a field reserved for drivers and initialize it before usage. Reviewed by: dillon
This commit is contained in:
parent
eb9d1d2716
commit
d6844b6bf6
@ -888,6 +888,7 @@ swap_pager_strategy(vm_object_t object, struct bio *bp)
|
|||||||
bp->bio_error = 0;
|
bp->bio_error = 0;
|
||||||
bp->bio_flags &= ~BIO_ERROR;
|
bp->bio_flags &= ~BIO_ERROR;
|
||||||
bp->bio_resid = bp->bio_bcount;
|
bp->bio_resid = bp->bio_bcount;
|
||||||
|
*(u_int *) &bp->bio_driver1 = 0;
|
||||||
|
|
||||||
start = bp->bio_pblkno;
|
start = bp->bio_pblkno;
|
||||||
count = howmany(bp->bio_bcount, PAGE_SIZE);
|
count = howmany(bp->bio_bcount, PAGE_SIZE);
|
||||||
@ -2029,7 +2030,7 @@ vm_pager_chain_iodone(struct buf *nbp)
|
|||||||
u_int *count;
|
u_int *count;
|
||||||
|
|
||||||
bp = nbp->b_caller1;
|
bp = nbp->b_caller1;
|
||||||
count = (u_int *)&(bp->bio_caller1);
|
count = (u_int *)&(bp->bio_driver1);
|
||||||
if (bp != NULL) {
|
if (bp != NULL) {
|
||||||
if (nbp->b_ioflags & BIO_ERROR) {
|
if (nbp->b_ioflags & BIO_ERROR) {
|
||||||
bp->bio_flags |= BIO_ERROR;
|
bp->bio_flags |= BIO_ERROR;
|
||||||
@ -2068,7 +2069,7 @@ getchainbuf(struct bio *bp, struct vnode *vp, int flags)
|
|||||||
|
|
||||||
GIANT_REQUIRED;
|
GIANT_REQUIRED;
|
||||||
nbp = getpbuf(NULL);
|
nbp = getpbuf(NULL);
|
||||||
count = (u_int *)&(bp->bio_caller1);
|
count = (u_int *)&(bp->bio_driver1);
|
||||||
|
|
||||||
nbp->b_caller1 = bp;
|
nbp->b_caller1 = bp;
|
||||||
++(*count);
|
++(*count);
|
||||||
@ -2110,7 +2111,7 @@ waitchainbuf(struct bio *bp, int limit, int done)
|
|||||||
u_int *count;
|
u_int *count;
|
||||||
|
|
||||||
GIANT_REQUIRED;
|
GIANT_REQUIRED;
|
||||||
count = (u_int *)&(bp->bio_caller1);
|
count = (u_int *)&(bp->bio_driver1);
|
||||||
s = splbio();
|
s = splbio();
|
||||||
while (*count > limit) {
|
while (*count > limit) {
|
||||||
bp->bio_flags |= BIO_FLAG1;
|
bp->bio_flags |= BIO_FLAG1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user