Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D6D13C277B for ; Fri, 1 May 2026 14:17:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777645037; cv=none; b=APQmlVgGy4OZtFsBf26NLt5wb+W+LZKPdqTrS60sSef1PrT2Ax2FmOX+xk90tf0VCkNUex+IS7/ZThxpjHNb94EWRC+H0YztM9v7JGephF2KzC4Ryr+QJqWUeSFXs4r4n5vAWq9oC0S99W3eyOkbZBLpN2u82WQERSJ58QwBcCw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777645037; c=relaxed/simple; bh=W/sCSSUBy2mkdyRk27nk3nVD1uGHKM5ghhQYAUOTw/U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SYmKjcE7ZrjjK24Aq08/imuCgcm+8evwvKPkMvdu8QoRBuBPAWZxVk0ZWb7+3oSfP0/9mlGCjWnuy0naCudmpdnSJwwmGJ1shab5YlGDlgOc0M0IdiVkspxcg69hH525cQlFIBPyDKkOK9QM2zTne7RnWWrZqCPXWXfKjeMeS8o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eFcYcS22; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eFcYcS22" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1394AC2BCB4; Fri, 1 May 2026 14:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777645037; bh=W/sCSSUBy2mkdyRk27nk3nVD1uGHKM5ghhQYAUOTw/U=; h=From:To:Cc:Subject:Date:Reply-To:From; b=eFcYcS22xu+pRk/QbaXn0nIIJaIUCFMSHV+z8YW3tet+MjiCsSCwyGs2V84w761Rt WSXziAXuhQChzZE2uMsuamJSM+lhbgtmGC/J3avisvtvZMvX7KjROWtpfFEMyyY++9 gOhCZxasSOsTZiso2AveLm6vBN78T1MC4jFAmWJU= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-31732: gpio: Fix resource leaks on errors in gpiochip_add_data_with_key() Date: Fri, 1 May 2026 16:14:43 +0200 Message-ID: <2026050137-CVE-2026-31732-c3a5@gregkh> X-Mailer: git-send-email 2.54.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2872; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=WqYNjYc4msDNnm6XnKu3aY657OszkbTO70GBTSjR0ig=; b=owGbwMvMwCRo6H6F97bub03G02pJDJlftvpaMYe3vkrZ8bFEeLp/QmKb6vO7Sh1Wmu2yCxY9Z ak8F3S+I5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACZi2MYwz+rPviub+I7VJWYp n+Vw/nygQ3/taoY5/Csfmv5faaP28nslR8QJ+ZIJU+qfAQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: gpio: Fix resource leaks on errors in gpiochip_add_data_with_key() Since commit aab5c6f20023 ("gpio: set device type for GPIO chips"), `gdev->dev.release` is unset. As a result, the reference count to `gdev->dev` isn't dropped on the error handling paths. Drop the reference on errors. Also reorder the instructions to make the error handling simpler. Now gpiochip_add_data_with_key() roughly looks like: >>> Some memory allocation. Go to ERR ZONE 1 on errors. >>> device_initialize(). gpiodev_release() takes over the responsibility for freeing the resources of `gdev->dev`. The subsequent error handling paths shouldn't go through ERR ZONE 1 again which leads to double free. >>> Some initialization mainly on `gdev`. >>> The rest of initialization. Go to ERR ZONE 2 on errors. >>> Chip registration success and exit. >>> ERR ZONE 2. gpio_device_put() and exit. >>> ERR ZONE 1. The Linux kernel CVE team has assigned CVE-2026-31732 to this issue. Affected and fixed versions =========================== Issue introduced in 6.9 with commit aab5c6f200238ac45001bec3d5494fff8438a8dc and fixed in 6.18.22 with commit f0cf9c7b7c281956cc0dec163132cd96f76e1d60 Issue introduced in 6.9 with commit aab5c6f200238ac45001bec3d5494fff8438a8dc and fixed in 6.19.12 with commit fb4584d2b324c522404c733c65840a1a6519ada8 Issue introduced in 6.9 with commit aab5c6f200238ac45001bec3d5494fff8438a8dc and fixed in 7.0 with commit 16fdabe143fce2cbf89139677728e17e21b46c28 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2026-31732 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/gpio/gpiolib.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/f0cf9c7b7c281956cc0dec163132cd96f76e1d60 https://git.kernel.org/stable/c/fb4584d2b324c522404c733c65840a1a6519ada8 https://git.kernel.org/stable/c/16fdabe143fce2cbf89139677728e17e21b46c28