Re: ksmbd: Use common error handling code in ksmbd_vfs_path_lookup()

From: Markus Elfring
Date: Sat Oct 04 2025 - 08:36:48 EST


>>> This is based on the pattern in kern_path_parent() and
>>> __start_removing_path().

You influenced the software evolution also according to the availability
of a function like kern_path_locked_negative().
https://elixir.bootlin.com/linux/v6.17/source/fs/namei.c#L2770-L2792

See also the following commits:
* 76a53de6f7ff0641570364234fb4489f4d4fc8e9 ("VFS/audit: introduce kern_path_parent()
for audit") from 2025-09-23

* a681b7c17dd21d5aa0da391ceb27a2007ba970a4 ("fs: ensure that *path_locked*() helpers
leave passed path pristine") from 2025-04-16


>> Do you propose that affected software components may benefit more from
>> the application of scope-based resource management?
>> https://elixir.bootlin.com/linux/v6.17/source/include/linux/path.h#L22-L28
>
> Exactly. It doesn't suit every case, but if you are going to make
> changes to the exit paths of a function, I think it is worth
> considering if scope-based code will work well for the particular
> function.

Is there a need to clarify possibilities for the usage of the macro “__free_path_put” further?

Regards,
Markus