Skip to content

Commit

Permalink
RDS: lock rds_conn_count decrement in rds_conn_destroy()
Browse files Browse the repository at this point in the history
rds_conn_destroy() can race with all other modifications of the
rds_conn_count but it was modifying the count without locking.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
  • Loading branch information
Zach Brown authored and Andy Grover committed Sep 9, 2010
1 parent ea81986 commit fe8ff6b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/rds/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ void rds_conn_shutdown(struct rds_connection *conn)
void rds_conn_destroy(struct rds_connection *conn)
{
struct rds_message *rm, *rtmp;
unsigned long flags;

rdsdebug("freeing conn %p for %pI4 -> "
"%pI4\n", conn, &conn->c_laddr,
Expand Down Expand Up @@ -350,7 +351,9 @@ void rds_conn_destroy(struct rds_connection *conn)
BUG_ON(!list_empty(&conn->c_retrans));
kmem_cache_free(rds_conn_slab, conn);

spin_lock_irqsave(&rds_conn_lock, flags);
rds_conn_count--;
spin_unlock_irqrestore(&rds_conn_lock, flags);
}
EXPORT_SYMBOL_GPL(rds_conn_destroy);

Expand Down

0 comments on commit fe8ff6b

Please sign in to comment.