Hi Al, On 2024/6/3 08:11, Al Viro wrote:
fd_install() can't be undone by close_fd(). Just delay it until the last failure exit - have cachefiles_ondemand_get_fd() return the file on success (and ERR_PTR() on error) and let the caller do fd_install() after successful copy_to_user() Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
It's a straight-forward fix to me, yet it will have a conflict with https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/commit/fs/cachefiles?h=vfs.fixes&id=4b4391e77a6bf24cba2ef1590e113d9b73b11039 https://lore.kernel.org/all/20240522114308.2402121-10-libaokun@xxxxxxxxxxxxxxx/ It also moves fd_install() to the end of the daemon_read() and tends to fix it for months, does it look good to you? Thanks, Ga Xiang