]> git.kernelconcepts.de Git - karo-tx-linux.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)
commitdfcec251d22bab947d10cf37e9ad67085cf7f097
treedd9ef3f30a176b7aebe4dd24f9c73a1ff49939a9
parent1c3be624f40acd6f2bd0f22ade081ac2467e8617
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