From nobody Wed Feb 01 22:59:08 2023 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 4P6cmX5Nw3z3cGmR; Wed, 1 Feb 2023 22:59:08 +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 4P6cmX4xmNz3DvR; Wed, 1 Feb 2023 22:59:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675292348; 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=FDsOJ6PL+VNk1hFoq8oAK4cKHifE0EvF0BTLWV/MXTs=; b=MYIoHkL699Nb0yoVFOz4MDSi0q6Ejswf+qbY2R6P7Dq+SaT5X92Bi/mN2UVnvOIfaFXUuu 4sEMRGr5y4hmmDR1w77BW/HTxj9AafUE20ue+JxVpY+CUA/wX85G6F9cCZDuYfBdOdj1wt VQGeqzuqU3BEIgi8FNrqSn7NqnnmDOVf6OQDceL3/65cHNNbC6Ns4fVNxLsrar6gz8jpL2 k59t5pkPOR2sbLV2HGVXJyS7t7TVfYOWoTPMIMb1rwRYmJtC7hkF6tRH7sTrrHZIOmPFaA 97EKiTdSnnV+FyUY+15DrjDyC0qo0T3gCLgtYsQwpQnZtiuLcD/UEky9955POA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675292348; 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=FDsOJ6PL+VNk1hFoq8oAK4cKHifE0EvF0BTLWV/MXTs=; b=WA8ZDSBdRJ4e6rnLF4x0/1fVz5su9+oVQFow2U+2kZGby4xc7rgh+B6j2ogTYC89+ZDyNe Mame6aeUY/vXp62+di6r1+DAHZWJC63qTtsIjpNFNiBcp1tdT/LGeCvygKRqcL/Dor6wxJ iB9mM39jM8bVZa39VgTTN5AHdFxdTiBEA8CiHB3BT8TVugoKEfTzUZiOXjl+/13PLcVEop kcpXlYvKL75tPbxWrnxUjsVZEnPBVDlvJJ6T0nUXvi2KDa2AtfN8xUNI6G0bYTpj1wg4XW mRpjRrSxCUgnVZVdBUodRAbIoJPHCI3PGSty3eUwF+oAWuU7ej0ejbb3zRSg3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675292348; a=rsa-sha256; cv=none; b=LBIkclmCFvX6IqIlORpzRQBXIryHO6UWoyTY2gG0V6bx3SLYckKOUjGHCGCKZfHXuLrHOk jAZFEMaOtiAe6D+fjGEROcMJ3eO40VCOcWrAgyK4NrUVzf3lSq+uAaeReHmgE5ABZMgNbu gZksw4/O+gZS+4FOWRREIhilWL7zKYLuvfrFaIkXQr/8AFU3q9GQSHHtoWjz8j6+UJKrI9 k0nqQurp5g/mnZiWld5qyfdCMMDVoN5sMrBGnWjmADnu6uVy2x8edsXjl+NstMzTTM/Jks BtcnswopQ1Kd+d97i6ZF/13ykqhXoIWAFX6XzlDXYSH+axm3Pu6ZdUWUFzOv3Q== 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 4P6cmX41YNzXFF; Wed, 1 Feb 2023 22:59:08 +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 311Mx83W018071; Wed, 1 Feb 2023 22:59:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 311Mx8Gu018070; Wed, 1 Feb 2023 22:59:08 GMT (envelope-from git) Date: Wed, 1 Feb 2023 22:59:08 GMT Message-Id: <202302012259.311Mx8Gu018070@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 7e995a75013c - stable/13 - sctp: cleanup of error paths 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: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7e995a75013c11adc1208d9741fca3a09a54be43 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=7e995a75013c11adc1208d9741fca3a09a54be43 commit 7e995a75013c11adc1208d9741fca3a09a54be43 Author: Michael Tuexen AuthorDate: 2022-05-28 15:15:14 +0000 Commit: Michael Tuexen CommitDate: 2023-02-01 22:58:46 +0000 sctp: cleanup of error paths (cherry picked from commit f21168e61404eacc6ad58a74ed9af92a8e5072df) --- 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 4de6fe4a8b3e..45a27e5d2e1d 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -12248,8 +12248,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); @@ -12262,13 +12263,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); } @@ -12319,7 +12319,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) && @@ -12517,13 +12516,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;