From nobody Thu Jan 04 13:40:23 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T5SQH59Mcz56QJ8; Thu, 4 Jan 2024 13:40:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T5SQH2Smqz41tY; Thu, 4 Jan 2024 13:40:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704375623; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LjyaoAMxW0OGtYoUiWWPwePtcoLlu/PGWTcoQ7rbK08=; b=jYcF08P8L8pMpSP3LhFdSBuJ0mV+R4ELQba3fD3snhuTm76+27NNOdW02QCgbhI/Ulz0Ky 0tz2rL7VqO6JM1A+zRPrf4CCOTrR+zkEO+JMHLGXvIFEDNJvNzFypcSfKT+J3cAXF6hBTW hLtUfhqmKZ1HKa6+rMncszxKE0kB/IeSFMC7tHFiVZlSYie6CBuu5YnRJhxBcMTTACW15N AKlwpHogVJgoF1pqATyE78QmZDoT7es6L6rS7B4wDwLh8iXnO8zP1qDqd6vQThwYHv0k2L exj1+ookH8rnvdX7UIpIIHqHP6cswIHw2cBeI7DUU6bTiZ9H64mrIh0dV7JgjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704375623; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LjyaoAMxW0OGtYoUiWWPwePtcoLlu/PGWTcoQ7rbK08=; b=Wu+kvdyQVhAW16qlXExYDFtp8P9BVS9SBaCSbI/NNXQ5+7flYnXMDzkcSJHwMpl/L5qjL5 J6ElUCm5OprRqKfatz4WBLAZ0w6eMk731CMN8FEAMpbzW8Ek9dmP5IqPzdvBy0AAAhvH31 434L01WfBtgz5asvMt0wwlSlQ7mkvIvHqX3drpaFZfraK5bd0R1G0GxdCpAMtQNF7VjH0s HX4OsReNfG/RPSZBwkmfGwzFOYjaKDr0C/wzxRub1TvMeKoN3fgnXlOkHiMTd9cDDFyUUx sYU16Kw7vqS6a6BVhZh9uhGQRc/9FLPWL2wPB8iOJOQrOHFd/uUAvjcNOWrygg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704375623; a=rsa-sha256; cv=none; b=WesUeSDUBxR5ir6hLbk0xtPFlEGriSUeLRAmkYUst845YfdXE82ewBvKR3hk1Abz74eSuH e9PZizaFZ3MmyWhEx8fBPWWRJZjSNhMpWkoWCR9s/fRWyN0PU7H963mW1jqPOFXsj5u7eB ZAkGpLFevp2l14muYMleeSw+lu2LVUuMb3ZeI847WSliNiPeveYaCgZ4pqFQ+82yFQyqtM J4thy31/sUc47F7028kFBG89GAqExsH9cTbD3GfylFudyCa6Zsq7y1YpkckToPDjGAbobu dMnCM/8PL+qujS0FPEVWdFx4Xjsn9YCGhrhvm8zZD3bC7hq/KY3kvHfJYi5nfw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T5SQH1ZCZzFSX; Thu, 4 Jan 2024 13:40:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 404DeN4o042067; Thu, 4 Jan 2024 13:40:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 404DeNJb042064; Thu, 4 Jan 2024 13:40:23 GMT (envelope-from git) Date: Thu, 4 Jan 2024 13:40:23 GMT Message-Id: <202401041340.404DeNJb042064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 904cd456f0f9 - main - targ: Handle errors from suword() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 904cd456f0f95c10fdb4c99a0118f30d23242dec Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=904cd456f0f95c10fdb4c99a0118f30d23242dec commit 904cd456f0f95c10fdb4c99a0118f30d23242dec Author: Mark Johnston AuthorDate: 2024-01-04 13:34:31 +0000 Commit: Mark Johnston CommitDate: 2024-01-04 13:39: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 --- 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 f1c01cab8638..034b528b415c 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -634,8 +634,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); } @@ -867,7 +867,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);