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 1523725FA05 for ; Tue, 16 Sep 2025 16:13:49 +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=1758039230; cv=none; b=UO0x1Rg9Yhse8luwp1GmlT3PSVhY4q+HWbxtNB+piLOGfbuLoaV+iY7vSMedafqTaxSvQJnJnObVR9Xicsis92YYMdZKPotgUf8H+CrX0P12op7pTbja5SAUka/BcRNL7AuSS2v16FwHAl345XUKxLIFWuAZ0JVA7Zel0SwCXEY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758039230; c=relaxed/simple; bh=J8XxPRLsPdbCBZgqSc0GEvYGwwH00PTayNfvQwuwtu4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=uOjbfnEkwVAZ4oYy6TNnYA95leEX2UaVQht4YUz45fqqY6D9S25PbjRQpBAp0WRcDl+PmsfDtH9iWsuQyJLU7ZYYjYa5FaG6sg4nmHgb5e48w81zBN8QAW4JQSSBLGPejyGMjypreAN8S0/AVQCtPptusYT5Rj229cqCvn3ge6Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NwkzqG7e; 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="NwkzqG7e" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CD2CC4CEEB; Tue, 16 Sep 2025 16:13:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1758039229; bh=J8XxPRLsPdbCBZgqSc0GEvYGwwH00PTayNfvQwuwtu4=; h=From:To:Cc:Subject:Date:Reply-to:From; b=NwkzqG7eqqLi/bEFQViJ+SRuJLPlhVMfeA4f1VtGd1jaUgsuhyupPsIB0KMNYY4sT WWkTeeNZmqg7FAsBmES1UOJCBwcS3mDhKOWTEDxCJzaGVP99TFoEsAkqCISxUapbto D6vVzDQxBSyVbO2Qdc2ZRZhgxUM8Li7Ptc5Tvr8w= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50341: cifs: fix oops during encryption Date: Tue, 16 Sep 2025 18:11:37 +0200 Message-ID: <2025091638-CVE-2022-50341-12c1@gregkh> X-Mailer: git-send-email 2.51.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=4712; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=6BOFEnTUpRyUiCo0yDX2bdbFmyLJUlGtRudfIgZDjBM=; b=owGbwMvMwCRo6H6F97bub03G02pJDBkne6zmLZn54FgbSygz9/pkOYnu0NS9GdW8ZfzMvVzXO e/eC1rYEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABM5tolhntZZywP+L0zPJjyr 9pBbWH7EfUJSGMP8uBe3ElrkM/eXcFs5JXCknF79w4cVAA== 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: cifs: fix oops during encryption When running xfstests against Azure the following oops occurred on an arm64 system Unable to handle kernel write to read-only memory at virtual address ffff0001221cf000 Mem abort info: ESR = 0x9600004f EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x0f: level 3 permission fault Data abort info: ISV = 0, ISS = 0x0000004f CM = 0, WnR = 1 swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000294f3000 [ffff0001221cf000] pgd=18000001ffff8003, p4d=18000001ffff8003, pud=18000001ff82e003, pmd=18000001ff71d003, pte=00600001221cf787 Internal error: Oops: 9600004f [#1] PREEMPT SMP ... pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--) pc : __memcpy+0x40/0x230 lr : scatterwalk_copychunks+0xe0/0x200 sp : ffff800014e92de0 x29: ffff800014e92de0 x28: ffff000114f9de80 x27: 0000000000000008 x26: 0000000000000008 x25: ffff800014e92e78 x24: 0000000000000008 x23: 0000000000000001 x22: 0000040000000000 x21: ffff000000000000 x20: 0000000000000001 x19: ffff0001037c4488 x18: 0000000000000014 x17: 235e1c0d6efa9661 x16: a435f9576b6edd6c x15: 0000000000000058 x14: 0000000000000001 x13: 0000000000000008 x12: ffff000114f2e590 x11: ffffffffffffffff x10: 0000040000000000 x9 : ffff8000105c3580 x8 : 2e9413b10000001a x7 : 534b4410fb86b005 x6 : 534b4410fb86b005 x5 : ffff0001221cf008 x4 : ffff0001037c4490 x3 : 0000000000000001 x2 : 0000000000000008 x1 : ffff0001037c4488 x0 : ffff0001221cf000 Call trace: __memcpy+0x40/0x230 scatterwalk_map_and_copy+0x98/0x100 crypto_ccm_encrypt+0x150/0x180 crypto_aead_encrypt+0x2c/0x40 crypt_message+0x750/0x880 smb3_init_transform_rq+0x298/0x340 smb_send_rqst.part.11+0xd8/0x180 smb_send_rqst+0x3c/0x100 compound_send_recv+0x534/0xbc0 smb2_query_info_compound+0x32c/0x440 smb2_set_ea+0x438/0x4c0 cifs_xattr_set+0x5d4/0x7c0 This is because in scatterwalk_copychunks(), we attempted to write to a buffer (@sign) that was allocated in the stack (vmalloc area) by crypt_message() and thus accessing its remaining 8 (x2) bytes ended up crossing a page boundary. To simply fix it, we could just pass @sign kmalloc'd from crypt_message() and then we're done. Luckily, we don't seem to pass any other vmalloc'd buffers in smb_rqst::rq_iov... Instead, let's map the correct pages and offsets from vmalloc buffers as well in cifs_sg_set_buf() and then avoiding such oopses. The Linux kernel CVE team has assigned CVE-2022-50341 to this issue. Affected and fixed versions =========================== Fixed in 5.4.229 with commit e8e2861cc3258dbe407d01ea8c59bb5a53132301 Fixed in 5.10.163 with commit fe6ea044c4f05706cb71040055b1c70c6c8275e0 Fixed in 5.15.87 with commit bf0543b93740916ee91956f9a63da6fc0d79daaa Fixed in 6.0.16 with commit a13e51760703f71c25d5fc1f4a62dfa4b0cc80e9 Fixed in 6.1.1 with commit e8d16a54842d609fd4a3ed2d81d4333d6329aa94 Fixed in 6.2 with commit f7f291e14dde32a07b1f0aa06921d28f875a7b54 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-50341 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: fs/cifs/cifsglob.h fs/cifs/cifsproto.h fs/cifs/misc.c fs/cifs/smb2ops.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/e8e2861cc3258dbe407d01ea8c59bb5a53132301 https://git.kernel.org/stable/c/fe6ea044c4f05706cb71040055b1c70c6c8275e0 https://git.kernel.org/stable/c/bf0543b93740916ee91956f9a63da6fc0d79daaa https://git.kernel.org/stable/c/a13e51760703f71c25d5fc1f4a62dfa4b0cc80e9 https://git.kernel.org/stable/c/e8d16a54842d609fd4a3ed2d81d4333d6329aa94 https://git.kernel.org/stable/c/f7f291e14dde32a07b1f0aa06921d28f875a7b54