From: Yichong Chen <chenyichong@uniontech.com>
To: ecryptfs@vger.kernel.org
Cc: Tyler Hicks <code@tyhicks.com>,
Thorsten Blum <thorsten.blum@linux.dev>,
Christian Brauner <brauner@kernel.org>,
Eric Biggers <ebiggers@kernel.org>, Kees Cook <kees@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Yichong Chen <chenyichong@uniontech.com>
Subject: [PATCH v2 3/3] ecryptfs: reject too-small tag 70 packets
Date: Wed, 15 Jul 2026 13:20:06 +0800 [thread overview]
Message-ID: <ee7c048de44df27f44be1ff8e48c3e47ef523c77.1784081896.git.chenyichong@uniontech.com> (raw)
In-Reply-To: <cover.1784081896.git.chenyichong@uniontech.com>
ecryptfs_parse_tag_70_packet() subtracts fixed metadata fields from the
parsed packet body size to derive the encrypted filename size. A
malformed packet with a body smaller than those fixed fields can underflow
that size calculation.
Reject tag 70 packets before the subtraction unless the body contains the
signature, cipher code, and at least one byte of encrypted filename data.
Fixes: 9c79f34f7ee7 ("eCryptfs: Filename Encryption: Tag 70 packets")
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
---
fs/ecryptfs/keystore.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 02b5d77..a525a8c 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -894,6 +894,12 @@ ecryptfs_parse_tag_70_packet(char **filename, size_t *filename_size,
"rc = [%d]\n", __func__, rc);
goto out;
}
+ if (s->parsed_tag_70_packet_size < (ECRYPTFS_SIG_SIZE + 2)) {
+ ecryptfs_printk(KERN_WARNING, "Invalid packet size [%zd]\n",
+ s->parsed_tag_70_packet_size);
+ rc = -EINVAL;
+ goto out;
+ }
s->block_aligned_filename_size = (s->parsed_tag_70_packet_size
- ECRYPTFS_SIG_SIZE - 1);
if ((1 + s->packet_size_len + s->parsed_tag_70_packet_size)
--
2.51.0
next prev parent reply other threads:[~2026-07-15 5:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 5:20 [PATCH v2 0/3] ecryptfs: split packet parser length fixes Yichong Chen
2026-07-15 5:20 ` [PATCH v2 1/3] ecryptfs: pass packet set buffer size to parser Yichong Chen
2026-07-15 5:20 ` [PATCH v2 2/3] ecryptfs: fix tag 11 packet exact-fit size check Yichong Chen
2026-07-15 5:20 ` Yichong Chen [this message]
2026-07-21 7:29 ` [PATCH v2 0/3] ecryptfs: split packet parser length fixes Tyler Hicks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ee7c048de44df27f44be1ff8e48c3e47ef523c77.1784081896.git.chenyichong@uniontech.com \
--to=chenyichong@uniontech.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=code@tyhicks.com \
--cc=ebiggers@kernel.org \
--cc=ecryptfs@vger.kernel.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thorsten.blum@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®