Subject: [TIPC] Missing null check in the socket code.

From: Max Krasnyansky <[email-masked]>
Date: Thu, 15 Feb 2007 22:27:34 -0800

Fixes an oops in the non-blocking mode.

Signed-off-by: Max Krasnyansky <[email-masked]>
---
 net/tipc/socket.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 2a6a5a6..767f791 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -862,6 +862,10 @@ restart:
 	/* Get access to first message in receive queue */
 
 	buf = skb_peek(&sock->sk->sk_receive_queue);
+	if (NULL == buf) {
+		res = -EAGAIN;
+		goto exit;
+	}
 	msg = buf_msg(buf);
 	sz = msg_data_sz(msg);
 	err = msg_errcode(msg);
-- 
1.4.4.2