mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 06:34:12 +08:00
net/sock: add WARN_ON(parent->sk) in sock_graft()
sock_graft() unilaterally sets up parent->sk based on the assumption that the existing parent->sk is null. If this condition is not true, then the existing parent->sk would be leaked, so add a WARN_ON() to alert callers who may fall in this category. Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0933a578cd
commit
0ffdaf5b41
@ -1697,6 +1697,7 @@ static inline void sock_orphan(struct sock *sk)
|
||||
|
||||
static inline void sock_graft(struct sock *sk, struct socket *parent)
|
||||
{
|
||||
WARN_ON(parent->sk);
|
||||
write_lock_bh(&sk->sk_callback_lock);
|
||||
sk->sk_wq = parent->wq;
|
||||
parent->sk = sk;
|
||||
|
Loading…
Reference in New Issue
Block a user