From nobody Tue Nov 29 01:11:01 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 4NLkmj6CWfz4jSVx; Tue, 29 Nov 2022 01:11:01 +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 4NLkmj5Y2Tz437T; Tue, 29 Nov 2022 01:11:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669684261; 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=3TSmbn2uoqKO2/QIn99WNsgNZjyeWzwl0g9QY7BoC08=; b=RqGJAok3qSym8Dx6knvkpx1tkjTBEyr92gm6fHFVzWNoc4BqqbkKPchpFQS3Yu4XDlop87 JfGaGxrrCOMdotb4+fWb1+SkkXlBfA/nNQqBj2gs7bCJf/cxxxy/aEE8Wl5EKZ8iT8XyCl 8X762DO9siST8G6h92Sr/ijCeJXDyyWXwcfJOgTE3a1DNoR4SnjKuwtFJWPuuq5qi4ok/z sp5qaTrRsxwmZOoSthpqSZBDYij9LjQvo5gl26DsD8C8vL5pa3JFumtKlSukHGrUjcd2N6 W0I0p8gNIi23IT9E/CdZ0DuU+uzi7jizFXG5ExDdXzPChTTp22Zc0CPU4w84+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669684261; 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=3TSmbn2uoqKO2/QIn99WNsgNZjyeWzwl0g9QY7BoC08=; b=tGBGGdnl7u/CpXNN+gZ3iXOFmoBkGgNKlD+5jBJjmyv6VOmJkSiScdP3PqWsJbkrA9Z86s fjLktLILUSBLgfZ9z6+z4OJ7Edr8+qD8IdfAOZmHBNfjY4gsUOm6VuvL8pIvVzNK6L5/Zn en62X0wWoQdwGD+g5QEgZcWCyzNK+OpkKBo0R3ZKucPTFa4ZQ6ZcGp6lPk5Tzwxeb84y6D BnrJ/k42nC/asau44hvehXmqPo5bH3XHO/HV94AmMvpa+aLwVyo6h5jhGOXbTzDVESmm3H nVKrRWtK7COF4Gdw2xV8heDfvrkyP/Rsi0Kg7wj29KOCOP/fZzRiC86hzO7XLw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669684261; a=rsa-sha256; cv=none; b=Ua2ow7+tY8TEm4KdPQrPt7JFeQimlCiJBNXkFvbszs6zxgg+h6c4iGEsGeUfcR36q/zVKc C4s4WHWS5d6gTVA5ViRkIdDiEVW1kZdsemzWMJfcUFwGOEwgWLnXZItyHS4On7VWgQsyyh YlfgrwlN46LdVDAgQlfxafkPVZdSc0/eYrxPhvtUTlY4To8YQ6f7/L0IrUxSejTKOIYkeA WU+dNP4CIUpGZ0+4T8mV4OKyIrH+DeC0gjK7Z1IyTv+l+k5BkvN9MBGsxfpVHs5lVgoGX/ nAdrQZqn8XRxodq3b5BcCrTPttVcjaCbsA3zD2j7855sXl08iUKDp/sTGA58nA== 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 4NLkmj4fs2zyJd; Tue, 29 Nov 2022 01:11:01 +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 2AT1B1Pu045360; Tue, 29 Nov 2022 01:11:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AT1B12l045359; Tue, 29 Nov 2022 01:11:01 GMT (envelope-from git) Date: Tue, 29 Nov 2022 01:11:01 GMT Message-Id: <202211290111.2AT1B12l045359@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: bc928800723b - main - bhyve: Avoid passing a possible garbage pointer to free(). 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc928800723b65daa9b005bec4ffd8ad8c781a09 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bc928800723b65daa9b005bec4ffd8ad8c781a09 commit bc928800723b65daa9b005bec4ffd8ad8c781a09 Author: John Baldwin AuthorDate: 2022-11-29 01:10:30 +0000 Commit: John Baldwin CommitDate: 2022-11-29 01:10:30 +0000 bhyve: Avoid passing a possible garbage pointer to free(). All of the error paths in pci_vtcon_sock_add free the sock pointer. However, sock is not initialized until part way through the function. An early error would pass stack garbage to free(). Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D37491 --- usr.sbin/bhyve/pci_virtio_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_virtio_console.c b/usr.sbin/bhyve/pci_virtio_console.c index 44d0da720226..46005d155f49 100644 --- a/usr.sbin/bhyve/pci_virtio_console.c +++ b/usr.sbin/bhyve/pci_virtio_console.c @@ -273,7 +273,7 @@ static int pci_vtcon_sock_add(struct pci_vtcon_softc *sc, const char *port_name, const nvlist_t *nvl) { - struct pci_vtcon_sock *sock; + struct pci_vtcon_sock *sock = NULL; struct sockaddr_un sun; const char *name, *path; char *cp, *pathcopy;