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 3CC0715CD46 for ; Wed, 29 May 2024 18:46:46 +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=1717008407; cv=none; b=mIH5IVnIcevgSEgIeriyF002JgG8Tic+Y3CHDUbT8jVsaKPfhrzEUbOAUYJyEgvMnCG8tyEuD6b47Ai1f26V7YUPTt4pxmUeD1TtwC9pUCi77Wq/DIbBXnJSxoVlgdo7rDkzjqWqckuEl3Q7LB/Eoq5n2+3Ip2IgSTi2pczp5Dw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717008407; c=relaxed/simple; bh=eL4u4+Vq+6b1HY3SV2ED8SyUUKJSb4j0HPFSDVbHnN4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=NLXPTezwCTVxppNFyh0hbuW1y+i0Ukt0oMtzi42q40n03W4Hvb6FfFFkVGUHgYonFuebJT8etRMuVVbXwEiZoy3i2DaFbGojvlj14Fwr8EFtNWafVIUs7cxMz2qlgLBF/nfsdpVTQsp9LvCZCSRXBFcbugXsn0SY1ePQMdfwwzk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bVBQhYLA; 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="bVBQhYLA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 655B4C113CC; Wed, 29 May 2024 18:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1717008406; bh=eL4u4+Vq+6b1HY3SV2ED8SyUUKJSb4j0HPFSDVbHnN4=; h=From:To:Cc:Subject:Date:Reply-to:From; b=bVBQhYLAjqcbuMDUZ6UttYr3DMtYCL7eETY4uOeQORPKtsZKz95GJYqvbv3VeEfX5 EfZOyDG5T2Jj0PXxuXbC78zlSZkzutKzUG2Jx56SOpIXkWoQcdnrgewGG4A7Gatsz4 G/3tAmipueaXkuOFCOc/okKnAGLZpA+EwsuCKk/Y= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-36016: tty: n_gsm: fix possible out-of-bounds in gsm0_receive() Date: Wed, 29 May 2024 20:46:48 +0200 Message-ID: <2024052947-CVE-2024-36016-d30a@gregkh> X-Mailer: git-send-email 2.45.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=2340; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=eL4u4+Vq+6b1HY3SV2ED8SyUUKJSb4j0HPFSDVbHnN4=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnhFeKGs/NeFdiyfRB8XqM25Xnyp33X7zXnb79WzWT0+ swqH+2PHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRnFsM8/O+LDfWPZPxWmHp zALOB/+vfGfwmc2wYPvkS/sLunfodd/IucK6Ou5xumP2eQA= 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: tty: n_gsm: fix possible out-of-bounds in gsm0_receive() Assuming the following: - side A configures the n_gsm in basic option mode - side B sends the header of a basic option mode frame with data length 1 - side A switches to advanced option mode - side B sends 2 data bytes which exceeds gsm->len Reason: gsm->len is not used in advanced option mode. - side A switches to basic option mode - side B keeps sending until gsm0_receive() writes past gsm->buf Reason: Neither gsm->state nor gsm->len have been reset after reconfiguration. Fix this by changing gsm->count to gsm->len comparison from equal to less than. Also add upper limit checks against the constant MAX_MRU in gsm0_receive() and gsm1_receive() to harden against memory corruption of gsm->len and gsm->mru. All other checks remain as we still need to limit the data according to the user configuration and actual payload size. The Linux kernel CVE team has assigned CVE-2024-36016 to this issue. Affected and fixed versions =========================== Issue introduced in 2.6.35 with commit e1eaea46bb40 and fixed in 6.10-rc1 with commit 47388e807f85 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-36016 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/tty/n_gsm.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/47388e807f85948eefc403a8a5fdc5b406a65d5a