Skip to content

Commit 810dbc6

Browse files
BernardMetzlerjgunthorpe
authored andcommitted
RDMA/iwcm: Fix iwcm work deallocation
The dealloc_work_entries() function must update the work_free_list pointer while freeing its entries, since potentially called again on same list. A second iteration of the work list caused system crash. This happens, if work allocation fails during cma_iw_listen() and free_cm_id() tries to free the list again during cleanup. Fixes: 922a8e9 ("RDMA: iWARP Connection Manager.") Link: https://lore.kernel.org/r/[email protected] Reported-by: [email protected] Signed-off-by: Bernard Metzler <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 12e5eef commit 810dbc6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/infiniband/core/iwcm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,10 @@ static void dealloc_work_entries(struct iwcm_id_private *cm_id_priv)
159159
{
160160
struct list_head *e, *tmp;
161161

162-
list_for_each_safe(e, tmp, &cm_id_priv->work_free_list)
162+
list_for_each_safe(e, tmp, &cm_id_priv->work_free_list) {
163+
list_del(e);
163164
kfree(list_entry(e, struct iwcm_work, free_list));
165+
}
164166
}
165167

166168
static int alloc_work_entries(struct iwcm_id_private *cm_id_priv, int count)

0 commit comments

Comments
 (0)