Date: Tue, 7 Jun 2022 06:45:05 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 6953b4870f00 - stable/13 - ibcore: Fix possible memory leak in ib_mad_post_receive_mads() Message-ID: <202206070645.2576j5t4097824@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=6953b4870f00e4d2ef99ae561ae03da028cb21e6 commit 6953b4870f00e4d2ef99ae561ae03da028cb21e6 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:44:28 +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 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206070645.2576j5t4097824>