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 1F4851FAC4B for ; Mon, 21 Oct 2024 18:05:43 +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=1729533943; cv=none; b=NAUMXCLduCv373Njxi90a4hncLU+meWBxj2B7GZWhS6CIvF9v/hVHYeg48Qc7wsgS0ueniQCkSYdbU7A6yKgwYVQAKRimHAMIG7D4ZeC1wsi5v7kvoaySkpfaiMz8tvikTziM5DvX1EnIeJtpmKkvTjPrsgefX0MJAUmHbUi+sU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533943; c=relaxed/simple; bh=O3C0ZDvdKM7Amm1/k1EWTmjMMmonFADna1qioTqIVjc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Bq8jcWCWO8JJUx9FPChRuF7/KD5+9WNlu8qTUb6FjeHS2MFZEkH5cH56U239VRAnYCSR6phE1FRgxDqNWD50EG0pBfsASu6UqZC7P9WMVabEvbfnEM5VKW1cIgd9wg3CzcPRpX4x9dkKyFgDiEeqAOhmJaZ3C0V2yhgF9J1tVL8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XNSyPbpG; 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="XNSyPbpG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90AC1C4CEC3; Mon, 21 Oct 2024 18:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1729533943; bh=O3C0ZDvdKM7Amm1/k1EWTmjMMmonFADna1qioTqIVjc=; h=From:To:Cc:Subject:Date:Reply-to:From; b=XNSyPbpGlzgTPZNvDktR4nwffsqhoKUlbazaacHj/6ATqXUTocBsrzL+9eJ3iUsV1 oPLqOc8dyTK5q4iSWqPGQ5ljU1vIwhhErKQ8kbmm+C48YUQdi7cawOGLlmUuFyOrAk Cxjav7bYDiRteJkA8P9AFMySRnrJrZhGp4fcmbAU= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-49940: l2tp: prevent possible tunnel refcount underflow Date: Mon, 21 Oct 2024 20:02:28 +0200 Message-ID: <2024102127-CVE-2024-49940-1c88@gregkh> X-Mailer: git-send-email 2.47.0 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=2487; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=O3C0ZDvdKM7Amm1/k1EWTmjMMmonFADna1qioTqIVjc=; b=owGbwMvMwCRo6H6F97bub03G02pJDOli077/l7B/+eDeefelOu/2mG62F5E/rfjxb/sEX7dbJ /Zq/flyrCOWhUGQiUFWTJHlyzaeo/srDil6GdqehpnDygQyhIGLUwAmcmERw3ynd8xHW1lOS/3V DelWPtGn0Jsxr5Rhnu6y30vla7fF1D/dxvQ+7naGIOc1TQA= 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: l2tp: prevent possible tunnel refcount underflow When a session is created, it sets a backpointer to its tunnel. When the session refcount drops to 0, l2tp_session_free drops the tunnel refcount if session->tunnel is non-NULL. However, session->tunnel is set in l2tp_session_create, before the tunnel refcount is incremented by l2tp_session_register, which leaves a small window where session->tunnel is non-NULL when the tunnel refcount hasn't been bumped. Moving the assignment to l2tp_session_register is trivial but l2tp_session_create calls l2tp_session_set_header_len which uses session->tunnel to get the tunnel's encap. Add an encap arg to l2tp_session_set_header_len to avoid using session->tunnel. If l2tpv3 sessions have colliding IDs, it is possible for l2tp_v3_session_get to race with l2tp_session_register and fetch a session which doesn't yet have session->tunnel set. Add a check for this case. The Linux kernel CVE team has assigned CVE-2024-49940 to this issue. Affected and fixed versions =========================== Fixed in 6.11.3 with commit f7415e60c25a Fixed in 6.12-rc1 with commit 24256415d186 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-2024-49940 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: net/l2tp/l2tp_core.c net/l2tp/l2tp_core.h net/l2tp/l2tp_netlink.c net/l2tp/l2tp_ppp.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/f7415e60c25a6108cd7955a20b2e66b6251ffe02 https://git.kernel.org/stable/c/24256415d18695b46da06c93135f5b51c548b950