If on a BIO_READ request, we failed to allocate the bio for reading

our key-sector, we would end up returning the read without an error,
despite the fact that the data was not correctly decrypted.

This would result in data corruption on read, but intact data still
on the media.
This commit is contained in:
Poul-Henning Kamp 2003-04-25 21:28:28 +00:00
parent 37f5e4a6c2
commit e8e0742ef4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114040

View File

@ -572,13 +572,20 @@ g_bde_worker(void *arg)
}
switch(wp->bp->bio_cmd) {
case BIO_READ:
if (wp->ksp != NULL && wp->sp->error == 0) {
mtx_unlock(&sc->worklist_mutex);
g_bde_crypt_read(wp);
mtx_lock(&sc->worklist_mutex);
if (wp->ksp == NULL) {
KASSERT(wp->error != 0,
("BIO_READ, no ksp and no error"));
g_bde_contribute(wp->bp, wp->length,
wp->error);
} else {
if (wp->sp->error == 0) {
mtx_unlock(&sc->worklist_mutex);
g_bde_crypt_read(wp);
mtx_lock(&sc->worklist_mutex);
}
g_bde_contribute(wp->bp, wp->length,
wp->sp->error);
}
g_bde_contribute(wp->bp, wp->length,
wp->sp->error);
g_bde_delete_sector(sc, wp->sp);
if (wp->ksp != NULL)
g_bde_release_keysector(wp);