Unverified Commit ef298231 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!4228 fix spinlock already unlocked in inet_csk_reqsk_queue_add' bug

Merge Pull Request from: @ci-robot 
 
PR sync from: Zhengchao Shao <shaozhengchao@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/ARNGYB5LGV4LSYP2PBTQ27HW4MHZENBF/ 
Fix spinlock already unlocked in inet_csk_reqsk_queue_add' bug.

Zhengchao Shao (2):
  tcp: make sure init the accept_queue's spinlocks once
  ipv6: init the accept_queue's spinlocks in inet6_create


-- 
2.34.1
 
https://gitee.com/openeuler/kernel/issues/I8RJRU 
 
Link:https://gitee.com/openeuler/kernel/pulls/4228

 

Reviewed-by: default avatarLiu YongQiang <liuyongqiang13@huawei.com>
Reviewed-by: default avatarYue Haibing <yuehaibing@huawei.com>
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
parents 57170d7c 3e43a040
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -318,4 +318,13 @@ void inet_csk_update_fastreuse(struct inet_bind_bucket *tb,
			       struct sock *sk);

struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu);

static inline void inet_init_csk_locks(struct sock *sk)
{
	struct inet_connection_sock *icsk = inet_csk(sk);

	spin_lock_init(&icsk->icsk_accept_queue.rskq_lock);
	spin_lock_init(&icsk->icsk_accept_queue.fastopenq.lock);
}

#endif /* _INET_CONNECTION_SOCK_H */
+0 −3
Original line number Diff line number Diff line
@@ -37,9 +37,6 @@

void reqsk_queue_alloc(struct request_sock_queue *queue)
{
	spin_lock_init(&queue->rskq_lock);

	spin_lock_init(&queue->fastopenq.lock);
	queue->fastopenq.rskq_rst_head = NULL;
	queue->fastopenq.rskq_rst_tail = NULL;
	queue->fastopenq.qlen = 0;
+3 −0
Original line number Diff line number Diff line
@@ -326,6 +326,9 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,
	if (INET_PROTOSW_REUSE & answer_flags)
		sk->sk_reuse = SK_CAN_REUSE;

	if (INET_PROTOSW_ICSK & answer_flags)
		inet_init_csk_locks(sk);

	inet = inet_sk(sk);
	inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0;

+4 −0
Original line number Diff line number Diff line
@@ -524,6 +524,10 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern)
	}
	if (req)
		reqsk_put(req);

	if (newsk)
		inet_init_csk_locks(newsk);

	return newsk;
out_err:
	newsk = NULL;
+3 −0
Original line number Diff line number Diff line
@@ -197,6 +197,9 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,
	if (INET_PROTOSW_REUSE & answer_flags)
		sk->sk_reuse = SK_CAN_REUSE;

	if (INET_PROTOSW_ICSK & answer_flags)
		inet_init_csk_locks(sk);

	inet = inet_sk(sk);
	inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0;