1 From stable-bounces@linux.kernel.org Tue Nov 13 00:03:31 2007
2 From: David Miller <davem@davemloft.net>
3 Date: Tue, 13 Nov 2007 00:02:56 -0800 (PST)
4 Subject: Fix error returns in sys_socketpair()
7 Message-ID: <20071113.000256.110812500.davem@davemloft.net>
9 From: David Miller <davem@davemloft.net>
11 patch bf3c23d171e35e6e168074a1514b0acd59cfd81a in mainline.
13 [NET]: Fix error reporting in sys_socketpair().
15 If either of the two sock_alloc_fd() calls fail, we
16 forget to update 'err' and thus we'll erroneously
17 return zero in these cases.
19 Based upon a report and patch from Rich Paul, and
20 commentary from Chuck Ebbert.
22 Signed-off-by: David S. Miller <davem@davemloft.net>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
26 net/socket.c | 5 ++++-
27 1 file changed, 4 insertions(+), 1 deletion(-)
31 @@ -1246,11 +1246,14 @@ asmlinkage long sys_socketpair(int famil
32 goto out_release_both;
34 fd1 = sock_alloc_fd(&newfile1);
35 - if (unlikely(fd1 < 0))
36 + if (unlikely(fd1 < 0)) {
38 goto out_release_both;
41 fd2 = sock_alloc_fd(&newfile2);
42 if (unlikely(fd2 < 0)) {
46 goto out_release_both;