diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index 08a57939d47f49..f095a6aded2373 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -494,6 +494,9 @@ static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf, mutex_lock(&mut); idr_remove(&ctx_idr, ctx->id); mutex_unlock(&mut); + mutex_lock(&file->mut); + list_del(&ctx->list); + mutex_unlock(&file->mut); kfree(ctx); return ret; }