From: Nguyen Duy Nhat Anh <neganhat@gmail.com>
To: code@tyhicks.com
Cc: blum@kernel.org, rdunlap@infradead.org,
chenyichong@uniontech.com, zhangzekun@huwawei.com,
ebiggers@kernel.org, ecryptfs@vger.kernel.org,
linux-kernel@vger.kernel.org,
syzbot+b9529ebe6a9394ddf825@syzkaller.appspotmail.com,
Nguyen Duy Nhat Anh <neganhat@gmail.com>
Subject: [PATCH] fs/ecryptfs: fix slab-out-of-bounds read in ecryptfs_verify_auth_tok_from_key
Date: Thu, 17 Sep 2026 11:45:58 +0700 [thread overview]
Message-ID: <20260917044558.41677-1-neganhat@gmail.com> (raw)
Add a bounds check in ecryptfs_get_key_payload_data() to ensure the
key payload datalen is at least sizeof(struct ecryptfs_auth_tok) before
returning the pointer. This prevents out-of-bounds reads when userspace
supplies a short payload via add_key().
Reported-by: syzbot+b9529ebe6a9394ddf825@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b9529ebe6a9394ddf825
Signed-off-by: Nguyen Duy Nhat Anh <neganhat@gmail.com>
---
fs/ecryptfs/ecryptfs_kernel.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 58165928ed1e..3baccd4143e8 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -124,6 +124,9 @@ ecryptfs_get_key_payload_data(struct key *key)
if (!ukp)
return ERR_PTR(-EKEYREVOKED);
+ if (ukp->datalen < sizeof(struct ecryptfs_auth_tok))
+ return ERR_PTR(-EINVAL);
+
return (struct ecryptfs_auth_tok *)ukp->data;
}
--
2.55.0
next reply other threads:[~2026-09-17 4:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 4:45 Nguyen Duy Nhat Anh [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-09-17 4:43 Nguyen Duy Nhat Anh
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=20260917044558.41677-1-neganhat@gmail.com \
--to=neganhat@gmail.com \
--cc=blum@kernel.org \
--cc=chenyichong@uniontech.com \
--cc=code@tyhicks.com \
--cc=ebiggers@kernel.org \
--cc=ecryptfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=syzbot+b9529ebe6a9394ddf825@syzkaller.appspotmail.com \
--cc=zhangzekun@huwawei.com \
/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®