From: Sowmini Varadhan Date: Mon, 6 Jun 2016 20:22:43 +0000 (-0700) Subject: RDS: TCP: rds_tcp_accept_worker() must exit gracefully when terminating rds-tcp X-Git-Tag: v4.1.12-92~87^2~21 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6d76a1608abef0a3be618a7572a316db0708bc8e;p=users%2Fjedix%2Flinux-maple.git RDS: TCP: rds_tcp_accept_worker() must exit gracefully when terminating rds-tcp Orabug 23542064 Backport of upstream commit 37e14f4fe299 ("RDS: TCP: rds_tcp_accept_worker() must exit gracefully when terminating rds-tcp") There are two instances where we want to terminate RDS-TCP: when exiting the netns or during module unload. In either case, the termination sequence is to stop the listen socket, mark the rtn->rds_tcp_listen_sock as null, and flush any accept workqs. Thus any workqs that get flushed at this point will encounter a null rds_tcp_listen_sock, and must exit gracefully to allow the RDS-TCP termination to complete successfully. Signed-off-by: Sowmini Varadhan Acked-by: Santosh Shilimkar Signed-off-by: David S. Miller --- diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c index 330c304853f7a..38a6df62cdb7d 100644 --- a/net/rds/tcp_listen.c +++ b/net/rds/tcp_listen.c @@ -79,6 +79,9 @@ int rds_tcp_accept_one(struct socket *sock) int conn_state; struct sock *nsk; + if (!sock) /* module unload or netns delete in progress */ + return -ENETUNREACH; + ret = sock_create_kern(sock_net(sock->sk), sock->sk->sk_family, sock->sk->sk_type, sock->sk->sk_protocol, &new_sock);