summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-12-05 15:52:30 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2025-12-05 15:52:30 -0800
commit4b9d25b4d38035b7b2624afd6852dfe4684f0226 (patch)
treeb8dbd15848924f235a06ed83cc511d60b1521644 /net
parente40e023591ff7fa7863cacced9d6452f7805f8cf (diff)
parentfe93446b5ebdaa89a8f97b15668c077921a65140 (diff)
Merge tag 'vfs-6.19-rc1.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull vfs fixes from Christian Brauner: - Fix a type conversion bug in the ipc subsystem - Fix per-dentry timeout warning in autofs - Drop the fd conversion from sockets - Move assert from iput_not_last() to iput() - Fix reversed check in filesystems_freeze_callback() - Use proper uapi types for new struct delegation definitions * tag 'vfs-6.19-rc1.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: vfs: use UAPI types for new struct delegation definition mqueue: correct the type of ro to int Revert "net/socket: convert sock_map_fd() to FD_ADD()" autofs: fix per-dentry timeout warning fs: assert on I_FREEING not being set in iput() and iput_not_last() fs: PM: Fix reverse check in filesystems_freeze_callback()
Diffstat (limited to 'net')
-rw-r--r--net/socket.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/net/socket.c b/net/socket.c
index 42fc3028e891..136b98c54fb3 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -503,12 +503,21 @@ EXPORT_SYMBOL(sock_alloc_file);
static int sock_map_fd(struct socket *sock, int flags)
{
- int fd;
-
- fd = FD_ADD(flags, sock_alloc_file(sock, flags, NULL));
- if (fd < 0)
+ struct file *newfile;
+ int fd = get_unused_fd_flags(flags);
+ if (unlikely(fd < 0)) {
sock_release(sock);
- return fd;
+ return fd;
+ }
+
+ newfile = sock_alloc_file(sock, flags, NULL);
+ if (!IS_ERR(newfile)) {
+ fd_install(fd, newfile);
+ return fd;
+ }
+
+ put_unused_fd(fd);
+ return PTR_ERR(newfile);
}
/**