From owner-dev-commits-src-all@freebsd.org Sun Jun 6 20:45:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F3E3363DAE6; Sun, 6 Jun 2021 20:45:17 +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 4FypRK5Vybz3v6d; Sun, 6 Jun 2021 20:45:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8D9D91F6B; Sun, 6 Jun 2021 20:45:17 +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 156KjHSb052093; Sun, 6 Jun 2021 20:45:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156KjHU3052092; Sun, 6 Jun 2021 20:45:17 GMT (envelope-from git) Date: Sun, 6 Jun 2021 20:45:17 GMT Message-Id: <202106062045.156KjHU3052092@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: e755e2776ddf - main - ngatm: Handle errors from uni_msg_extend() 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: e755e2776ddff729ae4102f3273473aa33b00077 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 20:45:18 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e755e2776ddff729ae4102f3273473aa33b00077 commit e755e2776ddff729ae4102f3273473aa33b00077 Author: Mark Johnston AuthorDate: 2021-06-06 20:42:16 +0000 Commit: Mark Johnston CommitDate: 2021-06-06 20:44:47 +0000 ngatm: Handle errors from uni_msg_extend() uni_msg_extend() may fail due to a memory allocation failure. In this case, though, the message is freed, so callers shouldn't touch it. PR: 255861 Reviewed by: harti MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30611 --- sys/contrib/ngatm/netnatm/msg/uni_ie.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/contrib/ngatm/netnatm/msg/uni_ie.c b/sys/contrib/ngatm/netnatm/msg/uni_ie.c index e4b8310d88d9..3842279c63a1 100644 --- a/sys/contrib/ngatm/netnatm/msg/uni_ie.c +++ b/sys/contrib/ngatm/netnatm/msg/uni_ie.c @@ -216,7 +216,8 @@ uni_encode_msg_hdr(struct uni_msg *msg, struct uni_msghdr *h, { u_char byte; - (void)uni_msg_ensure(msg, 9); + if (uni_msg_ensure(msg, 9) != 0) + return -1; APP_BYTE(msg, cx->pnni ? PNNI_PROTO : UNI_PROTO); APP_BYTE(msg, 3); @@ -654,7 +655,8 @@ uni_encode_ie_hdr(struct uni_msg *msg, enum uni_ietype type, { u_char byte; - (void)uni_msg_ensure(msg, 4 + len); + if (uni_msg_ensure(msg, 4 + len) != 0) + return -1; *msg->b_wptr++ = type; byte = 0x80 | (h->coding << 5);