From nobody Wed Jan 11 23:50:52 2023 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 4Nskvw6rlhz2p4Zb; Wed, 11 Jan 2023 23:50:52 +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 4Nskvw6P98z45FM; Wed, 11 Jan 2023 23:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673481052; 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=B/8RFETCx9U7yU46ymyjbytFBA9tzVqiU8KkwltcKlQ=; b=Vb1BBygtQDyBJFs3svFuDnMuK9drXRJpnrRnTGXbcd+WnyCjGeGbyw3oJCBaQe0O5roWdI 4fFCmRvEgbgr5+bQs5iDgxUfXJzIBGj9P4xvdD0I7lME65qM2mlY8crGmCY9Z71QvV/m0j CiYfhxU6r7gYfbNAJmXPCpIXiDQJMlUsoI1Fg1HML/JaEPkVNtYeiVPL+J3mYILKQ/P7uF xdsk8d8w/8LPIQsInIm/14MzhL2chLEFfpnq2lEZtqx6LWa9iPtt+aFvUVnwzS7rDGLMhV dvCGappcViZo+rna7GcyDOlW1GYhIGmW1BcReZ0JHXPxlCHc906ZB4QG9hDx2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673481052; 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=B/8RFETCx9U7yU46ymyjbytFBA9tzVqiU8KkwltcKlQ=; b=wL24zJO/ae8a6f84auw9iABJvonBjCR2OqWNNCPVj8zG1/Bp/X7PoMVCkT4rSCM91sCXXc rt4O3fEyFIS8usBjQoOdDAY3nsYTBVFoUGvDsV/cUvyK8IlPtJpGgWqi0BNBxfZCw7ESid GajOQn6plRsv8utmItPUvFq4sNzkWsDHxoPQ1oAv9xptWm3CvzY0GrHAH82pazT9jyOVQV M4W16YL5+q1wvaW+T7MQVdVEvvDjAGTeAzECljKTD0CHMTidorAb7Gga4dgP2Om1dK1ZAr sVoCYjWoCzAghuOrEeuv0KczEbFnnPeI0nRjLc0P7AdXP5DqKchb+qV65ikPAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673481052; a=rsa-sha256; cv=none; b=QFzoHd0A5UpAtM6ECzYnVXCyXbQkkKosFamExPspAUv6qS8zjVaTTVCL5RJ8sJvYEgbKFv 5ThfuqpvdV9MGQtGb8peWVE0n2qhxVNy2ObtD41C3TFNq3Sud9n8NL8SWID2hLD/z+n4HR N/j9XmJwwdTpfQ1qh4x16R3ERQihsTu3gpi4ubWYUUe716FeSdiK+xibqhUR7on1PcZtRV gkuqFYzzG4/e9qf3wNikSM6j7ZNyqp5kECW+CcsiofUrwE+FJ68F727bqxshAPkIl+M9+e mJoaBHdWU66a3Q35L0P/H42dHvdyVy08Y+aQPdZTBS1r/JOjviXSXRRZhATmzg== 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 4Nskvw5Sqtz16Dr; Wed, 11 Jan 2023 23:50:52 +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 30BNoqtB031740; Wed, 11 Jan 2023 23:50:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30BNoqlU031739; Wed, 11 Jan 2023 23:50:52 GMT (envelope-from git) Date: Wed, 11 Jan 2023 23:50:52 GMT Message-Id: <202301112350.30BNoqlU031739@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 51e94a4658d2 - main - LinuxKPI: fix possible NULL dereference in linuxkpi_page_frag_alloc() 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51e94a4658d23016dd0ae67c189a89f53281cbcd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=51e94a4658d23016dd0ae67c189a89f53281cbcd commit 51e94a4658d23016dd0ae67c189a89f53281cbcd Author: Bjoern A. Zeeb AuthorDate: 2023-01-11 23:40:05 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-01-11 23:40:05 +0000 LinuxKPI: fix possible NULL dereference in linuxkpi_page_frag_alloc() Fix a possible NULL pointer deref in case alloc_pages() fails. This is theoretical so far as up to now no code in the tree uses linuxkpi_page_frag_alloc(). Reported by: Coverity via emaste Coverity ID: 1502345 Sponsored by: The FreeBSD Foundation MFC after: 3 days X-MFC-with: 55038a6306a570c9f2df89f5ad076de0f7d98152 --- sys/compat/linuxkpi/common/src/linux_page.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index 2bbe8f502cba..4c93d2f69354 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -451,6 +451,8 @@ linuxkpi_page_frag_alloc(struct page_frag_cache *pfc, "supported", __func__, fragsz)); pages = alloc_pages(gfp, flsl(howmany(fragsz, PAGE_SIZE) - 1)); + if (pages == NULL) + return (NULL); pfc->va = linux_page_address(pages); /* Passed in as "count" to __page_frag_cache_drain(). Unused by us. */