aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2024-01-04 13:34:31 +0000
committerMark Johnston <markj@FreeBSD.org>2024-01-11 14:26:53 +0000
commit185634d86d96b836336862d80e4e454c91e3ad99 (patch)
tree942e0063f906aaa1ea5793133a273cc16b6818bd
parent758c5b5c02d0a50f00032a2cda533f5590fb47a7 (diff)
downloadsrc-185634d86d96b836336862d80e4e454c91e3ad99.tar.gz
src-185634d86d96b836336862d80e4e454c91e3ad99.zip
targ: Handle errors from suword()
In targstart() we are already handling an error and have no go way to signal the failure to upper layers, so ignore the return value of suword() there. This is in preparation for annotating copyin() and related functions with __result_use_check. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43202 (cherry picked from commit 904cd456f0f95c10fdb4c99a0118f30d23242dec)
-rw-r--r--sys/cam/scsi/scsi_target.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c
index 6b2fd5adb4ee..6872e3a2a93b 100644
--- a/sys/cam/scsi/scsi_target.c
+++ b/sys/cam/scsi/scsi_target.c
@@ -635,8 +635,8 @@ targstart(struct cam_periph *periph, union ccb *start_ccb)
xpt_print(periph->path,
"targsendccb failed, err %d\n", error);
xpt_release_ccb(start_ccb);
- suword(&descr->user_ccb->ccb_h.status,
- CAM_REQ_CMP_ERR);
+ (void)suword(&descr->user_ccb->ccb_h.status,
+ CAM_REQ_CMP_ERR);
TAILQ_INSERT_TAIL(&softc->abort_queue, descr, tqe);
notify_user(softc);
}
@@ -868,7 +868,10 @@ targread(struct cdev *dev, struct uio *uio, int ioflag)
CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH,
("targread aborted descr %p (%p)\n",
user_descr, user_ccb));
- suword(&user_ccb->ccb_h.status, CAM_REQ_ABORTED);
+ if (suword(&user_ccb->ccb_h.status, CAM_REQ_ABORTED) != 0) {
+ error = EFAULT;
+ goto read_fail;
+ }
cam_periph_unlock(softc->periph);
error = uiomove((caddr_t)&user_ccb, sizeof(user_ccb), uio);
cam_periph_lock(softc->periph);