Re: [PATCH] pNFS: Fix use-after-free in pnfs_update_layout()

From: Markus Elfring

Date: Sat May 23 2026 - 09:38:16 EST



> Fix this by moving the tracepoint call before pnfs_put_layout_hdr(lo).

Or:
Thus move a pnfs_put_layout_hdr(lo) call between a trace_pnfs_update_layout() call
and a goto statement.


How do you think about to avoid a bit of duplicate source code
in the implementation of the function “pnfs_update_layout” then?
https://elixir.bootlin.com/linux/v7.1-rc4/source/fs/nfs/pnfs.c#L2128-L2385
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v7.1-rc4#n526


Were any source code analysis tools involved in the detection of improvable places?

Regards,
Markus