Commit cbd0a6a2 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs regression fix from Al Viro/

Fix a leak in socket() introduced by commit 8e1611e2 ("make
sock_alloc_file() do sock_release() on failures").

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  Fix a leak in socket(2) when we fail to allocate a file descriptor.
parents 64fce444 ce4bb04c
...@@ -436,8 +436,10 @@ static int sock_map_fd(struct socket *sock, int flags) ...@@ -436,8 +436,10 @@ static int sock_map_fd(struct socket *sock, int flags)
{ {
struct file *newfile; struct file *newfile;
int fd = get_unused_fd_flags(flags); int fd = get_unused_fd_flags(flags);
if (unlikely(fd < 0)) if (unlikely(fd < 0)) {
sock_release(sock);
return fd; return fd;
}
newfile = sock_alloc_file(sock, flags, NULL); newfile = sock_alloc_file(sock, flags, NULL);
if (likely(!IS_ERR(newfile))) { if (likely(!IS_ERR(newfile))) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment