netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
To: netdev <netdev@vger.kernel.org>, David Miller <davem@davemloft.net>
Subject: [PATCH] Prevent from potential dead lock for inet_listen_lock
Date: Fri, 20 Jun 2008 17:08:20 +0800	[thread overview]
Message-ID: <485B7384.1090204@cn.fujitsu.com> (raw)

hashinfo->lhash_lock might be acquired by write_lock() in softirq, 
so using read_lock() here isn't safe, just substitudes by read_lock_bh().

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
---
 include/net/inet_hashtables.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 97dc35a..2818c8a 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -254,9 +254,9 @@ extern void inet_listen_wlock(struct inet_hashinfo *hashinfo);
 static inline void inet_listen_lock(struct inet_hashinfo *hashinfo)
 {
 	/* read_lock synchronizes to candidates to writers */
-	read_lock(&hashinfo->lhash_lock);
+	read_lock_bh(&hashinfo->lhash_lock);
 	atomic_inc(&hashinfo->lhash_users);
-	read_unlock(&hashinfo->lhash_lock);
+	read_unlock_bh(&hashinfo->lhash_lock);
 }
 
 static inline void inet_listen_unlock(struct inet_hashinfo *hashinfo)
-- 
1.5.3




             reply	other threads:[~2008-06-20  9:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-20  9:08 Gui Jianfeng [this message]
2008-06-28  2:32 ` [PATCH] Prevent from potential dead lock for inet_listen_lock David Miller
2008-06-30  3:16   ` Gui Jianfeng
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=485B7384.1090204@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).