If we return an error make sure we don't return a b_resid of 0; or this

will trigger a KASSERT in physio_done(). Fix issue reported by Todd Kover
on tech-kern@
This commit is contained in:
bouyer 2008-11-17 21:19:03 +00:00
parent b8208ff6ae
commit 5a45b84ca9
1 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: st.c,v 1.207 2008/09/02 08:58:07 dholland Exp $ */
/* $NetBSD: st.c,v 1.208 2008/11/17 21:19:03 bouyer Exp $ */
/*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.207 2008/09/02 08:58:07 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.208 2008/11/17 21:19:03 bouyer Exp $");
#include "opt_scsi.h"
@ -2199,6 +2199,12 @@ st_interpret_sense(struct scsipi_xfer *xs)
retval = 0;
} else {
retval = EIO;
/*
* If we return an error we can't claim to
* have transfered all data.
*/
if (xs->resid == 0)
xs->resid = xs->datalen;
}
/*
@ -2237,7 +2243,7 @@ st_interpret_sense(struct scsipi_xfer *xs)
}
}
if (bp)
bp->b_resid = info;
bp->b_resid = xs->resid;
}
#ifndef SCSIPI_DEBUG