From nobody Sat May 28 15:15:44 2022 X-Original-To: dev-commits-src-main@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 453241B59812; Sat, 28 May 2022 15:15:45 +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 4L9QGn1PqXz3Q2S; Sat, 28 May 2022 15:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653750945; 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=8uq78gJsFmAH2aweDT/LpewE9MSDD6rKLglWyEY7WRE=; b=sxcw1othl2bKVywsJpekiHZomU+or8sbQiizXEOLHI6UfF5G6uVeoBkMwlWL3laGOV4War pirw6lLOMyqG22fWpWqToSa8qxA22ubFzvcOkzy6O5AYJgv12/hk3LSuqRrF5p6Roavx6j MUhh+SIRgC/9B6DnTvfqHu/+SkVImCfZw9zbjylM025gevK8+mc6cVqDxVQHDmFWJ3j2Y9 etUGNWuaNguvcp0REggZ471SV6Nw2Tl4qm7IN8ShjwqinhPYZ13JcGLcBMPhfPgHXw53gR E4ClJXgau8amL7etrGvBP/xSCgm/iyWWqG/9gaYJAN9aLwfDnOj831s6MxLruw== 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 101B3113BD; Sat, 28 May 2022 15:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 24SFFjmN042695; Sat, 28 May 2022 15:15:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24SFFiie042694; Sat, 28 May 2022 15:15:44 GMT (envelope-from git) Date: Sat, 28 May 2022 15:15:44 GMT Message-Id: <202205281515.24SFFiie042694@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: f21168e61404 - main - sctp: cleanup of error paths List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f21168e61404eacc6ad58a74ed9af92a8e5072df Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653750945; 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=8uq78gJsFmAH2aweDT/LpewE9MSDD6rKLglWyEY7WRE=; b=opqIZREuF9xcyuNMuOfrhBa+yd+6MnjnwEVi9Ku7Frde3uxT0zFoRO/aNlDCbpyEjbiET9 Qc55SUmNZN+7GylTsKMOKpIcx/VKsz0e11HNOZUnc0VfPINNgb3l/PSapNyu3Ck2gv1H72 cRu9Wd3AhWHehNUA2ONsm0W1/T1EcBy3iITQZo9+8YijgFkqQcoqf+w+W4WnWabS6VuoV4 Hwj5OVpbKSuDF1BCluIgP9hstD79MK0ZhMpGROUK0WV0Ku9DznRIRWV0LspViJ476xu6uM KYt0S1YpT5QY8ajQC2Q8AfpxynKdJzqTPunV7iBnrbD1RipVdypnLimZ1E0fSw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1653750945; a=rsa-sha256; cv=none; b=sXGejZpYR+1YQFp5jbXnmcqURRO0a9cp4lqwrnmha7gIDOs3B5kl/vGeJdJn+HSAvTSY2E v19NZ5xkg+fMzRRKRCrjEBXRSq7Fu9zTChekADHcFOtPIVp3iQXKbJu+zhhPYUDsuv+KKU FCkc4NK4ZZYcpMRYFcPnbdvf3PvMDm4gqE0J4E60ZGI+aPMNQFWZyHEddUmz9bMG9CteAS pR8eN3O4MdEX3wm5ZyD1d4HRcnMb8BfSLa656p0y0kdNPyOgO2C6oBSnicCRQ3ohk6fNwU t+aODZqudo9Q9nY+2e5oDj/n+rKyiaNPe+bY5Mn3S1tAdSSMysWteYmatRPK4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=f21168e61404eacc6ad58a74ed9af92a8e5072df commit f21168e61404eacc6ad58a74ed9af92a8e5072df Author: Michael Tuexen AuthorDate: 2022-05-28 15:15:14 +0000 Commit: Michael Tuexen CommitDate: 2022-05-28 15:15:14 +0000 sctp: cleanup of error paths MFC after: 3 days --- sys/netinet/sctp_output.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index b54e71a0f477..b8844fdc0295 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -12250,8 +12250,9 @@ sctp_copy_resume(struct uio *uio, m = m_uiotombuf(uio, M_WAITOK, max_send_len, 0, (M_PKTHDR | (user_marks_eor ? M_EOR : 0))); if (m == NULL) { - SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOBUFS); - *error = ENOBUFS; + /* The only possible error is EFAULT. */ + SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EFAULT); + *error = EFAULT; } else { *sndout = m_length(m, NULL); *new_tail = m_last(m); @@ -12264,13 +12265,12 @@ sctp_copy_one(struct sctp_stream_queue_pending *sp, struct uio *uio, int resv_upfront) { - sp->data = m_uiotombuf(uio, M_WAITOK, sp->length, - resv_upfront, 0); + sp->data = m_uiotombuf(uio, M_WAITOK, sp->length, resv_upfront, 0); if (sp->data == NULL) { - SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOBUFS); - return (ENOBUFS); + /* The only possible error is EFAULT. */ + SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EFAULT); + return (EFAULT); } - sp->tail_mbuf = m_last(sp->data); return (0); } @@ -12321,7 +12321,6 @@ sctp_copy_it_in(struct sctp_tcb *stcb, sp->context = srcv->sinfo_context; sp->fsn = 0; (void)SCTP_GETTIME_TIMEVAL(&sp->ts); - sp->sid = srcv->sinfo_stream; sp->length = (uint32_t)min(uio->uio_resid, max_send_len); if ((sp->length == (uint32_t)uio->uio_resid) && @@ -12519,13 +12518,13 @@ sctp_lower_sosend(struct socket *so, error = EINVAL; goto out_unlocked; } - atomic_add_int(&inp->total_sends, 1); if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && SCTP_IS_LISTENING(inp)) { /* The listener can NOT send. */ error = EINVAL; goto out_unlocked; } + atomic_add_int(&inp->total_sends, 1); if (srcv != NULL) { sinfo_flags = srcv->sinfo_flags;