summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2020-05-06 10:46:57 +0300
committerJason Gunthorpe <jgg@mellanox.com>2020-05-12 21:32:53 -0300
commit09fb406a569b2f4b596048e1cfa2c92a35b8fc9b (patch)
tree7c1343e29c17d6021430dd50fb9d724346a8055f /drivers/infiniband/core
parent9767a27e1aeb462812e9f054c313180eeff0b5c3 (diff)
downloadlinux-09fb406a569b2f4b596048e1cfa2c92a35b8fc9b.tar.gz
linux-09fb406a569b2f4b596048e1cfa2c92a35b8fc9b.tar.bz2
linux-09fb406a569b2f4b596048e1cfa2c92a35b8fc9b.zip
RDMA/cm: Add a note explaining how the timewait is eventually freed
The way the cm_timewait_info is converted into a work and then freed is very subtle and surprising, add a note clarifying the lifetime here. Link: https://lore.kernel.org/r/20200506074701.9775-7-leon@kernel.org Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r--drivers/infiniband/core/cm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 6a2a5f6e6d90..74c46b0272b9 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -1025,6 +1025,11 @@ static void cm_enter_timewait(struct cm_id_private *cm_id_priv)
msecs_to_jiffies(wait_time));
spin_unlock_irqrestore(&cm.lock, flags);
+ /*
+ * The timewait_info is converted into a work and gets freed during
+ * cm_free_work() in cm_timewait_handler().
+ */
+ BUILD_BUG_ON(offsetof(struct cm_timewait_info, work) != 0);
cm_id_priv->timewait_info = NULL;
}