diff options
author | Ying Xue <ying.xue@windriver.com> | 2015-05-04 04:36:48 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-04 21:04:01 +0200 |
commit | 90bdfcb76f7d3b4a763ded3242277578ef22eda4 (patch) | |
tree | 0edc984430d6ccc5c417ccb8a3600cbe8b75e7ed /net/tipc/server.c | |
parent | tipc: adjust locking policy of subscription (diff) | |
download | linux-90bdfcb76f7d3b4a763ded3242277578ef22eda4.tar.xz linux-90bdfcb76f7d3b4a763ded3242277578ef22eda4.zip |
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 <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/server.c')
-rw-r--r-- | net/tipc/server.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/tipc/server.c b/net/tipc/server.c index 77ff03ed1e18..a91a2f79209a 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); |