* Re: [PATCH] udf: propagate error from udf_fiiter_add_entry
@ 2026-04-21 10:43 Tristan Madani
2026-04-21 12:36 ` Jan Kara
0 siblings, 1 reply; 5+ messages in thread
From: Tristan Madani @ 2026-04-21 10:43 UTC (permalink / raw)
To: Jan Kara; +Cc: linux-kernel, syzbot+969e250fc7983fc7417c
On Mon, 20 Apr 2026, Jan Kara wrote:
> Thanks for the patch. Did you analyze how it happened that the directory
> iteration fixing up tags failed? Because if it fails like this, we have
> practically wiped the directory which is not great. So if we are missing
> some directory consistency check before we start converting it, it would be
> good to add it instead of just failing like this later.
Good point. The syzbot reproducer uses a crafted filesystem image where
the inline directory data passes inode loading but contains entries that
fail udf_verify_fi() during iteration (e.g., bad tagIdent or CRC length
mismatch).
The problem is that by the time we iterate in udf_expand_dir_adinicb()
to fix up tagLocation, we've already changed the allocation type and
moved the data to a new block. If the iteration then fails, the
directory is in an inconsistent state.
The right fix would be to validate the inline directory entries
BEFORE starting the conversion -- iterate once to verify all entries
pass udf_verify_fi(), then proceed with the block allocation and tag
fixup only if validation succeeds. That way we never start a
destructive conversion on data we can't fully iterate.
I can send a v2 with this approach: a pre-conversion validation pass
using udf_fiiter_init/advance (which calls udf_verify_fi internally),
and only proceed if the full iteration succeeds. The error propagation
from v1 would remain as a safety net in case anything goes wrong
despite the pre-check.
Would that be the approach you have in mind?
Thanks,
Tristan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] udf: propagate error from udf_fiiter_add_entry
2026-04-21 10:43 [PATCH] udf: propagate error from udf_fiiter_add_entry Tristan Madani
@ 2026-04-21 12:36 ` Jan Kara
[not found] ` <CAA1XrhOd=xYChM-u0NHWXGtR7m_tY9JtYP4pRYHPo5oDCg49sg@mail.gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kara @ 2026-04-21 12:36 UTC (permalink / raw)
To: Tristan Madani; +Cc: Jan Kara, linux-kernel, syzbot+969e250fc7983fc7417c
On Tue 21-04-26 10:43:21, Tristan Madani wrote:
> On Mon, 20 Apr 2026, Jan Kara wrote:
> > Thanks for the patch. Did you analyze how it happened that the directory
> > iteration fixing up tags failed? Because if it fails like this, we have
> > practically wiped the directory which is not great. So if we are missing
> > some directory consistency check before we start converting it, it would be
> > good to add it instead of just failing like this later.
>
> Good point. The syzbot reproducer uses a crafted filesystem image where
> the inline directory data passes inode loading but contains entries that
> fail udf_verify_fi() during iteration (e.g., bad tagIdent or CRC length
> mismatch).
>
> The problem is that by the time we iterate in udf_expand_dir_adinicb()
> to fix up tagLocation, we've already changed the allocation type and
> moved the data to a new block. If the iteration then fails, the
> directory is in an inconsistent state.
>
> The right fix would be to validate the inline directory entries
> BEFORE starting the conversion -- iterate once to verify all entries
> pass udf_verify_fi(), then proceed with the block allocation and tag
> fixup only if validation succeeds. That way we never start a
> destructive conversion on data we can't fully iterate.
>
> I can send a v2 with this approach: a pre-conversion validation pass
> using udf_fiiter_init/advance (which calls udf_verify_fi internally),
> and only proceed if the full iteration succeeds. The error propagation
> from v1 would remain as a safety net in case anything goes wrong
> despite the pre-check.
>
> Would that be the approach you have in mind?
Apparently you are running an AI agent to do the communication and coding.
That should be disclosed in Assisted-by: tag. Also I don't feel like
explaining to LLM how it should be doing the work. I could just do it
myself in this case.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] udf: propagate error from udf_fiiter_add_entry
@ 2026-04-18 13:10 Tristan Madani
2026-04-20 7:38 ` Jan Kara
0 siblings, 1 reply; 5+ messages in thread
From: Tristan Madani @ 2026-04-18 13:10 UTC (permalink / raw)
To: jack; +Cc: linux-kernel, syzbot+969e250fc7983fc7417c
From: Tristan Madani <tristan@talencesecurity.com>
udf_fiiter_add_entry() triggers a WARN when it encounters an error
condition but does not propagate the error to callers. This can be
triggered by a corrupted filesystem image.
Replace the WARN with proper error propagation to allow callers to
handle the failure gracefully.
Reported-by: syzbot+969e250fc7983fc7417c@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
fs/udf/namei.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 9a3b7cef36064..2249b79c0e0b2 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -207,14 +207,9 @@ static int udf_expand_dir_adinicb(struct inode *inode, udf_pblk_t *block)
udf_fiiter_write_fi(&iter, impuse);
}
brelse(dbh);
- /*
- * We don't expect the iteration to fail as the directory has been
- * already verified to be correct
- */
- WARN_ON_ONCE(ret);
udf_fiiter_release(&iter);
- return 0;
+ return ret;
}
static int udf_fiiter_add_entry(struct inode *dir, struct dentry *dentry,
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] udf: propagate error from udf_fiiter_add_entry
2026-04-18 13:10 Tristan Madani
@ 2026-04-20 7:38 ` Jan Kara
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2026-04-20 7:38 UTC (permalink / raw)
To: Tristan Madani; +Cc: jack, linux-kernel, syzbot+969e250fc7983fc7417c
On Sat 18-04-26 13:10:35, Tristan Madani wrote:
> From: Tristan Madani <tristan@talencesecurity.com>
>
> udf_fiiter_add_entry() triggers a WARN when it encounters an error
> condition but does not propagate the error to callers. This can be
> triggered by a corrupted filesystem image.
>
> Replace the WARN with proper error propagation to allow callers to
> handle the failure gracefully.
>
> Reported-by: syzbot+969e250fc7983fc7417c@syzkaller.appspotmail.com
> Cc: stable@vger.kernel.org
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
Thanks for the patch. Did you analyze how it happened that the directory
iteration fixing up tags failed? Because if it fails like this, we have
practically wiped the directory which is not great. So if we are missing
some directory consistency check before we start converting it, it would be
good to add it instead of just failing like this later.
Honza
> ---
> fs/udf/namei.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/fs/udf/namei.c b/fs/udf/namei.c
> index 9a3b7cef36064..2249b79c0e0b2 100644
> --- a/fs/udf/namei.c
> +++ b/fs/udf/namei.c
> @@ -207,14 +207,9 @@ static int udf_expand_dir_adinicb(struct inode *inode, udf_pblk_t *block)
> udf_fiiter_write_fi(&iter, impuse);
> }
> brelse(dbh);
> - /*
> - * We don't expect the iteration to fail as the directory has been
> - * already verified to be correct
> - */
> - WARN_ON_ONCE(ret);
> udf_fiiter_release(&iter);
>
> - return 0;
> + return ret;
> }
>
> static int udf_fiiter_add_entry(struct inode *dir, struct dentry *dentry,
> --
> 2.47.3
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-04-22 9:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-21 10:43 [PATCH] udf: propagate error from udf_fiiter_add_entry Tristan Madani
2026-04-21 12:36 ` Jan Kara
[not found] ` <CAA1XrhOd=xYChM-u0NHWXGtR7m_tY9JtYP4pRYHPo5oDCg49sg@mail.gmail.com>
2026-04-22 9:15 ` Jan Kara
-- strict thread matches above, loose matches on Subject: below --
2026-04-18 13:10 Tristan Madani
2026-04-20 7:38 ` Jan Kara
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®