From nobody Mon Dec 09 15:45:05 2024 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 4Y6R5F43pkz5gRpR; Mon, 09 Dec 2024 15:45:05 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y6R5F3BXXz4PBt; Mon, 9 Dec 2024 15:45:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733759105; 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=A2KDw4iEBnrzUdgohvaxPHalSydkH/jJrZZ41O0FcSo=; b=NJ1d5GaTfIpLe1hgAJ0aZvZ5hBFD9lTvJs3kfPIS/Y5n8ROhHwGf+vEReJ9iUh82syM/x8 Aze1rd7PgQ37oL+jsMLeee2qGCXDK6TIU9CEhUbuHcqOy9x0MJNECPuGiazaZJKMulgtVj uATRjAgL6OVd62mA5OiUy00Z0tq+K4jzbe8Fa48jrWkhuVa09tiV92iWTIQfhQbFl8W2ma 28Ph/z19SWUAu1mZfMD/9EiCeIbJSYshtpcQ3may9bktcz66DYyiLVZGugck0JYfz5RAEP xZmilHkZGOsfkHgPbZg3col3LYAwoOM9q7hv4Dr89q3KdrVJZrvKXwK4iH+Tww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733759105; 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=A2KDw4iEBnrzUdgohvaxPHalSydkH/jJrZZ41O0FcSo=; b=tuu9n/2mr78LZ32kIZ+Y1DgkD8bOVOyemaihi8zkN/SZe9Kh47O93oiyQ/4Psf0NexCFNx FzBztSfoubzBmssHzR1VkJ1fClqkI7TFLxJhHkgAd2UFEOfPU6s1HqGFC7IaZdUWo+MNef kWPx0iGBsiSSEPla7QzTcnJQ4DOmP4lvlEtmowBDFuft+VQyA+jIRNGGZBY0BSz3oapOZW Vg2tYAFTiUePu5oHab43MAu2j7v5sIykpX/NC/nK6eotjAQc8iv0loFN3hoG8BXOTjgqN8 GwZcDM1MdmviyWuA17PIQDVN6/BJ6hfgSLJhRt/m/uDpu1ieHY9GDOXHlCUNoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733759105; a=rsa-sha256; cv=none; b=dMyGeTutNBToM//KUUhM5xUQqpSTBYjfBXU1ix/LWkbpSVVm2SWobdySpTbdzjZJhwD2It fkLX1bg8BolrcuHXZo7PXCmXMBTbyAkhACu5SU9crloQ/rqDkI5ojR+B2e7wgkHx3JSUOz qw2ucWgKOIeEBJgiW/qHenzGX6AKVh2x437VTHCpo5MNGd6dqeP7NfmATp7U1+Z0fVacBw 7Td3EyB4UVT3rOpKPzyVn6FxTOK3bRzOO93ZV5R0tbiZSOoA48KBdapK/jMkualnwMe2Ij dQkaCFzS8o3BvXDTJllHu9ORLoblaMUqdto7VGTjLCi13fQTJICcome1EwN6Zw== 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 4Y6R5F2psRzk8Y; Mon, 9 Dec 2024 15:45:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B9Fj5Qe062508; Mon, 9 Dec 2024 15:45:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B9Fj5Qu062505; Mon, 9 Dec 2024 15:45:05 GMT (envelope-from git) Date: Mon, 9 Dec 2024 15:45:05 GMT Message-Id: <202412091545.4B9Fj5Qu062505@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: bb8c68b25333 - main - acpi_gpiobus: Fix cleanup on set flags failure 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bb8c68b25333638a20838500ccffee23b4291427 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=bb8c68b25333638a20838500ccffee23b4291427 commit bb8c68b25333638a20838500ccffee23b4291427 Author: Andrew Turner AuthorDate: 2024-12-09 15:14:13 +0000 Commit: Andrew Turner CommitDate: 2024-12-09 15:44:30 +0000 acpi_gpiobus: Fix cleanup on set flags failure When GPIOBUS_PIN_SETFLAGS fails we called gpiobus_free_ivars to clean up the contents of the ivar, then would free the ivar. This lead to a use-after-free as the ivar had already been set on the child so gpiobus_child_deleted would try to free it again. Fix this by removing the early cleanup and letting gpiobus_child_deleted handle it. Fixes: c9e880c0ceef ("gpiobus: Use a bus_child_deleted method to free ivars for children") Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47670 --- sys/dev/gpio/acpi_gpiobus.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/dev/gpio/acpi_gpiobus.c b/sys/dev/gpio/acpi_gpiobus.c index e766c25e5336..be3889f6a89b 100644 --- a/sys/dev/gpio/acpi_gpiobus.c +++ b/sys/dev/gpio/acpi_gpiobus.c @@ -203,8 +203,6 @@ acpi_gpiobus_enumerate_aei(ACPI_RESOURCE *res, void *context) for (int i = 0; i < devi->gpiobus.npins; i++) { if (GPIOBUS_PIN_SETFLAGS(bus, child, 0, devi->flags)) { - gpiobus_free_ivars(&devi->gpiobus); - free(devi, M_DEVBUF); device_delete_child(bus, child); return (AE_OK); }