summaryrefslogtreecommitdiff
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 735b1222af95..70c75ac8da55 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4851,7 +4851,7 @@ static int sctp_disconnect(struct sock *sk, int flags)
*/
static struct sock *sctp_accept(struct sock *sk, struct proto_accept_arg *arg)
{
- struct sctp_sock *sp;
+ struct sctp_sock *sp, *newsp;
struct sctp_endpoint *ep;
struct sock *newsk = NULL;
struct sctp_association *asoc;
@@ -4891,19 +4891,35 @@ static struct sock *sctp_accept(struct sock *sk, struct proto_accept_arg *arg)
goto out;
}
+ newsp = sctp_sk(newsk);
+ newsp->ep = sctp_endpoint_new(newsk, GFP_KERNEL);
+ if (!newsp->ep) {
+ error = -ENOMEM;
+ goto out_release;
+ }
+
+ skb_queue_head_init(&newsp->pd_lobby);
+
+ sk_sockets_allocated_inc(newsk);
+ sock_prot_inuse_add(sock_net(sk), newsk->sk_prot, 1);
+ SCTP_DBG_OBJCNT_INC(sock);
+
/* Populate the fields of the newsk from the oldsk and migrate the
* asoc to the newsk.
*/
error = sctp_sock_migrate(sk, newsk, asoc, SCTP_SOCKET_TCP);
- if (error) {
- sk_common_release(newsk);
- newsk = NULL;
- }
+ if (error)
+ goto out_release;
out:
release_sock(sk);
arg->err = error;
return newsk;
+
+out_release:
+ sk_common_release(newsk);
+ newsk = NULL;
+ goto out;
}
/* The SCTP ioctl handler. */
@@ -9469,6 +9485,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
newsk->sk_rcvtimeo = READ_ONCE(sk->sk_rcvtimeo);
newsk->sk_sndtimeo = READ_ONCE(sk->sk_sndtimeo);
newsk->sk_rxhash = sk->sk_rxhash;
+ newsk->sk_gso_type = sk->sk_gso_type;
newinet = inet_sk(newsk);