Commit 17e2e819 authored by Jack Morgenstein's avatar Jack Morgenstein Committed by Roland Dreier

IB/mthca: Fix memory leaks in error handling

Fix memory leaks in mthca_create_qp() and mthca_create_srq()
error handling.
Signed-off-by: default avatarJack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 59f174fa
...@@ -445,8 +445,10 @@ static struct ib_srq *mthca_create_srq(struct ib_pd *pd, ...@@ -445,8 +445,10 @@ static struct ib_srq *mthca_create_srq(struct ib_pd *pd,
if (pd->uobject) { if (pd->uobject) {
context = to_mucontext(pd->uobject->context); context = to_mucontext(pd->uobject->context);
if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) {
return ERR_PTR(-EFAULT); err = -EFAULT;
goto err_free;
}
err = mthca_map_user_db(to_mdev(pd->device), &context->uar, err = mthca_map_user_db(to_mdev(pd->device), &context->uar,
context->db_tab, ucmd.db_index, context->db_tab, ucmd.db_index,
...@@ -522,8 +524,10 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd, ...@@ -522,8 +524,10 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd,
if (pd->uobject) { if (pd->uobject) {
context = to_mucontext(pd->uobject->context); context = to_mucontext(pd->uobject->context);
if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) {
kfree(qp);
return ERR_PTR(-EFAULT); return ERR_PTR(-EFAULT);
}
err = mthca_map_user_db(to_mdev(pd->device), &context->uar, err = mthca_map_user_db(to_mdev(pd->device), &context->uar,
context->db_tab, context->db_tab,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment