Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90bdfcb7 authored by Ying Xue's avatar Ying Xue Committed by David S. Miller
Browse files

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: default avatarYing Xue <ying.xue@windriver.com>
Reviewed-by: default avatarJon Maloy <jon.maloy@ericson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a13683f2
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -309,6 +309,10 @@ static int tipc_accept_from_sock(struct tipc_conn *con)


	/* Notify that new connection is incoming */
	/* Notify that new connection is incoming */
	newcon->usr_data = s->tipc_conn_new(newcon->conid);
	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 */
	/* Wake up receive process in case of 'SYN+' message */
	newsock->sk->sk_data_ready(newsock->sk);
	newsock->sk->sk_data_ready(newsock->sk);