From nobody Tue Jun 7 06:45:05 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9B45B1BD60B2; Tue, 7 Jun 2022 06:45:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LHLSx3kKlz3mfC; Tue, 7 Jun 2022 06:45:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654584305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZaxyadRCd3KSESAjMzHWhQ8SNn2glPCBLujsSdLLUAA=; b=uOSf/wBAcqVFKdFsEp/YdUxKPTq8ON2BrxNgKDNUyorMt81R2ECKFykrrka3IUVubW3AQh dZgB17l9PydF/9+188jAW+eqtuCbWPYl85IxfVDBXh3qfEi80EpETdBfnWEBTXNOuUIj8f DR7ijc4DdD42lK85FrHi1IfkoxVPfEd4DrnRZP3sErZfT2kMUMB4yfhe2UQibwOuHn62m9 t19pTETX9W3Yb4PgsqxEE3K0IMSUwVABxH7WyGdmMO7tSE7Cq1Tyn4Jz1RUPuBWK+Givcs 7oaMPOD8vpLoQieka1Z/qUhoo1uQtsD5a2ijEsmvtQ7Fov7cLMgl/fEnku5r/w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C13F162DB; Tue, 7 Jun 2022 06:45:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2576j5tP097825; Tue, 7 Jun 2022 06:45:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2576j5t4097824; Tue, 7 Jun 2022 06:45:05 GMT (envelope-from git) Date: Tue, 7 Jun 2022 06:45:05 GMT Message-Id: <202206070645.2576j5t4097824@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 6953b4870f00 - stable/13 - ibcore: Fix possible memory leak in ib_mad_post_receive_mads() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6953b4870f00e4d2ef99ae561ae03da028cb21e6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654584305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZaxyadRCd3KSESAjMzHWhQ8SNn2glPCBLujsSdLLUAA=; b=jZFciuFCF/m5auqypICWhLBhhIsqZQhPZGWv01MnxnDOsfYeo71vpJ6rGcIkRcUSS3Fo3E aD+GLheAOUQT2G0eAjgrKO57JbOmHSvSm7NsuMSKovtgoZXKl5uk7XToKdcnpRZMLXfzyY hY7yhLiqaevS7xE8cHkrwatBU2qOh/7XFtRmipnRnIoiyvK6jTih4gIjGLXcnW8souWGKj rXXdSvk/kHkeGP2vvHooglTKU6KWRwSDc7dL6Wu/vZeo1zEWj5I+FSBGKpcZr2ct00BOt2 KMoDOZxu6Xoumcq+hzIG5n3ajIRqIOhnxPLE47gJj/J1rPcC5MLqcx+UhCtlXg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654584305; a=rsa-sha256; cv=none; b=u9WRm26BK3f1w0+Oe/yKI5wgJIF1YWUP57/6+PL0MUqLsiWKZOnS0NoNyHPw/uVn2LykJc vh1BBLVkSIvtRnKsHYNF0vqqXrpPPZ620FIXNaxM6ekZwwQT3cFH6fCkiqNuobBrgX3Z3Z A7oHfGSOLzK3A5Bk4U7RERuCJRmZKzcAZosKOhA+xD//BvIa0AsOoh2kDGxucLuTrOD7Y9 kVzwbiMq5pZttf0TmFNpgM2EUpM8IilWqz3AMbeCImm5UzvNR7kgmlfu+6NdLky1NpnYMh 3ohRhX7QCt2aIl6fpcPj1THOUYPCK6SaEWuWNJMqrsLS7Aum/KeohbwqlHa/Fg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=6953b4870f00e4d2ef99ae561ae03da028cb21e6 commit 6953b4870f00e4d2ef99ae561ae03da028cb21e6 Author: Hans Petter Selasky AuthorDate: 2022-05-19 08:06:42 +0000 Commit: Hans Petter Selasky 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; }