IPoIB: Avoid using stale last_send counter when reaping AHs
authorRoland Dreier <rolandd@cisco.com>
Sun, 18 Jun 2006 03:37:34 +0000 (20:37 -0700)
committerRoland Dreier <rolandd@cisco.com>
Sun, 18 Jun 2006 03:37:34 +0000 (20:37 -0700)
commit31c02e215700c2b704d9441f629ae87bb9aeb561
tree057b5e1de62cbecbbe6a0a4532e7eab0fd0313e4
parent9874e746550fbd366484621b8838b98589bb2a15
IPoIB: Avoid using stale last_send counter when reaping AHs

The comparisons of priv->tx_tail to ah->last_send in ipoib_free_ah()
and ipoib_post_receive() are slightly unsafe, because priv->tx_lock is
not held and hence a stale value of ah->last_send might be used, which
would lead to freeing an AH before the driver was really done with it.
The simple way to fix this is to the optimization of early free from
ipoib_free_ah() and unconditionally queue AHs for reaping, and then
take priv->tx_lock in __ipoib_reap_ah().

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/ulp/ipoib/ipoib_ib.c