mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
file: convert replace_fd() to FD_PREPARE()
Link: https://patch.msgid.link/20251123-work-fd-prepare-v4-44-b6efa1706cfd@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
@@ -1357,28 +1357,25 @@ out_unlock:
|
||||
*/
|
||||
int receive_fd(struct file *file, int __user *ufd, unsigned int o_flags)
|
||||
{
|
||||
int new_fd;
|
||||
int error;
|
||||
|
||||
error = security_file_receive(file);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
new_fd = get_unused_fd_flags(o_flags);
|
||||
if (new_fd < 0)
|
||||
return new_fd;
|
||||
FD_PREPARE(fdf, o_flags, file);
|
||||
if (fdf.err)
|
||||
return fdf.err;
|
||||
get_file(file);
|
||||
|
||||
if (ufd) {
|
||||
error = put_user(new_fd, ufd);
|
||||
if (error) {
|
||||
put_unused_fd(new_fd);
|
||||
error = put_user(fd_prepare_fd(fdf), ufd);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
fd_install(new_fd, get_file(file));
|
||||
__receive_sock(file);
|
||||
return new_fd;
|
||||
__receive_sock(fd_prepare_file(fdf));
|
||||
return fd_publish(fdf);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(receive_fd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user