[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1425936003-24544-2-git-send-email-zenczykowski@gmail.com>
Date: Mon, 9 Mar 2015 14:19:57 -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 2/8] net/socket: sock_map_fd - call sock_release in error path
From: Maciej Żenczykowski <maze@...gle.com>
(sock_map_fd only called from sys_socket)
Signed-off-by: Maciej Żenczykowski <maze@...gle.com>
---
net/socket.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/net/socket.c b/net/socket.c
index 323ebd530b88..8e282bae488d 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -393,12 +393,15 @@ static int sock_map_fd(struct socket *sock, int flags)
{
struct file *newfile;
int fd = get_unused_fd_flags(flags);
- if (unlikely(fd < 0))
+ if (unlikely(fd < 0)) {
+ sock_release(sock);
return fd;
+ }
newfile = sock_alloc_file(sock, flags, NULL);
if (unlikely(IS_ERR(newfile))) {
put_unused_fd(fd);
+ sock_release(sock);
return PTR_ERR(newfile);
}
@@ -1256,16 +1259,10 @@ SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
goto out;
retval = sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK));
- if (retval < 0)
- goto out_release;
out:
/* It may be already another descriptor 8) Not kernel problem. */
return retval;
-
-out_release:
- sock_release(sock);
- return retval;
}
/*
--
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