]> git.baikalelectronics.ru Git - kernel.git/commit
RDS: make sure rds_send_drop_to properly takes the m_rs_lock
authorsantosh.shilimkar@oracle.com <santosh.shilimkar@oracle.com>
Sat, 22 Aug 2015 22:45:33 +0000 (15:45 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Aug 2015 20:35:31 +0000 (13:35 -0700)
commit80898859f5b6bc62f6e719e37532a759a0803939
treedd9ef3f30a176b7aebe4dd24f9c73a1ff49939a9
parent369136c47c37920e30796be375d2e0d6308d8745
RDS: make sure rds_send_drop_to properly takes the m_rs_lock

rds_send_drop_to() is used during socket tear down to find all the
messages on the socket and flush them .  It can race with the
acking code unless it takes the m_rs_lock on each and every message.

This plugs a hole where we didn't take m_rs_lock on any message that
didn't have the RDS_MSG_ON_CONN set.  Taking m_rs_lock avoids
double frees and other memory corruptions as the ack code trusts
the message m_rs pointer on a socket that had actually been freed.

We must take m_rs_lock to access m_rs.  Because of lock nesting and
rs access, we also need to acquire rs_lock.

Reviewed-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
Signed-off-by: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/send.c