From nobody Thu Jan 11 14:32:41 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 4T9nFP5ctmz567mw; Thu, 11 Jan 2024 14:32:41 +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 4T9nFP3YJ4z4T7l; Thu, 11 Jan 2024 14:32:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704983561; 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=VFGW/jHclVO0Nt7T3uHiShlf6am8BLQrtDOxn/YaKRw=; b=EHLorSwPWuYGCVK7I5CL7Zpcp5RaPD4q3SS4mcdCHpDX2NiiZHQmiECcU2osA1DuGOJgYb mYmL+cFxJ2B07KudvFUAmx2l27EGNoRfsdu2JB9U9CGt9zKpuw7CFTI9wxyCj5AsKrpcxl WNAnEB3lau9fub+ObZAPMTm7lmVEUcsRxViClss/dE1dnbJF444w5XLfIXtPrBcggcPhKU eqdieIUtCZ+rjxfe0dhoFQJjQytWd01VqdRR/6rtmELPV4ETAqGJzQrop2V+T/XkWJ/Yr3 IQNZvFptkdWrMdvkTAANzPw9r5OfDXCay06JjIlsTjUOLDB9MH8EAxrOxCWAzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704983561; 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=VFGW/jHclVO0Nt7T3uHiShlf6am8BLQrtDOxn/YaKRw=; b=CoIZN2RQAWDEXzIq9MsMTwCoglbyGLud8577+36JkgInqAZWUDkx2FBoB7ox/hrCFRYTGm 2D5I9EBrq0JvWTtRbFMu+fyYdXRk8Pq/teVtMwbRQauF3tn6s1gd+5we0+S1aG9tFreBxB YiI4/xh/RuMSZDsguD8kpN/ljupJwXfIpEEOFv0ePer3yPMkByjSTgcm3kulaa+MdfzHEA 0VsEJqw2mLc+/3kDC36ClPVo88sB1xZMEhJuxsVetZzatbuL7JshNv1rW4p/jUI0hqFfvs ip5KtfqoIBwYzZO2SO6P0PuLsDEHH2PNp4XKmW9QWnQsK9jc3DkZqGVCrFc1fw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704983561; a=rsa-sha256; cv=none; b=nDOyK2oNki3jjZXunyi8PhovpkJfbQB/nvZC6FD5XUxd3sJ4RjepqYq4JL+yaUqM92zrEQ khYi9A+sEnY1Bl8aKQIU4wN6Z3c2msWL/a+2uSCBNtjzujzxVNHcAw/NUf9ZksXZ0Zli9i XiLFvo9xi/QEy+cO8L5Nbu1GoIRH1L0kZJcHPXvId1ChMviNB6HacysMDXq2kPatm7gk73 PgB/VOl9srP1c9ytEmUOJAbOXTfbp1vIAtoa58X2yZDGOufggh+m0Sb+dh/K6B7l4Mkegf 4ssOrQmCpEzQpOB3uO14B5ZGKVFQZNc1+PtYD3qB1g15S0D4hIpi5FYmSjObFA== 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 4T9nFP2dPPzN63; Thu, 11 Jan 2024 14:32:41 +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 40BEWf2j024455; Thu, 11 Jan 2024 14:32:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40BEWf21024452; Thu, 11 Jan 2024 14:32:41 GMT (envelope-from git) Date: Thu, 11 Jan 2024 14:32:41 GMT Message-Id: <202401111432.40BEWf21024452@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 185634d86d96 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 185634d86d96b836336862d80e4e454c91e3ad99 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=185634d86d96b836336862d80e4e454c91e3ad99 commit 185634d86d96b836336862d80e4e454c91e3ad99 Author: Mark Johnston AuthorDate: 2024-01-04 13:34:31 +0000 Commit: Mark Johnston 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);