git: ad7741ff693a - main - ibcore: Fix possible memory leak in ib_mad_post_receive_mads()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 19 May 2022 08:26:31 UTC
The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ad7741ff693a39bab59b75e432bd922a62f3ef0a commit ad7741ff693a39bab59b75e432bd922a62f3ef0a Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2022-05-19 08:06:42 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2022-05-19 08:13:06 +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 MFC after: 1 week Sponsored by: NVIDIA Networking --- 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 5f9c353052e8..9de97d749f6d 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -2874,6 +2874,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; }