[patch 07/23] Fix kernel_accept() return handling.

!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@...>, Tony Battersby <tonyb@...>, 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: Tony Battersby <tonyb@cybernetics.com>

patch fa8705b00aeca19d91a1437b8a5cf865999b28f6 in mainline.

[NET]: sanitize kernel_accept() error path

If kernel_accept() returns an error, it may pass back a pointer to
freed memory (which the caller should ignore).  Make it pass back NULL
instead for better safety.

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

---
 net/socket.c |    1 +
 1 file changed, 1 insertion(+)

--- a/net/socket.c
+++ b/net/socket.c
@@ -2230,6 +2230,7 @@ int kernel_accept(struct socket *sock, s
 	err = sock->ops->accept(sock, *newsock, flags);
 	if (err < 0) {
 		sock_release(*newsock);
+		*newsock = NULL;
 		goto done;
 	}
 

-- 
-
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 07/23] Fix kernel_accept() return handling., 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)