public inbox for linux-erofs@ozlabs.org
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Gao Xiang <hsiangkao@linux.alibaba.com>, linux-erofs@lists.ozlabs.org
Cc: chao@kernel.org, LKML <linux-kernel@vger.kernel.org>,
	oliver.yang@linux.alibaba.com, Yuhao Jiang <danisjiang@gmail.com>,
	Junrui Luo <moonafterrain@outlook.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v4] erofs: fix the out-of-bounds nameoff handling for trailing dirents
Date: Tue, 21 Apr 2026 16:32:00 +0800	[thread overview]
Message-ID: <4c904b6b-afe9-4ac8-a1d2-47b7c84b67db@kernel.org> (raw)
In-Reply-To: <20260421075952.975069-1-hsiangkao@linux.alibaba.com>

On 4/21/2026 3:59 PM, Gao Xiang wrote:
> Currently we already have boundary-checks for nameoffs, but the trailing
> dirents are special since the namelens are calculated with strnlen()
> with unchecked nameoffs.
> 
> If a crafted EROFS has a trailing dirent with nameoff >= maxsize,
> maxsize - nameoff can underflow, causing strnlen() to read past the
> directory block.
> 
> nameoff0 should also be verified to be a multiple of
> `sizeof(struct erofs_dirent)` as well [1].
> 
> [1] https://sashiko.dev/#/patchset/20260416063511.3173774-1-hsiangkao%40linux.alibaba.com
> 
> Fixes: 3aa8ec716e52 ("staging: erofs: add directory operations")
> Fixes: 33bac912840f ("staging: erofs: keep corrupted fs from crashing kernel in erofs_readdir()")
> Reported-by: Yuhao Jiang <danisjiang@gmail.com>
> Reported-by: Junrui Luo <moonafterrain@outlook.com>
> Closes: https://lore.kernel.org/r/A0FD7E0F-7558-49B0-8BC8-EB1ECDB2479A@outlook.com
> Cc: stable@vger.kernel.org
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


      reply	other threads:[~2026-04-21  8:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16  6:03 [PATCH] erofs: fix the out-of-bounds nameoff handling for trailing dirents Gao Xiang
2026-04-16  6:35 ` [PATCH v2] " Gao Xiang
2026-04-16  9:44   ` [PATCH v3] " Gao Xiang
2026-04-21  7:26     ` Chao Yu
2026-04-21  7:38       ` Gao Xiang
2026-04-21  8:31         ` Chao Yu
2026-04-21  7:59       ` [PATCH v4] " Gao Xiang
2026-04-21  8:32         ` Chao Yu [this message]

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=4c904b6b-afe9-4ac8-a1d2-47b7c84b67db@kernel.org \
    --to=chao@kernel.org \
    --cc=danisjiang@gmail.com \
    --cc=hsiangkao@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=moonafterrain@outlook.com \
    --cc=oliver.yang@linux.alibaba.com \
    --cc=stable@vger.kernel.org \
    /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