[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1425936003-24544-3-git-send-email-zenczykowski@gmail.com>
Date: Mon, 9 Mar 2015 14:19:58 -0700
From: Maciej Żenczykowski <zenczykowski@...il.com>
To: Maciej Żenczykowski <maze@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>
Cc: Theodore Ts'o <tytso@....edu>, netdev@...r.kernel.org
Subject: [PATCH 3/8] net/socket: sock_map_fd - reverse allocation order
From: Maciej Żenczykowski <maze@...gle.com>
Signed-off-by: Maciej Żenczykowski <maze@...gle.com>
---
net/socket.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/net/socket.c b/net/socket.c
index 8e282bae488d..a62c5cda5720 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -392,19 +392,20 @@ EXPORT_SYMBOL(sock_alloc_file);
static int sock_map_fd(struct socket *sock, int flags)
{
struct file *newfile;
- int fd = get_unused_fd_flags(flags);
- if (unlikely(fd < 0)) {
- sock_release(sock);
- return fd;
- }
+ int fd;
newfile = sock_alloc_file(sock, flags, NULL);
if (unlikely(IS_ERR(newfile))) {
- put_unused_fd(fd);
sock_release(sock);
return PTR_ERR(newfile);
}
+ fd = get_unused_fd_flags(flags);
+ if (unlikely(fd < 0)) {
+ fput(newfile);
+ return fd;
+ }
+
fd_install(fd, newfile);
return fd;
}
--
2.2.0.rc0.207.ga3a616c
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists