mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-14 06:26:43 +07:00
IB/hns: fix memory leak on ah on error return path
When dmac is NULL, ah is not being freed on the error return path. Fix
this by kfree'ing it.
Detected by CoverityScan, CID#1452636 ("Resource Leak")
Fixes: d8966fcd4c
("IB/core: Use rdma_ah_attr accessor functions")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
aa939c12ab
commit
5b59a3969e
@ -64,8 +64,10 @@ struct ib_ah *hns_roce_create_ah(struct ib_pd *ibpd,
|
||||
} else {
|
||||
u8 *dmac = rdma_ah_retrieve_dmac(ah_attr);
|
||||
|
||||
if (!dmac)
|
||||
if (!dmac) {
|
||||
kfree(ah);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
memcpy(ah->av.mac, dmac, ETH_ALEN);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user