Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2769015imj; Mon, 11 Feb 2019 08:11:31 -0800 (PST) X-Google-Smtp-Source: AHgI3IbXBK0AkYgSpajaxDuS+CDqeodpR7ZXm80/ww5W3bYvcGue0mP/oSFlZZqHXRVkIVOhZRXc X-Received: by 2002:a17:902:b581:: with SMTP id a1mr37822778pls.36.1549901491660; Mon, 11 Feb 2019 08:11:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901491; cv=none; d=google.com; s=arc-20160816; b=t9SkY3d4pflnGnOxUfDQjUeP+zSBN9q7YrmWoVUKZ/lJ+ol8Afh/aUenxFlG3Qe4bp 6AFhiI44+6I5QghCGAAQ1cbYLXFoztryI0JX6EiS3wPilOh49s+dQqezShYICfkEjOgo QAmp7E/ba5cFNNVMmXAgJIjEJhy12URVe7ObK1SOK9H7Gx4dWpP/Tcb8k3GiXqjymm/u O0dM5ceehrj7sV9ZPj0ru79hml00dXP0squrYX9MGWAHDjLkcpcoLj4OZQmUxTM3Qp9T Hnx7GAgmPHsCBS5IWNKv4tciPDealSm8B+ufUi/BTM5kPf/D9M9BWJxoIqREIi8iLjfw x9Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7+Ip7w2OL997Ko5wuE88cSyqyrwsnGUi057OCvA2dbE=; b=MkzpLcLxjCwz3RjPGyJ/pF8lKiB1whOACh9s/6CON1Pk/3b8pU+IS8t2b42RGNWYRl jWQRmmMQkJESWv023kuYbPLmn3/U8UmTRqPigk/smruY96NFtH9WyI2uViIhTjH9ec+O aSeA3tOfi5tkfItopfyz7UUfrHA65+lI+YUhVioBzSVDDzp8j01QOP6S8RtwGv5p3Tko 54QD0snEupve9OIvNw6n7BiwSsmu00k6RPLGa9ajppn89RXG1n6fBUHOJSunsER/ISng h6vMysn9xkz052ZaL/DrPA+8pD5O5FOE7bm+ofsMS9yQM1mXEwfz5Zy2IS+FVMYEd5o9 Io9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OPMM1d4A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d17si9182922pgp.274.2019.02.11.08.11.14; Mon, 11 Feb 2019 08:11:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OPMM1d4A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729752AbfBKQKN (ORCPT + 99 others); Mon, 11 Feb 2019 11:10:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:58154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729266AbfBKOYv (ORCPT ); Mon, 11 Feb 2019 09:24:51 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 106BF20821; Mon, 11 Feb 2019 14:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895090; bh=fXCFkNbYIbfhyWhYvj/5WF4gvzzKw6XM/wkj2Y2/KUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OPMM1d4A7HHK9q0biEv0tJx2QYqvUX3ypREYhuc1eORBRbgTXcTVS1OnqOpiVqxOt dPXjZFylHwx5mx+9hckIiO6woDfx1L9dWgv3tOUEro8cgNsnhvlw4OJhfh+sb31lZg eT7k10P967RmiuinE1YcJUVn9Fr9GrCMQ/6EAWfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anatoly Trosinenko , "J. Bruce Fields" , Sasha Levin Subject: [PATCH 4.20 089/352] nfsd4: fix crash on writing v4_end_grace before nfsd startup Date: Mon, 11 Feb 2019 15:15:16 +0100 Message-Id: <20190211141851.588374355@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 62a063b8e7d1db684db3f207261a466fa3194e72 ] Anatoly Trosinenko reports that this: 1) Checkout fresh master Linux branch (tested with commit e195ca6cb) 2) Copy x84_64-config-4.14 to .config, then enable NFS server v4 and build 3) From `kvm-xfstests shell`: results in NULL dereference in locks_end_grace. Check that nfsd has been started before trying to end the grace period. Reported-by: Anatoly Trosinenko Signed-off-by: J. Bruce Fields Signed-off-by: Sasha Levin --- fs/nfsd/nfsctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 6384c9b94898..b33f9785b756 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -1126,6 +1126,8 @@ static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size) case 'Y': case 'y': case '1': + if (nn->nfsd_serv) + return -EBUSY; nfsd4_end_grace(nn); break; default: -- 2.19.1