git: 185634d86d96 - stable/14 - targ: Handle errors from suword()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 11 Jan 2024 14:32:41 UTC
The branch stable/14 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=185634d86d96b836336862d80e4e454c91e3ad99
commit 185634d86d96b836336862d80e4e454c91e3ad99
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-01-04 13:34:31 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-11 14:26:53 +0000
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)
---
sys/cam/scsi/scsi_target.c | 9 ++++++---
1 file 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);