From nobody Mon Jun 20 11:12:49 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 844E9868147; Mon, 20 Jun 2022 11:12:50 +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 4LRRnt0J96z3hRh; Mon, 20 Jun 2022 11:12:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655723570; 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=P5Zm4S5PG63Afn8sY6MJy3NjB5LXEbr0sVXXVBiugvs=; b=FRwAwGDfvkJjBB38vIOI2DOFiHXAFzjlSL0yk4Gh66IAV6cyPpmogW+ST7QsutDVWDQJ6I ReTSmL9Tbb9qzD8MQHgebPHXhnkA1EIvjUC7UnNK9wMBbm8oLf7nX/HQiRziubdgo6onEc shewhLbZWVyXo/wq/B3so/86GeRwMj7+eF+CLOMRFknD4qrL2csA3OYxeRghuogybmumhZ hoQSvzo2dtV893SB69VJquHp1m19PlE7Che6cWzT3FFQFPSYhOUAm0qaP03Njww9f8iVku ftZTE/bnh/UpXtEBm+FxUO2DAHLefMWkEicni3NsUTpVy1YiqlIQyqUjv3lkbw== 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 C11141C1E5; Mon, 20 Jun 2022 11:12:49 +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 25KBCn7e079079; Mon, 20 Jun 2022 11:12:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25KBCnSZ079078; Mon, 20 Jun 2022 11:12:49 GMT (envelope-from git) Date: Mon, 20 Jun 2022 11:12:49 GMT Message-Id: <202206201112.25KBCnSZ079078@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: 492f5e649493 - stable/13 - mlx5ib: Fix memory leak in clean_mr() error path 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/13 X-Git-Reftype: branch X-Git-Commit: 492f5e649493fa7ae3a4ff4df886ba4312ffa8db Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655723570; 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=P5Zm4S5PG63Afn8sY6MJy3NjB5LXEbr0sVXXVBiugvs=; b=VclHoohPi2QrYJGbqf2GPeVHkkq65qKshcL5gn/U76x/NcdwX/l+Vfkx+vwFIx3ZtFlWaO t/8CneeKBCIBAl10ClUUDfgCQt1dRbh6iVm0aEQjCRV0rNjcFSFwAbJdK6igC4FbfoUEDf uxoz3DTnpnWv/Mm6Ezif7I0aTmHN4nhGM+0+2ikXzGNTkVIjCVDGEZCulp6D1pFUnAX1PA Ja0gZtFWc0zPn3uq7S5xyVf4D1ol+m1KipLetW4fhu/t7PuT8ELzJLZxNjVJ80Bpuxzp20 xusYeFeMZ83llw5G9jOPCE2Qp8iBjh1TKTZVCiV6cA1kWQ31nLbMpHWAgfSfHA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655723570; a=rsa-sha256; cv=none; b=bmXvRC4eRq7mwjGXnpS79KwFm/am21Z/wGWFp7z6cBQbi9HoPczubgtpKNAxb53Hg7RuTx Z+YFv2u4zg2xJ8SvOfi3SfnKqws1Rqzm+BlUnVOLsylqD++FcyyJLsPca3/1a2TJAmEk22 8OHJ3BtnNhRJy/9+2j1GVBlrzU2knUWPuGJ5zpJ0u3oLo4A72es9KH/w0PP+ZB69NEbx+g 7U0/KzbjMX3gtNXQTm+7+LGtY7ACzPtFYygvBYLrjug80ZTkIM4y6iN/mLZLFI39Mmtc+F 5Uxbx8/xdgcOyWkabBdESHbXp+qNVRPwQprF/D3b69DUzhXQLJlHB5wQxO+kgA== 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=492f5e649493fa7ae3a4ff4df886ba4312ffa8db commit 492f5e649493fa7ae3a4ff4df886ba4312ffa8db Author: Hans Petter Selasky AuthorDate: 2022-06-13 14:46:47 +0000 Commit: Hans Petter Selasky CommitDate: 2022-06-20 11:08:39 +0000 mlx5ib: Fix memory leak in clean_mr() error path In the clean_mr() error path the 'mr' should be freed. Linux commit: 5942d8ae411775b76e5e1ab0cce57b0666516f2d PR: 264653 Sponsored by: NVIDIA Networking (cherry picked from commit e4d178d093281419c5ad9dea1c497bceb54d0018) --- sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c index 6e4122f57f4b..5e6bd7a8dcca 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c @@ -1285,10 +1285,13 @@ static int clean_mr(struct mlx5_ib_mr *mr) mlx5_free_priv_descs(mr); if (!umred) { + u32 key = mr->mmkey.key; + err = destroy_mkey(dev, mr); + kfree(mr); if (err) { mlx5_ib_warn(dev, "failed to destroy mkey 0x%x (%d)\n", - mr->mmkey.key, err); + key, err); return err; } } else { @@ -1300,9 +1303,6 @@ static int clean_mr(struct mlx5_ib_mr *mr) free_cached_mr(dev, mr); } - if (!umred) - kfree(mr); - return 0; }