mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-30 08:04:13 +08:00
IB/mthca: Fix memory leaks in error handling
Fix memory leaks in mthca_create_qp() and mthca_create_srq() error handling. Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
parent
59f174faff
commit
17e2e81951
@ -445,8 +445,10 @@ static struct ib_srq *mthca_create_srq(struct ib_pd *pd,
|
||||
if (pd->uobject) {
|
||||
context = to_mucontext(pd->uobject->context);
|
||||
|
||||
if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd))
|
||||
return ERR_PTR(-EFAULT);
|
||||
if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) {
|
||||
err = -EFAULT;
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
err = mthca_map_user_db(to_mdev(pd->device), &context->uar,
|
||||
context->db_tab, ucmd.db_index,
|
||||
@ -522,8 +524,10 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd,
|
||||
if (pd->uobject) {
|
||||
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);
|
||||
}
|
||||
|
||||
err = mthca_map_user_db(to_mdev(pd->device), &context->uar,
|
||||
context->db_tab,
|
||||
|
Loading…
Reference in New Issue
Block a user