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 770D517C77 for ; Thu, 27 Feb 2025 20:01: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=1740686478; cv=none; b=ahv+sNTIYeXoYkd/T+IjExrGqJiVo0gMQRQCgBKoPFTd+t6YLVE6f+tgPxehGUNkGpDz0Lt+pQSowpOrunSjRQmfKe/IcYgS5JkEMJx5oR7MC+S7cDrY4GUsxuPqKIaXt4izjfvf3ya0HGcGuc0+c1bt/09R2+MdzbFHaQ4pDP4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740686478; c=relaxed/simple; bh=Mk2ugXJv0XZMmeCRilrYVnZKcQTeEMZTDOcgLm8wgDU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=O0jrU5G7tjJaWOwGpL0d/us17LIhbLOhqEIG/3vZZ+G9YIzjez7+mNKoOLRq6D1+yIkSZlBAzHMNHaUvidF2rnyRDNG3KeS6i7/5qGINBOdqaHKxYRkEVC8oHWrLOVOm6AqvCstB4NPGl3Sh6VmoHhHHDVrWPQ9zUletkmF8rVI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=EopovaMT; 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="EopovaMT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D8F0C4CEDD; Thu, 27 Feb 2025 20:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740686477; bh=Mk2ugXJv0XZMmeCRilrYVnZKcQTeEMZTDOcgLm8wgDU=; h=From:To:Cc:Subject:Date:Reply-to:From; b=EopovaMTRZyPUoTm3EU4QCIfF+Gq338V40YA4nEXlB51wR4UPcICQrWACwjXLKS8q dK6WKNWObq9VXwqvbk5E98b57k/Y7J5lfStG6dgKJ0Lmf3qI1CS5cEkUdOqW1YfZdx ohZSvqsZ1OR5TzMItJ97we+bi64a2c+HdZckMjoQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-21810: driver core: class: Fix wild pointer dereferences in API class_dev_iter_next() Date: Thu, 27 Feb 2025 12:00:04 -0800 Message-ID: <2025022754-CVE-2025-21810-0c14@gregkh> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3295; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Mk2ugXJv0XZMmeCRilrYVnZKcQTeEMZTDOcgLm8wgDU=; b=owGbwMvMwCRo6H6F97bub03G02pJDOkHjlgleio9iVc4c2beZZMypYUrfXj6u50NJqYLGlyYd a4naGJqRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEyk1INhftik5wFP5l6RvhP8 tKLnzPOEjyZn3zDM011w5N4cF/ZKznfLHx1dPs/4uk7gRQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: driver core: class: Fix wild pointer dereferences in API class_dev_iter_next() There are a potential wild pointer dereferences issue regarding APIs class_dev_iter_(init|next|exit)(), as explained by below typical usage: // All members of @iter are wild pointers. struct class_dev_iter iter; // class_dev_iter_init(@iter, @class, ...) checks parameter @class for // potential class_to_subsys() error, and it returns void type and does // not initialize its output parameter @iter, so caller can not detect // the error and continues to invoke class_dev_iter_next(@iter) even if // @iter still contains wild pointers. class_dev_iter_init(&iter, ...); // Dereference these wild pointers in @iter here once suffer the error. while (dev = class_dev_iter_next(&iter)) { ... }; // Also dereference these wild pointers here. class_dev_iter_exit(&iter); Actually, all callers of these APIs have such usage pattern in kernel tree. Fix by: - Initialize output parameter @iter by memset() in class_dev_iter_init() and give callers prompt by pr_crit() for the error. - Check if @iter is valid in class_dev_iter_next(). The Linux kernel CVE team has assigned CVE-2025-21810 to this issue. Affected and fixed versions =========================== Issue introduced in 6.4 with commit 7b884b7f24b42fa25e92ed724ad82f137610afaf and fixed in 6.6.76 with commit f4b9bc823b0cfdebfed479c0e87d6939c7562e87 Issue introduced in 6.4 with commit 7b884b7f24b42fa25e92ed724ad82f137610afaf and fixed in 6.12.13 with commit 1614e75d1a1b63db6421c7a4bf37004720c7376c Issue introduced in 6.4 with commit 7b884b7f24b42fa25e92ed724ad82f137610afaf and fixed in 6.13.2 with commit 5c504e9767b947cf7d4e29b811c0c8b3c53242b7 Issue introduced in 6.4 with commit 7b884b7f24b42fa25e92ed724ad82f137610afaf and fixed in 6.14-rc1 with commit e128f82f7006991c99a58114f70ef61e937b1ac1 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-2025-21810 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/base/class.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/f4b9bc823b0cfdebfed479c0e87d6939c7562e87 https://git.kernel.org/stable/c/1614e75d1a1b63db6421c7a4bf37004720c7376c https://git.kernel.org/stable/c/5c504e9767b947cf7d4e29b811c0c8b3c53242b7 https://git.kernel.org/stable/c/e128f82f7006991c99a58114f70ef61e937b1ac1