From: Ying Xue Date: Mon, 4 May 2015 02:36:48 +0000 (+0800) Subject: tipc: deal with return value of tipc_conn_new callback X-Git-Tag: v4.2~362^2~376^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90bdfcb76f7d3b4a763ded3242277578ef22eda4;p=platform%2Fkernel%2Flinux-amlogic.git tipc: deal with return value of tipc_conn_new callback Once tipc_conn_new() returns NULL, the connection should be shut down immediately, otherwise, oops may happen due to the NULL pointer. Signed-off-by: Ying Xue Reviewed-by: Jon Maloy Signed-off-by: David S. Miller --- diff --git a/net/tipc/server.c b/net/tipc/server.c index 77ff03e..a91a2f7 100644 --- a/net/tipc/server.c +++ b/net/tipc/server.c @@ -309,6 +309,10 @@ static int tipc_accept_from_sock(struct tipc_conn *con) /* Notify that new connection is incoming */ newcon->usr_data = s->tipc_conn_new(newcon->conid); + if (!newcon->usr_data) { + sock_release(newsock); + return -ENOMEM; + } /* Wake up receive process in case of 'SYN+' message */ newsock->sk->sk_data_ready(newsock->sk);