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 3AD292C19C for ; Wed, 28 Feb 2024 08:16: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=1709108209; cv=none; b=ek8sdbWsdeFikSQO9QKyWDv86ZA+OqvNmy4Q0w80scjcjqudTyfOeYP1WLzTV6ZARAQTyzF3xfzKOX3lR6ohymaV22K+ss3LwCQ1uR8vl4Beb3cd8buAH8Na7S1F2+EIQQQwUIwk9iDeiKKIReMkdEq3y4OiS6lORQQPX+8a4vc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709108209; c=relaxed/simple; bh=pNPO+Owp/GO4SuIykF1459Hxp728e5UrWcr0ZEY8lls=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fV2OqxV7I9VxXNVpAqzmcs9Gwkdbg8lyIlYSqm5UQRPwxOkDaQB+DUXLfOz/30cV6es/cZZNmLk+Xns+b8gl74aUMAwwsqdeGJuc8cX7Q8L3LQn2e+fd0DlM03ryW7Wr43QvL/1kcl+1e4HD7Lbor7RWEa7FOo1azGXIkZmIhHg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ugfo5MVn; 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="Ugfo5MVn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCC2DC433C7; Wed, 28 Feb 2024 08:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709108209; bh=pNPO+Owp/GO4SuIykF1459Hxp728e5UrWcr0ZEY8lls=; h=From:To:Cc:Subject:Date:Reply-to:From; b=Ugfo5MVnZyyHvc1jXbKxaoxZeK6COQUIZFnqgpq4/wlyK+EQiP9KoCiC2DOUwBKot fI1QcWoM2jK/5TV0GYh6X1hiJ55uUAfZmCkWxIMHfk1hpZJedAesRbd8lOA7GnyBlh TtfeN6ntCJMp3qrEOJA5V0s/Ze01kxQ0/pSBi5bo= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: gregkh@kernel.org Subject: CVE-2021-46983: nvmet-rdma: Fix NULL deref when SEND is completed with error Date: Wed, 28 Feb 2024 09:14:33 +0100 Message-ID: <2024022824-CVE-2021-46983-f808@gregkh> X-Mailer: git-send-email 2.44.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=4478; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=mgUsAFnBu9HFFzK5MizTmwfv+R6Bl+X6FRvurNflkIw=; b=kA0DAAIRMUfUDdst+ykByyZiAGXe62CgftguP0ZBnlGmCP41isbjEDbeW6WmM38Usla1a+7Gn 4hdBAARAgAdFiEE9LYMxb94wiFKMT3LMUfUDdst+ykFAmXe62AACgkQMUfUDdst+ym/3ACgxXIi hoOeIia2NSkiZS0B6WS+gzgAoNlkVZvc3RGnMy2NlzWou0Erri5b X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: gregkh@kernel.org Description =========== In the Linux kernel, the following vulnerability has been resolved: nvmet-rdma: Fix NULL deref when SEND is completed with error When running some traffic and taking down the link on peer, a retry counter exceeded error is received. This leads to nvmet_rdma_error_comp which tried accessing the cq_context to obtain the queue. The cq_context is no longer valid after the fix to use shared CQ mechanism and should be obtained similar to how it is obtained in other functions from the wc->qp. [ 905.786331] nvmet_rdma: SEND for CQE 0x00000000e3337f90 failed with status transport retry counter exceeded (12). [ 905.832048] BUG: unable to handle kernel NULL pointer dereference at 0000000000000048 [ 905.839919] PGD 0 P4D 0 [ 905.842464] Oops: 0000 1 SMP NOPTI [ 905.846144] CPU: 13 PID: 1557 Comm: kworker/13:1H Kdump: loaded Tainted: G OE --------- - - 4.18.0-304.el8.x86_64 #1 [ 905.872135] RIP: 0010:nvmet_rdma_error_comp+0x5/0x1b [nvmet_rdma] [ 905.878259] Code: 19 4f c0 e8 89 b3 a5 f6 e9 5b e0 ff ff 0f b7 75 14 4c 89 ea 48 c7 c7 08 1a 4f c0 e8 71 b3 a5 f6 e9 4b e0 ff ff 0f 1f 44 00 00 <48> 8b 47 48 48 85 c0 74 08 48 89 c7 e9 98 bf 49 00 e9 c3 e3 ff ff [ 905.897135] RSP: 0018:ffffab601c45fe28 EFLAGS: 00010246 [ 905.902387] RAX: 0000000000000065 RBX: ffff9e729ea2f800 RCX: 0000000000000000 [ 905.909558] RDX: 0000000000000000 RSI: ffff9e72df9567c8 RDI: 0000000000000000 [ 905.916731] RBP: ffff9e729ea2b400 R08: 000000000000074d R09: 0000000000000074 [ 905.923903] R10: 0000000000000000 R11: ffffab601c45fcc0 R12: 0000000000000010 [ 905.931074] R13: 0000000000000000 R14: 0000000000000010 R15: ffff9e729ea2f400 [ 905.938247] FS: 0000000000000000(0000) GS:ffff9e72df940000(0000) knlGS:0000000000000000 [ 905.938249] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 905.950067] nvmet_rdma: SEND for CQE 0x00000000c7356cca failed with status transport retry counter exceeded (12). [ 905.961855] CR2: 0000000000000048 CR3: 000000678d010004 CR4: 00000000007706e0 [ 905.961855] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 905.961856] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 905.961857] PKRU: 55555554 [ 906.010315] Call Trace: [ 906.012778] __ib_process_cq+0x89/0x170 [ib_core] [ 906.017509] ib_cq_poll_work+0x26/0x80 [ib_core] [ 906.022152] process_one_work+0x1a7/0x360 [ 906.026182] ? create_worker+0x1a0/0x1a0 [ 906.030123] worker_thread+0x30/0x390 [ 906.033802] ? create_worker+0x1a0/0x1a0 [ 906.037744] kthread+0x116/0x130 [ 906.040988] ? kthread_flush_work_fn+0x10/0x10 [ 906.045456] ret_from_fork+0x1f/0x40 The Linux kernel CVE team has assigned CVE-2021-46983 to this issue. Affected and fixed versions =========================== Issue introduced in 5.9 with commit ca0f1a8055be2 and fixed in 5.10.38 with commit 64f3410c7bfc Issue introduced in 5.9 with commit ca0f1a8055be2 and fixed in 5.11.22 with commit 17fb6dfa5162 Issue introduced in 5.9 with commit ca0f1a8055be2 and fixed in 5.12.5 with commit 5bdb34466ad8 Issue introduced in 5.9 with commit ca0f1a8055be2 and fixed in 5.13 with commit 8cc365f9559b Please see https://www.kernel.org or 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-2021-46983 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/nvme/target/rdma.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/64f3410c7bfc389b1a58611d0799f4a36ce4b6b5 https://git.kernel.org/stable/c/17fb6dfa5162b89ecfa07df891a53afec321abe8 https://git.kernel.org/stable/c/5bdb34466ad8370546dfa0497594fb1d6f2fed90 https://git.kernel.org/stable/c/8cc365f9559b86802afc0208389f5c8d46b4ad61