From nobody Tue Jun 07 06:48:13 2022 X-Original-To: dev-commits-src-all@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 21E511BD743C; Tue, 7 Jun 2022 06:48:14 +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 4LHLXY6JCNz3pHs; Tue, 7 Jun 2022 06:48:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654584493; 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=lgZpn3cVl/WH+s46ctt8Z/yE1FXlkHRWY8I7DhWGe5Q=; b=nHDjndpi6ZD0aoLCTkpdtKYkwkflcxjBGLiiq5N8SNhVCbTskC3XpU1fbAVLXIlJCrI5LH LaZ8oJNASPSyFCVqymru60yVELwN9ivKPSsnrcZjQ/3Bq7JJt0ERlkJpgw80ENpCv24RuA P6RwEl/xNWX1oUzPo7QuuEna6jHkHioWx9YBp6mZnwNIaAqHQSmFraZNUuiMRuBhi7l84j rFkwb++vgNc7p5u1yRX0DhNkpDZtB+hDcHd74J+CYA4HOnPwbP+GdYoTNpJ0LS0RZD6XD6 +k3sWODpUnwvcEOgETcKBWDak/k1KuQoTnxyGk4JT2oEIV2Hprp+mgxuCg03Rw== 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 91E8C1630E; Tue, 7 Jun 2022 06:48:13 +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 2576mDpu098277; Tue, 7 Jun 2022 06:48:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2576mDls098276; Tue, 7 Jun 2022 06:48:13 GMT (envelope-from git) Date: Tue, 7 Jun 2022 06:48:13 GMT Message-Id: <202206070648.2576mDls098276@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: 33870019c5f2 - stable/12 - ibcore: Fix possible memory leak in ib_mad_post_receive_mads() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/12 X-Git-Reftype: branch X-Git-Commit: 33870019c5f247b4602f1f044feadcc46bafa514 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654584493; 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=lgZpn3cVl/WH+s46ctt8Z/yE1FXlkHRWY8I7DhWGe5Q=; b=eZiJOg0R9+LofG/XAk9ir12ScVgIV9qT0Z7KR4KjtXNUx2RtwlhKY/o3/aoso2SWfHfAcV dj61GFOzR9Du0GlW24mzW/wlAF+jIFYb73iR6mJPap3NYRtrQZh7a8bPUPUowyoC8IQGc3 rGp9X5FEeKOd4r4Db9BCKwNQGzH6+mSS4u8rQzMXPZsxZ8XWDjORvxmk0hGgNRFJKTnW85 tInU5/Aoxu2GHPOFiM/a1ksNM3DqulNQDn4RN6oXCp6X+7ZJWRtRVfx834SVuhmlLwk80Y Bfi9IJOqmQrJhzQCR6+whGGrOriIbVAUB6Y0N/g2mIbkNh9yPvgL3m/PKZd9xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654584493; a=rsa-sha256; cv=none; b=Ku5RqVkgb+UOlsU9mE0WBCqxdyIwRGWxUYiD6wN0THDRlGZiwKsY/q6ijQIln6zMwxvPRt Lc8UrQN3MhQOXFuta0+kq8j+J83LVxMQJdusc2II85hHFuodsWTPqOqr4ma77wqLtrKJ1Q A8NDizKy0aBd8dZ2JujkmV03/Ru9OhyI3TckDZClOawLyXRtJ3cJ0N0gjFGH828+gsjiyz LSMSnRjJXsuvCNXPG/SkaNGZu8VZ1deRDU8isoh379iVuK6jUdEwrf97XtlU7P3CjyWHP0 abZ4MX4TV2JE+kpymP+ryCZt84GvZyZL/Eox8QuLjGP3ro9KleufOB6wCaExTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=33870019c5f247b4602f1f044feadcc46bafa514 commit 33870019c5f247b4602f1f044feadcc46bafa514 Author: Hans Petter Selasky AuthorDate: 2022-05-19 08:06:42 +0000 Commit: Hans Petter Selasky 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; }