summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Grover <andy.grover@oracle.com>2009-04-01 12:20:18 +0400
committerDavid S. Miller <davem@davemloft.net>2009-04-02 11:52:21 +0400
commitf1cffcbfcc53b825da7d1d26244aabd8dccb24aa (patch)
treed71e3c271b29eecfc685b96ab0cf15404bd84ba5
parentf1782852adb57c8daf76a56146424f6c2f7410b6 (diff)
downloadlinux-f1cffcbfcc53b825da7d1d26244aabd8dccb24aa.tar.xz
RDS: Fix m_rs_lock deadlock
rs_send_drop_to() is called during socket close. If it takes m_rs_lock without disabling interrupts, then rds_send_remove_from_sock() can run from the rx completion handler and thus deadlock. Signed-off-by: Andy Grover <andy.grover@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/rds/send.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/rds/send.c b/net/rds/send.c
index 1b37364656f0..104fe033203d 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -615,7 +615,7 @@ void rds_send_drop_to(struct rds_sock *rs, struct sockaddr_in *dest)
{
struct rds_message *rm, *tmp;
struct rds_connection *conn;
- unsigned long flags;
+ unsigned long flags, flags2;
LIST_HEAD(list);
int wake = 0;
@@ -651,9 +651,9 @@ void rds_send_drop_to(struct rds_sock *rs, struct sockaddr_in *dest)
list_for_each_entry(rm, &list, m_sock_item) {
/* We do this here rather than in the loop above, so that
* we don't have to nest m_rs_lock under rs->rs_lock */
- spin_lock(&rm->m_rs_lock);
+ spin_lock_irqsave(&rm->m_rs_lock, flags2);
rm->m_rs = NULL;
- spin_unlock(&rm->m_rs_lock);
+ spin_unlock_irqrestore(&rm->m_rs_lock, flags2);
/*
* If we see this flag cleared then we're *sure* that someone