[patch 09/23] Fix error returns in sys_socketpair()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>, <stable@...>
Cc: Justin Forbes <jmforbes@...>, Zwane Mwaikambo <zwane@...>, Theodore Ts'o <tytso@...>, Randy Dunlap <rdunlap@...>, Dave Jones <davej@...>, Chuck Wolber <chuckw@...>, Chris Wedgwood <reviews@...>, Michael Krufky <mkrufky@...>, Chuck Ebbert <cebbert@...>, Domenico Andreoli <cavokz@...>, <torvalds@...>, <akpm@...>, <alan@...>, <bunk@...>, David S. Miller <davem@...>
Date: Thursday, November 15, 2007 - 2:20 am

-stable review patch.  If anyone has any objections, please let us know.

------------------

From: David Miller <davem@davemloft.net>

patch bf3c23d171e35e6e168074a1514b0acd59cfd81a in mainline.

[NET]: Fix error reporting in sys_socketpair().

If either of the two sock_alloc_fd() calls fail, we
forget to update 'err' and thus we'll erroneously
return zero in these cases.

Based upon a report and patch from Rich Paul, and
commentary from Chuck Ebbert.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 net/socket.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/net/socket.c
+++ b/net/socket.c
@@ -1245,11 +1245,14 @@ asmlinkage long sys_socketpair(int famil
 		goto out_release_both;
 
 	fd1 = sock_alloc_fd(&newfile1);
-	if (unlikely(fd1 < 0))
+	if (unlikely(fd1 < 0)) {
+		err = fd1;
 		goto out_release_both;
+	}
 
 	fd2 = sock_alloc_fd(&newfile2);
 	if (unlikely(fd2 < 0)) {
+		err = fd2;
 		put_filp(newfile1);
 		put_unused_fd(fd1);
 		goto out_release_both;

-- 
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 17/23] ieee80211: fix TKIP QoS bug, Greg KH, (Thu Nov 15, 2:20 am)
[patch 15/23] Fix netlink timeouts., Greg KH, (Thu Nov 15, 2:20 am)
[patch 12/23] Fix VLAN address syncing., Greg KH, (Thu Nov 15, 2:20 am)
[patch 10/23] Fix TEQL oops., Greg KH, (Thu Nov 15, 2:20 am)
[patch 09/23] Fix error returns in sys_socketpair(), Greg KH, (Thu Nov 15, 2:20 am)
[patch 05/23] Fix 9P protocol build, Greg KH, (Thu Nov 15, 2:20 am)
Re: [patch 06/23] Fix SKB_WITH_OVERHEAD calculations., David Miller, (Thu Nov 15, 3:00 am)