Re: [PATCH v2] statmount: retry an overflowed seq buffer before any other check
From: Christian Brauner
Date: Tue Dec 01 2026 - 08:09:10 EST
On Thu, 26 Nov 2026 01:13:48 +0800, Ding Feng wrote:
> statmount_string() checks whether the seq_file overflowed only after
> two earlier returns, and both can hide the overflow.
>
> The size check runs first. After an overflow, seq->count equals
> seq->size, so every buffer of up to sizeof(struct statmount) +
> seq->size bytes gets -EOVERFLOW, and the retry with a larger seq buffer
> never runs. The result can still fit in such a buffer.
> statmount_mnt_root() and statmount_sb_source() write escaped strings
> and unescape them in place, so the escaped form can overflow the
> 3 * PATH_MAX seq buffer while the final string is much shorter. A bind
> mount whose root is a 3765-byte path of spaces needs a 4.3 KiB buffer,
> but STATMOUNT_MNT_ROOT fails with -EOVERFLOW for every buffer up to
> 12800 bytes and succeeds from 12801.
>
> [...]
Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes
[1/1] statmount: retry an overflowed seq buffer before any other check
https://git.kernel.org/vfs/vfs/c/d9a8b561f8d3