From nobody Wed Jan 12 20:42:55 2022 X-Original-To: bugs@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 47BAC195D890 for ; Wed, 12 Jan 2022 20:42:55 +0000 (UTC) (envelope-from bugzilla-noreply@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 4JYzz26mX7z3sw0 for ; Wed, 12 Jan 2022 20:42:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 C7E0713D86 for ; Wed, 12 Jan 2022 20:42:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 20CKgsnc062079 for ; Wed, 12 Jan 2022 20:42:54 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 20CKgs3u062078 for bugs@FreeBSD.org; Wed, 12 Jan 2022 20:42:54 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 261033] Memory leaks in mlx5_ib_gsi.c Date: Wed, 12 Jan 2022 20:42:55 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: hselasky@FreeBSD.org X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642020175; 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: in-reply-to:in-reply-to:references:references; bh=Tz/UQQBFozcsbbfm76H2gcOMNz4PLfhaEuv6MFbcQ28=; b=gbGjwboDHFFXuNbUD1mc7J4soyYVN/lq/dhUKinV3aydBsgro9ojWu7JAgeyzDNHSedxmB 6CrJohamqDVUYw8W3OidDiulJM4X2ZZfmnAKGrWgYQcq7GkhR79P+Y9raQU5xGATeoKsaR 41jdr5b2NVVhyaiLTf4AB0F0K2sbrmWbwe69JOjdr7ptSU072oJW3HifbCee0MRApjvInT 2GmS9wreFkohyh6pkAiOBa4D64Nx9i33vct3yyVSFtYvWoZNkOmZy7g9NYg67w9Y+JlGjE jqZWeb6bpKFBwS/wO9W2vTZb7N+RTZia/jb29Mv/IfoXXx9DqsEnhuAn3ztRfA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642020175; a=rsa-sha256; cv=none; b=G0FWyk/AmusKR9opXlIGFOVWTPZzKFcoUKmB7DfivQlKxWgtrkrqxT1IxDbe7ksfctlzXt fbsx32QlFLtrbmGRHRRj3v4iFWjdGToevLvRjRFSpT1avrr2lCaQzYt7XamNn5zTv4E8yQ paip+YcmOjS9YZjvMxil9mcy9QsBn/ybPa/kMU+u+qVCGVXoEU8YhYDEGdxtukvxVbyCg3 Zh4ApzrANiqzF2kVYPbgCNzNjJNaNNkjNq23Thd7/07M39h1QdUqDkySC+KIgV6NXjmynb X6LfcHib7NuffJXjNPg56LRlVSEcYUaJiIt4UVfLjh2qEJ8mEKMsnQcKz7BwDQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D261033 --- Comment #3 from Hans Petter Selasky --- From Linus Torvalds, drivers/infiniband/hw/mlx5/gsi.c, the code is similar,= so then there is a bug in Linux too! To summarize: If "ib_destroy_qp(gsi->rx_qp)" fails, there will be a memory leak! I think that "ib_destroy_qp()" cannot fail in this case, but then the error check should be asserted and removed! --HPS int mlx5_ib_gsi_destroy_qp(struct ib_qp *qp) { struct mlx5_ib_dev *dev =3D to_mdev(qp->device); struct mlx5_ib_gsi_qp *gsi =3D gsi_qp(qp); const int port_num =3D gsi->port_num; int qp_index; int ret; mlx5_ib_dbg(dev, "destroying GSI QP\n"); mutex_lock(&dev->devr.mutex); ret =3D ib_destroy_qp(gsi->rx_qp); if (ret) { mlx5_ib_warn(dev, "unable to destroy hardware GSI QP. error %d\n", ret); mutex_unlock(&dev->devr.mutex); return ret; } dev->devr.ports[port_num - 1].gsi =3D NULL; mutex_unlock(&dev->devr.mutex); gsi->rx_qp =3D NULL; for (qp_index =3D 0; qp_index < gsi->num_qps; ++qp_index) { if (!gsi->tx_qps[qp_index]) continue; WARN_ON_ONCE(ib_destroy_qp(gsi->tx_qps[qp_index])); gsi->tx_qps[qp_index] =3D NULL; } ib_free_cq(gsi->cq); kfree(gsi->outstanding_wrs); kfree(gsi->tx_qps); kfree(gsi); return 0; } --=20 You are receiving this mail because: You are the assignee for the bug.=