From owner-svn-src-all@freebsd.org Wed Jul 8 19:57:25 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 500C736D527; Wed, 8 Jul 2020 19:57:25 +0000 (UTC) (envelope-from gordon@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B297n0gfcz3b0r; Wed, 8 Jul 2020 19:57:25 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDEAC25370; Wed, 8 Jul 2020 19:57:24 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 068JvO22018155; Wed, 8 Jul 2020 19:57:24 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 068JvOBY018153; Wed, 8 Jul 2020 19:57:24 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <202007081957.068JvOBY018153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Wed, 8 Jul 2020 19:57:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r363023 - in releng: 11.3/sys/compat/linuxkpi/common/src 12.1/sys/compat/linuxkpi/common/src X-SVN-Group: releng X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: in releng: 11.3/sys/compat/linuxkpi/common/src 12.1/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 363023 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jul 2020 19:57:25 -0000 Author: gordon Date: Wed Jul 8 19:57:24 2020 New Revision: 363023 URL: https://svnweb.freebsd.org/changeset/base/363023 Log: Fix kernel panic in LinuxKPI subsystem. Approved by: so Security: FreeBSD-EN-20:14.linuxpki Modified: releng/11.3/sys/compat/linuxkpi/common/src/linux_compat.c releng/12.1/sys/compat/linuxkpi/common/src/linux_compat.c Modified: releng/11.3/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- releng/11.3/sys/compat/linuxkpi/common/src/linux_compat.c Wed Jul 8 19:56:34 2020 (r363022) +++ releng/11.3/sys/compat/linuxkpi/common/src/linux_compat.c Wed Jul 8 19:57:24 2020 (r363023) @@ -1502,6 +1502,9 @@ linux_file_close(struct file *file, struct thread *td) KASSERT(file_count(filp) == 0, ("File refcount(%d) is not zero", file_count(filp))); + if (td == NULL) + td = curthread; + error = 0; filp->f_flags = file->f_flag; linux_set_current(td); Modified: releng/12.1/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- releng/12.1/sys/compat/linuxkpi/common/src/linux_compat.c Wed Jul 8 19:56:34 2020 (r363022) +++ releng/12.1/sys/compat/linuxkpi/common/src/linux_compat.c Wed Jul 8 19:57:24 2020 (r363023) @@ -1502,6 +1502,9 @@ linux_file_close(struct file *file, struct thread *td) KASSERT(file_count(filp) == 0, ("File refcount(%d) is not zero", file_count(filp))); + if (td == NULL) + td = curthread; + error = 0; filp->f_flags = file->f_flag; linux_set_current(td);