From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:10:28 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F59F3B4630; Mon, 24 Aug 2020 08:10:28 +0000 (UTC) (envelope-from tuexen@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlDN1NVxz4JxS; Mon, 24 Aug 2020 08:10:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12D4A15544; Mon, 24 Aug 2020 08:10:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07O8AR1x058688; Mon, 24 Aug 2020 08:10:27 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8ARR2058687; Mon, 24 Aug 2020 08:10:27 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240810.07O8ARR2058687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364612 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:10:28 -0000 Author: tuexen Date: Mon Aug 24 08:10:27 2020 New Revision: 364612 URL: https://svnweb.freebsd.org/changeset/base/364612 Log: MFC r362178: Allocate the mbuf for the signature in the COOKIE or the correct size. While there, do also do some cleanups. Modified: stable/12/sys/netinet/sctp_output.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Mon Aug 24 08:08:12 2020 (r364611) +++ stable/12/sys/netinet/sctp_output.c Mon Aug 24 08:10:27 2020 (r364612) @@ -3831,8 +3831,6 @@ sctp_add_cookie(struct mbuf *init, int init_offset, struct mbuf *copy_init, *copy_initack, *m_at, *sig, *mret; struct sctp_state_cookie *stc; struct sctp_paramhdr *ph; - uint8_t *foo; - int sig_offset; uint16_t cookie_sz; mret = sctp_get_mbuf_for_msg((sizeof(struct sctp_state_cookie) + @@ -3896,24 +3894,20 @@ sctp_add_cookie(struct mbuf *init, int init_offset, break; } } - sig = sctp_get_mbuf_for_msg(SCTP_SECRET_SIZE, 0, M_NOWAIT, 1, MT_DATA); + sig = sctp_get_mbuf_for_msg(SCTP_SIGNATURE_SIZE, 0, M_NOWAIT, 1, MT_DATA); if (sig == NULL) { /* no space, so free the entire chain */ sctp_m_freem(mret); return (NULL); } - SCTP_BUF_LEN(sig) = 0; SCTP_BUF_NEXT(m_at) = sig; - sig_offset = 0; - foo = (uint8_t *)(mtod(sig, caddr_t)+sig_offset); - memset(foo, 0, SCTP_SIGNATURE_SIZE); - *signature = foo; - SCTP_BUF_LEN(sig) += SCTP_SIGNATURE_SIZE; + SCTP_BUF_LEN(sig) = SCTP_SIGNATURE_SIZE; cookie_sz += SCTP_SIGNATURE_SIZE; ph->param_length = htons(cookie_sz); + *signature = (uint8_t *)mtod(sig, caddr_t); + memset(*signature, 0, SCTP_SIGNATURE_SIZE); return (mret); } - static uint8_t sctp_get_ect(struct sctp_tcb *stcb)