mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-15 11:44:11 +00:00
net: mctp: purge receive queues on sk destruction
commit60bd1d9008
upstream. We may have pending skbs in the receive queue when the sk is being destroyed; add a destructor to purge the queue. MCTP doesn't use the error queue, so only the receive_queue is purged. Fixes:833ef3b91d
("mctp: Populate socket implementation") Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Link: https://lore.kernel.org/r/20230126064551.464468-1-jk@codeconstruct.com.au Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7e6582fec2
commit
7eebabc5ca
1 changed files with 6 additions and 0 deletions
|
@ -294,6 +294,11 @@ static void mctp_sk_unhash(struct sock *sk)
|
|||
synchronize_rcu();
|
||||
}
|
||||
|
||||
static void mctp_sk_destruct(struct sock *sk)
|
||||
{
|
||||
skb_queue_purge(&sk->sk_receive_queue);
|
||||
}
|
||||
|
||||
static struct proto mctp_proto = {
|
||||
.name = "MCTP",
|
||||
.owner = THIS_MODULE,
|
||||
|
@ -330,6 +335,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)
|
||||
|
|
Loading…
Add table
Reference in a new issue