Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
198de4d7
Commit
198de4d7
authored
Aug 05, 2009
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reorder alloc_fd/attach_fd in socketpair()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
73274127
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
net/socket.c
net/socket.c
+14
-17
No files found.
net/socket.c
View file @
198de4d7
...
@@ -1396,23 +1396,30 @@ SYSCALL_DEFINE4(socketpair, int, family, int, type, int, protocol,
...
@@ -1396,23 +1396,30 @@ SYSCALL_DEFINE4(socketpair, int, family, int, type, int, protocol,
goto
out_release_both
;
goto
out_release_both
;
}
}
fd2
=
sock_alloc_fd
(
&
newfile2
,
flags
&
O_CLOEXEC
);
err
=
sock_attach_fd
(
sock1
,
newfile1
,
flags
&
O_NONBLOCK
);
if
(
unlikely
(
fd2
<
0
))
{
if
(
unlikely
(
err
<
0
))
{
err
=
fd2
;
put_filp
(
newfile1
);
put_filp
(
newfile1
);
put_unused_fd
(
fd1
);
put_unused_fd
(
fd1
);
goto
out_release_both
;
goto
out_release_both
;
}
}
err
=
sock_attach_fd
(
sock1
,
newfile1
,
flags
&
O_NONBLOCK
);
fd2
=
sock_alloc_fd
(
&
newfile2
,
flags
&
O_CLOEXEC
);
if
(
unlikely
(
err
<
0
))
{
if
(
unlikely
(
fd2
<
0
))
{
goto
out_fd2
;
err
=
fd2
;
fput
(
newfile1
);
put_unused_fd
(
fd1
);
sock_release
(
sock2
);
goto
out
;
}
}
err
=
sock_attach_fd
(
sock2
,
newfile2
,
flags
&
O_NONBLOCK
);
err
=
sock_attach_fd
(
sock2
,
newfile2
,
flags
&
O_NONBLOCK
);
if
(
unlikely
(
err
<
0
))
{
if
(
unlikely
(
err
<
0
))
{
put_filp
(
newfile2
);
put_unused_fd
(
fd2
);
fput
(
newfile1
);
fput
(
newfile1
);
goto
out_fd1
;
put_unused_fd
(
fd1
);
sock_release
(
sock2
);
goto
out
;
}
}
audit_fd_pair
(
fd1
,
fd2
);
audit_fd_pair
(
fd1
,
fd2
);
...
@@ -1438,16 +1445,6 @@ out_release_1:
...
@@ -1438,16 +1445,6 @@ out_release_1:
sock_release
(
sock1
);
sock_release
(
sock1
);
out:
out:
return
err
;
return
err
;
out_fd2:
put_filp
(
newfile1
);
sock_release
(
sock1
);
out_fd1:
put_filp
(
newfile2
);
sock_release
(
sock2
);
put_unused_fd
(
fd1
);
put_unused_fd
(
fd2
);
goto
out
;
}
}
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment