From nobody Mon May 02 11:12:04 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 0AFBB1AC038A; Mon, 2 May 2022 11:12: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 4KsL5c6pqPz57wm; Mon, 2 May 2022 11:12:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651489925; 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=zDi3K+X/rMfl8TiQ+MI7uy8YqPJ3SnFnpoYxclP2puQ=; b=g61WWeYRuI/b+fzF+meFV5BCZV8Igv0qyE4YP55/InNkzqKn367PlGjz5OqF2wk5ul24Wd Dl0RyNehqProVEx2H8jqdE/Pp1Bf9c1kcwMiK6sKepf80ybcoTQjMTFZqpDCtkREbbT7Ik kmrGQx8vLzO0rk7WX9a7pBZp5SclHnrB8n0pAU+CCuYbyBl39AD63MOHmZvzuUAewkZTql znuYCEH2bO9dLXMKQd7LPAmSQbqoWT99Wm71xR+lyFTznXojlVhE6xpGG+cYqzKQY8czi9 RhJq7ZiovSpZrD/T4joCnP/JopS+W/l00on8T6AMXoDeTPoG469Xpd+PTCKWvw== 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 C9C0CA24; Mon, 2 May 2022 11:12:04 +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 242BC48c005850; Mon, 2 May 2022 11:12:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 242BC4KQ005849; Mon, 2 May 2022 11:12:04 GMT (envelope-from git) Date: Mon, 2 May 2022 11:12:04 GMT Message-Id: <202205021112.242BC4KQ005849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 6244b53e1658 - main - ibcore: Allow passing NULL-pointers to ib_umem_release() 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/main X-Git-Reftype: branch X-Git-Commit: 6244b53e16583308488e16b1680b0a94d3cac92e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651489925; 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=zDi3K+X/rMfl8TiQ+MI7uy8YqPJ3SnFnpoYxclP2puQ=; b=bmwBiadwAgAOpF9S97cLjidIdRJyTg6qjUQzDJf7rwubGIXXON7VFlsnc8uWNOalTZ13l7 OtREPwoccRxIkMmwhgt/levCHeoEBzoQ98fmdEZLcV1ozpEWIw0PpyXvhY34TeH9qJCbeJ o6aPmmBa/mMf8b8oSzeail3s8rBtN1fgHDHlZF3JI8yUwBOzTKQaLb+B13+qqcx90/EW5s Xb/oVUWIDC8OKXhziLIb1HoIkpj9Ug2bLyoajuiyvQa/8RW2asg11d4VaE50sIvnB+lwF1 37zNhSdO4fYwa50AszBLrtO2NVhiYZp67+5O+aWKVAUqpThUL+5JVoq4zMnGTw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651489925; a=rsa-sha256; cv=none; b=F8q5o1diuwD4Y1JsgJOyPo3Z8hVDCo8tMx6Tvzp9ibtxcimXgy2bThfKZ0ulIz85D/0ytg dAG/mjOUyBMuq56YKcFhF7nrq8Ydsf8EB7tmYOFhV5NvgyEqHz4Rmq3jwL7aPmpu8D3Sp+ hGggFgWtKjlFUKstJVUXcm4h3BuT9CyOaTHdxwRHzgtnDK3bqp13494n4yzFaDrhel/PCJ vDkTwUWpMbLZIsuvKJhKM47sdzofJ3yIv0nQXuIcaXWj+f3RwgGQax8B6PxluSRMduVudx whLqjQVrKaZ6QvLpKe85a0DOIO76MSqTYyfiCh/LY7Ko5VeLYuivHh8R43MBng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=6244b53e16583308488e16b1680b0a94d3cac92e commit 6244b53e16583308488e16b1680b0a94d3cac92e Author: Hans Petter Selasky AuthorDate: 2022-05-02 11:10:09 +0000 Commit: Hans Petter Selasky CommitDate: 2022-05-02 11:11:06 +0000 ibcore: Allow passing NULL-pointers to ib_umem_release() FreeBSD commit b633e08c705fe43180567eae26923d6f6f98c8d9 removed the NULL-checks from the mlx4ib-driver. This fixes the following NULL-pointer panic when unloading mlx4ib: ib_umem_release() mlx4_ib_destroy_qp() ib_destroy_qp_user() ipoib_transport_dev_cleanup() ipoib_dev_cleanup() ipoib_remove_one() ib_unregister_client() ipoib_cleanup_module() linker_file_sysuninit() linker_file_unload() kern_kldunload() amd64_syscall() Linux commit: 836a0fbb3e76f704ad65ddfb57f00725245e509b MFC after: 1 week Submitted by: dandan@lysator.liu.se Sponsored by: Lysator ACS Sponsored by: NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_umem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_umem.c b/sys/ofed/drivers/infiniband/core/ib_umem.c index 48df27522a50..889908eed688 100644 --- a/sys/ofed/drivers/infiniband/core/ib_umem.c +++ b/sys/ofed/drivers/infiniband/core/ib_umem.c @@ -248,11 +248,13 @@ static void ib_umem_account(struct work_struct *work) */ void ib_umem_release(struct ib_umem *umem) { - struct ib_ucontext *context = umem->context; struct mm_struct *mm; struct task_struct *task; unsigned long diff; + if (!umem) + return; + if (umem->odp_data) { ib_umem_odp_release(umem); return; @@ -279,7 +281,7 @@ void ib_umem_release(struct ib_umem *umem) * up here and not be able to take the mmap_sem. In that case * we defer the vm_locked accounting to the system workqueue. */ - if (context->closing) { + if (umem->context->closing) { if (!down_write_trylock(&mm->mmap_sem)) { INIT_WORK(&umem->work, ib_umem_account); umem->mm = mm;