git: 33870019c5f2 - stable/12 - ibcore: Fix possible memory leak in ib_mad_post_receive_mads()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 07 Jun 2022 06:48:13 UTC
The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=33870019c5f247b4602f1f044feadcc46bafa514 commit 33870019c5f247b4602f1f044feadcc46bafa514 Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2022-05-19 08:06:42 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2022-06-07 06:46:10 +0000 ibcore: Fix possible memory leak in ib_mad_post_receive_mads() If ib_dma_mapping_error() returns non-zero value, ib_mad_post_receive_mads() will jump out of loops and return -ENOMEM without freeing mad_priv. Fix this memory-leak problem by freeing mad_priv in this case. Linux commit: a17f4bed811c60712d8131883cdba11a105d0161 PR: 264057 Sponsored by: NVIDIA Networking (cherry picked from commit ad7741ff693a39bab59b75e432bd922a62f3ef0a) --- sys/ofed/drivers/infiniband/core/ib_mad.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index 7bb6323a4c53..bf3b6f580526 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -2889,6 +2889,7 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, DMA_FROM_DEVICE); if (unlikely(ib_dma_mapping_error(qp_info->port_priv->device, sg_list.addr))) { + kfree(mad_priv); ret = -ENOMEM; break; }