Re: [PATCH] ecryptfs: Add missing gotos in ecryptfs_read_metadata

From: Tyler Hicks

Date: Mon Jan 12 2026 - 14:23:36 EST


On 2026-01-11 13:28:17, Thorsten Blum wrote:
> On 11. Jan 2026, at 02:08, Al Viro wrote:
> > On Sun, Jan 11, 2026 at 01:36:52AM +0100, Thorsten Blum wrote:
> >> Add two missing goto statements to exit ecryptfs_read_metadata() when an
> >> error occurs.
> >>
> >> The first goto is required; otherwise ECRYPTFS_METADATA_IN_XATTR may be
> >> set when xattr metadata is enabled even though parsing the metadata
> >> failed. The second goto is not strictly necessary, but it makes the
> >> error path explicit instead of relying on falling through to 'out'.
> >
> > Ugh... IMO the whole thing from the point we'd successfully allocated
> > the page to the point where we start to clear it ought to be in a separate
> > helper. Something like this, perhaps?
>
> I wanted to keep the fix simple, but I'm happy to refactor the function
> if that's preferred. Any preferences, Tyler?

I typically like the multi-patch approach of a minimal, easy-to-backport
fix first and then a more complete cleanup/improvement in the followup
patch(es).

Tyler

>
> Thanks,
> Thorsten
>