mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tristan Madani <tristmd@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-kernel@vger.kernel.org,
	syzbot+969e250fc7983fc7417c@syzkaller.appspotmail.com
Subject: Re: [PATCH] udf: propagate error from udf_fiiter_add_entry
Date: Tue, 21 Apr 2026 10:43:21 -0000	[thread overview]
Message-ID: <177676820132.2330022.14119116265609139764@gmail.com> (raw)

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

             reply	other threads:[~2026-04-21 10:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 10:43 Tristan Madani [this message]
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

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=177676820132.2330022.14119116265609139764@gmail.com \
    --to=tristmd@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+969e250fc7983fc7417c@syzkaller.appspotmail.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®