Re: [PATCH v4 27/30] fs: Add iput() cleanup helper
From: Mickaël Salaün <mic@digikod.net>
Date: 2025-01-13 16:55:29
Also in:
lkml
From: Mickaël Salaün <mic@digikod.net>
Date: 2025-01-13 16:55:29
Also in:
lkml
On Mon, Jan 13, 2025 at 04:00:31PM +0100, Christian Brauner wrote:
On Mon, Jan 13, 2025 at 03:00:20PM +0100, Jann Horn wrote:quoted
On Wed, Jan 8, 2025 at 4:44 PM Mickaël Salaün [off-list ref] wrote:quoted
Add a simple scope-based helper to put an inode reference, similar to the fput() helper.Cleaning up inode references with scope-based cleanup seems dangerous to me because, unlike most resources, holding a reference to an inode beyond the lifetime of the associated superblock can actually cause memory corruption; and scope-based cleanup is designed based on the idea that the order and precise location of dropping a reference don't matter so much.That's in general a good point and I know there's been opposition to this in the past when we discussed this. So fine by me.
Right, I'll use __free(path_put) instead.