From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 255033C3F5C; Sat, 17 Oct 2026 17:13:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792257231; cv=none; b=WOsCvb/7j4ENG7iHTYyQLEHjTAsCwsHYub3JBwlm4B4uHkgl1U5Yt/6Lw6/zgBL/TkqvBos+FSnUSiIjhSvqGvu7gyKioXaufBLcp7US950A6uY4LJ+hpUJMbY5rhabR+cjxgZ3VpXa64naVX6gQjp976AWZ2CtW3d53JAmlNF8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792257231; c=relaxed/simple; bh=Xb/GAGTE5rP4aphDQNy4nBOcAPraPkNJvWot7TOxbW0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UnYLtpzrCBdarX9WvNguJN4hDyC/Da7J/eFTXcjLfpxoPMBWvteUTiGDC1FJ322fy3bUyerPjxuNCUxKJ2jJScQCMsb8vGALjw3ocHxocXj4VelGICBDZOgw+VaCmC1HPLQZOc82ebtOlGxpGF8AKBia2MuGbajQIglBIdsJ1Zc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mSwSR5Em; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="mSwSR5Em" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F6AB1F000C5; Sat, 17 Oct 2026 17:13:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792257230; bh=i8KcW2vYenALtJtZwkRVzeyY7islZE4DHIRJ6FLzKrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mSwSR5Em7zyOR4FW6VNrvg5SiSLgl40Rzm6CTv7NOn8300v7vHZcCB6ItT3+/Vhv5 ET4TuNcSXfkGhm0AQeBMlDtlgHVi75e/q9blBgptE2KpeuF0eYrltwfZqzRdKmd4Wp HNJLH+2UVcQgRu9t8jH1t4HxEdXfdLFhl2GzWLqk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ben Cressey , Mikulas Patocka Subject: [PATCH 6.6 0494/1674] dm-crypt: reject the lmk IV mode with AEAD ciphers Date: Sat, 17 Oct 2026 17:46:06 +0200 Message-ID: <20261017160443.795557260@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ben Cressey commit 3195e0daf590683992edb4eed32269e569e04924 upstream. A "capi:" table line that pairs an AEAD cipher with the lmk IV mode, for example "capi:gcm(aes)-lmk" with the integrity:28:aead option, causes an oops when it is loaded. lmk sets tfms_count to 64, but crypt_alloc_tfms_aead only allocates one transform, so crypt_setkey reads past the end of the tfms_aead array and calls crypto_aead_setkey on the values it finds there. lmk exists for compatibility with Loop-AES, which uses CBC, so refuse it with an AEAD cipher rather than allocate 64 AEAD transforms. The check cannot go in crypt_iv_lmk_ctr with the other lmk checks, because the IV constructor runs after crypt_set_key. Note that this is not a security bug because the memory corruption can only be triggered by root. Fixes: 33d2f09fcb35 ("dm crypt: introduce new format of cipher with "capi:" prefix") Cc: stable@vger.kernel.org Signed-off-by: Ben Cressey Assisted-by: LLM Signed-off-by: Mikulas Patocka Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-crypt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -2950,8 +2950,13 @@ static int crypt_ctr_cipher_new(struct d } } - if (*ivmode && !strcmp(*ivmode, "lmk")) + if (*ivmode && !strcmp(*ivmode, "lmk")) { + if (crypt_integrity_aead(cc)) { + ti->error = "AEAD transforms not supported for LMK"; + return -EINVAL; + } cc->tfms_count = 64; + } if (*ivmode && !strcmp(*ivmode, "essiv")) { if (!*ivopts) {