mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-19 23:03:55 +00:00
When a bio comes back from below with a zero error code, check that
it wrote the full length. The only case where this should be able to happen is if we try to read/write past the end and the request is truncated. We obviously should never try to do that, so this code should never activate.
This commit is contained in:
parent
1ea349191e
commit
ca8f372bbc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114249
|
@ -403,6 +403,8 @@ g_bde_write_done(struct bio *bp)
|
|||
KASSERT(sc != NULL, ("NULL sc"));
|
||||
KASSERT(sp->owner != NULL, ("NULL sp->owner"));
|
||||
g_trace(G_T_TOPOLOGY, "g_bde_write_done(%p)", sp);
|
||||
if (bp->bio_error == 0 && bp->bio_completed != sp->size)
|
||||
bp->bio_error = EIO;
|
||||
sp->error = bp->bio_error;
|
||||
g_destroy_bio(bp);
|
||||
wp = sp->owner;
|
||||
|
@ -479,6 +481,8 @@ g_bde_read_done(struct bio *bp)
|
|||
g_trace(G_T_TOPOLOGY, "g_bde_read_done(%p)", sp);
|
||||
sc = bp->bio_caller2;
|
||||
mtx_lock(&sc->worklist_mutex);
|
||||
if (bp->bio_error == 0 && bp->bio_completed != sp->siz)
|
||||
bp->bio_error = EIO;
|
||||
sp->error = bp->bio_error;
|
||||
if (sp->error == 0)
|
||||
sp->state = VALID;
|
||||
|
|
Loading…
Reference in a new issue