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 498BE199242 for ; Tue, 16 Jul 2024 11:48:06 +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=1721130486; cv=none; b=eeuCQUc8EtUFsfn40ASbEBem2nV+y0ugftZF7484AswNySZkW8LjMXydULUMMBWmvv0gOABFifGY6XyrgSs2vzaHOvJxuV5p+JuRbqVFs6a/kJl42ArAJJoqaRHJYX5tHROsogJ5xWRRroWD/XLMINaV4GlF4PS9D4TprKt8oP0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721130486; c=relaxed/simple; bh=LlkeGGTdHFmjoTknS3IGcwF4CMxfJnTTXNte99cqV+8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=g4emjZa1chyigSWYJ+amu6Df6u8Non9iSe2f0rmpDwFXjAyAexYck8KybBsbKlHFr4kLktaMTfHtOYbuc3atuh+sbvxZHHG8oiAQZyJKfTAkCtofks/wV3P4vXtseQCsV99exKDLmG35qDfpcxVeTF7kV6Uk48y9K6onhKX4JBc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fIOhmi/s; 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="fIOhmi/s" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C05FDC116B1; Tue, 16 Jul 2024 11:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1721130486; bh=LlkeGGTdHFmjoTknS3IGcwF4CMxfJnTTXNte99cqV+8=; h=From:To:Cc:Subject:Date:Reply-to:From; b=fIOhmi/s8wCLzd8I89ilzn6ynLLLxCLsJYfo5u0NNoZsS8N/nXtTt5hUsfVRE6CNx tMdLqdubAdxfMYK4eR+KU5z12H6+IyjEh/MbdzoqPZQFWI7GQ34VDYbzUdmKUtScaW 4PfD2r6uX3HvqNhkXIx8/371A1nhkz9pW/jErjsk= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-48830: can: isotp: fix potential CAN frame reception race in isotp_rcv() Date: Tue, 16 Jul 2024 13:46:22 +0200 Message-ID: <2024071652-CVE-2022-48830-8dbf@gregkh> X-Mailer: git-send-email 2.45.2 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=3331; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=LlkeGGTdHFmjoTknS3IGcwF4CMxfJnTTXNte99cqV+8=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnTYgsr3i9+cfKZcxqrV1kc73aWkw8/W7zp/T0jYaejh t0Hw49XOmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAid+8yzK/y6//VeOXpB0vV XP+UV3k2niXxRgzz8/8EKUw6rTWJ9XOI1SqmC7WKr7J/AQA= 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: can: isotp: fix potential CAN frame reception race in isotp_rcv() When receiving a CAN frame the current code logic does not consider concurrently receiving processes which do not show up in real world usage. Ziyang Xuan writes: The following syz problem is one of the scenarios. so->rx.len is changed by isotp_rcv_ff() during isotp_rcv_cf(), so->rx.len equals 0 before alloc_skb() and equals 4096 after alloc_skb(). That will trigger skb_over_panic() in skb_put(). ======================================================= CPU: 1 PID: 19 Comm: ksoftirqd/1 Not tainted 5.16.0-rc8-syzkaller #0 RIP: 0010:skb_panic+0x16c/0x16e net/core/skbuff.c:113 Call Trace: skb_over_panic net/core/skbuff.c:118 [inline] skb_put.cold+0x24/0x24 net/core/skbuff.c:1990 isotp_rcv_cf net/can/isotp.c:570 [inline] isotp_rcv+0xa38/0x1e30 net/can/isotp.c:668 deliver net/can/af_can.c:574 [inline] can_rcv_filter+0x445/0x8d0 net/can/af_can.c:635 can_receive+0x31d/0x580 net/can/af_can.c:665 can_rcv+0x120/0x1c0 net/can/af_can.c:696 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5465 __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5579 Therefore we make sure the state changes and data structures stay consistent at CAN frame reception time by adding a spin_lock in isotp_rcv(). This fixes the issue reported by syzkaller but does not affect real world operation. The Linux kernel CVE team has assigned CVE-2022-48830 to this issue. Affected and fixed versions =========================== Issue introduced in 5.10 with commit e057dd3fc20f and fixed in 5.10.101 with commit 7b53d2204ce7 Issue introduced in 5.10 with commit e057dd3fc20f and fixed in 5.15.24 with commit f90cc68f9f4b Issue introduced in 5.10 with commit e057dd3fc20f and fixed in 5.16.10 with commit 5b068f33bc8a Issue introduced in 5.10 with commit e057dd3fc20f and fixed in 5.17 with commit 7c759040c1dd 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-2022-48830 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/can/isotp.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/7b53d2204ce79b27a878074a77d64f40ec21dbca https://git.kernel.org/stable/c/f90cc68f9f4b5d8585ad5d0a206a9d37ac299ef3 https://git.kernel.org/stable/c/5b068f33bc8acfcfd5ea7992a2dafb30d89bad30 https://git.kernel.org/stable/c/7c759040c1dd03954f650f147ae7175476d51314