diff options
Diffstat (limited to 'net/mctp/af_mctp.c')
| -rw-r--r-- | net/mctp/af_mctp.c | 16 | 
1 files changed, 13 insertions, 3 deletions
diff --git a/net/mctp/af_mctp.c b/net/mctp/af_mctp.c index fc9e728b6333..3150f3f0c872 100644 --- a/net/mctp/af_mctp.c +++ b/net/mctp/af_mctp.c @@ -544,9 +544,6 @@ static int mctp_sk_init(struct sock *sk)  static void mctp_sk_close(struct sock *sk, long timeout)  { -	struct mctp_sock *msk = container_of(sk, struct mctp_sock, sk); - -	del_timer_sync(&msk->key_expiry);  	sk_common_release(sk);  } @@ -580,7 +577,19 @@ static void mctp_sk_unhash(struct sock *sk)  		spin_lock_irqsave(&key->lock, fl2);  		__mctp_key_remove(key, net, fl2, MCTP_TRACE_KEY_CLOSED);  	} +	sock_set_flag(sk, SOCK_DEAD);  	spin_unlock_irqrestore(&net->mctp.keys_lock, flags); + +	/* Since there are no more tag allocations (we have removed all of the +	 * keys), stop any pending expiry events. the timer cannot be re-queued +	 * as the sk is no longer observable +	 */ +	del_timer_sync(&msk->key_expiry); +} + +static void mctp_sk_destruct(struct sock *sk) +{ +	skb_queue_purge(&sk->sk_receive_queue);  }  static struct proto mctp_proto = { @@ -619,6 +628,7 @@ static int mctp_pf_create(struct net *net, struct socket *sock,  		return -ENOMEM;  	sock_init_data(sock, sk); +	sk->sk_destruct = mctp_sk_destruct;  	rc = 0;  	if (sk->sk_prot->init)  |