From: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] Prevent from potential dead lock for inet_listen_lock
Date: Mon, 30 Jun 2008 11:16:41 +0800 [thread overview]
Message-ID: <48685019.90706@cn.fujitsu.com> (raw)
In-Reply-To: <20080627.193234.134186954.davem@davemloft.net>
David Miller wrote:
> From: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
> Date: Fri, 20 Jun 2008 17:08:20 +0800
>
>> hashinfo->lhash_lock might be acquired by write_lock() in softirq,
>
> How?
How about the following call trace.
dccp_v4_rcv
-> sk_receive_skb(sk, skb, 1);
-> sk->sk_backlog_rcv(sk, skb);(dccp_v4_do_rcv)
-> dccp_rcv_state_process()
-> dccp_rcv_request_sent_state_process(sk, skb, dh, len);
-> icsk->icsk_af_ops->rebuild_header(sk); (inet_sk_rebuild_header)
-> inet_sk_reselect_saddr(sk))
-> __sk_prot_rehash(sk);
-> sk->sk_prot->hash(sk);
-> inet_hash(struct sock *sk)
-> __inet_hash(struct sock *sk)
-> inet_listen_wlock(hashinfo);
-> write_lock(&hashinfo->lhash_lock);
>
>> so using read_lock() here isn't safe, just substitudes by read_lock_bh().
>>
>> Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
>
> I don't think this is necessary.
>
> The only place the write lock is obtained, is via
> the ->hash() and ->unhash() sk_prot operation methods.
>
> And for listening sockets that only occurs in normal base
> context. Never from softirqs.
>
> If there is a patch from softirqs where this can occur,
> that is a bug and must be fixed.
>
>
>
--
Regards
Gui Jianfeng
next prev parent reply other threads:[~2008-06-30 3:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-20 9:08 [PATCH] Prevent from potential dead lock for inet_listen_lock Gui Jianfeng
2008-06-28 2:32 ` David Miller
2008-06-30 3:16 ` Gui Jianfeng [this message]
2008-06-30 4:12 ` David Miller
2008-06-30 5:19 ` Gui Jianfeng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48685019.90706@cn.fujitsu.com \
--to=guijianfeng@cn.fujitsu.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).