From nobody Wed Jul 27 09:36:46 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 4Lt7vy5r3Dz4WvwP; Wed, 27 Jul 2022 09:36:46 +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 4Lt7vy5Fk8z4NPf; Wed, 27 Jul 2022 09:36:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658914606; 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=U7Gk5oYMr+kZYkdTHYCXytU7CxUVi8N/FYzHaDkYeKQ=; b=YWdWKgaAqzP/01rUNttAa6vhJUXoiWFQ5skL9v+/gQCFxvj5lFlIKvaOW4KaoqCNj27kYg oO3bQx3Zv+YoZ5/nevHBNCycnRNj11rhrfCg8ebIWPXa9iirBXz2n4FBmslqNxuNtR6zNl w/vMsv9Z/Jw3UegZVk9mNRBFEziuSs8LvduPvWTo8R2pr3HTIXPaDwq1jBZ2Wi0OuvPrwk 88GSgkY/NBPfWpXPkNQhQm7A+AsI0X3yVaKEvlOtoKlHp0zodFUFyE/gfFNiqr6SaGMz/g yH9arK3elyl9a/xK+wrsYA2WuouCaErfGOIjo5zY/5ELV4DjNa4NHrU42lNQww== 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 4Lt7vy4Kx0z1BdP; Wed, 27 Jul 2022 09:36:46 +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 26R9akcx072618; Wed, 27 Jul 2022 09:36:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26R9akrs072617; Wed, 27 Jul 2022 09:36:46 GMT (envelope-from git) Date: Wed, 27 Jul 2022 09:36:46 GMT Message-Id: <202207270936.26R9akrs072617@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: 412b95f77d99 - stable/13 - cuse(3): Make cuse_vmfree() NULL safe. 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: 412b95f77d9961babfc23b75190e60f86ff42225 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658914606; 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=U7Gk5oYMr+kZYkdTHYCXytU7CxUVi8N/FYzHaDkYeKQ=; b=COniM+Q40LZrMN0uDgW/Jhl+nCTR6sJN6/sCdVHh5FAvkmw1PgPC5d+BslxoE4UjJhiygC Iwp3YbMt9Ism5+1nJ+IQuTUCvKmPbHLJTGeKtMpSwx1j9cDXhahFdoh0MaxVCG6vkqhvit h6wFaLggdwZFj0bZIhVh+A2665zJi6dvAAba7eChJqzUTvQOAywGzcOjDIK1/Ln+cJlkCq CtqEpze7hfyTpTp6GuAz+xMzY3nVhOxVXKnCwbmpDsj1uipX3xufbp4BF9++CXjdWmU4im dqeKh0ryqotsKIWybuCaJtuaNrj9uw+XKgqALT7EekHFEebzPdHP4A7AhlhVkw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658914606; a=rsa-sha256; cv=none; b=KzBh51CJLFOCl+lQJmR0bZ7V0+u3WhmYG3nZhO/MlJWShQl41L6lXE7OHL3rt4o3+W8HBa mNuM5aC3+OGkTBA04UA/1YAFGNnusWankm+niGqo9UIS0zGTeqAu9kw411m0W/x9P+FsMh QoSGFL4bXvKVSEuIi3z732AnNltNZgnFLZZYNRuyp958bOKdfKwJE60nsVj07cqRp3/JI2 GAWyfikdn4FiloXFka5/6vLLpSD5OB0WXZmavh+7J3VWg2rqCM02P1DXIP5CZL38iKS4/Q WuhJVJ5QW5j8LH08Su6zSqaFeXf6oTePDaRVwoRECWjWkPq0BxSzrr/ftBnCug== 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=412b95f77d9961babfc23b75190e60f86ff42225 commit 412b95f77d9961babfc23b75190e60f86ff42225 Author: Hans Petter Selasky AuthorDate: 2022-07-13 15:54:24 +0000 Commit: Hans Petter Selasky CommitDate: 2022-07-27 09:33:51 +0000 cuse(3): Make cuse_vmfree() NULL safe. Sponsored by: NVIDIA Networking (cherry picked from commit 2ca43c3dba1b818db9245027c87fddfc9d4be0a6) --- lib/libcuse/cuse.3 | 1 + lib/libcuse/cuse_lib.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libcuse/cuse.3 b/lib/libcuse/cuse.3 index 74888a687be8..aab8ebb4d4f4 100644 --- a/lib/libcuse/cuse.3 +++ b/lib/libcuse/cuse.3 @@ -136,6 +136,7 @@ Else this function returns zero. .Fn "cuse_vmfree" "void *" This function frees memory allocated by .Fn cuse_vmalloc . +This function is NULL safe. Note that the cuse library will internally not free the memory until the .Fn cuse_uninit diff --git a/lib/libcuse/cuse_lib.c b/lib/libcuse/cuse_lib.c index fda0c96d0d70..d241ce1dc4ac 100644 --- a/lib/libcuse/cuse_lib.c +++ b/lib/libcuse/cuse_lib.c @@ -269,7 +269,7 @@ cuse_vmfree(void *ptr) int error; int n; - if (f_cuse < 0) + if (f_cuse < 0 || ptr == NULL) return; CUSE_LOCK();