Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3626726imu; Mon, 28 Jan 2019 08:04:30 -0800 (PST) X-Google-Smtp-Source: ALg8bN7EqEFA9s9lMN4cnCcVryMYQ4q45oXdr35fPWJNyGWsVoYCchXLGVYemjLiNQRnsSefMP+/ X-Received: by 2002:a17:902:e085:: with SMTP id cb5mr22067720plb.24.1548691470198; Mon, 28 Jan 2019 08:04:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691470; cv=none; d=google.com; s=arc-20160816; b=zL73ihC4QZlf2hWxn5hAGBvaPmLn5imrVYPUBN9FjYo6IQqBXXJqtiEGtw9Q06TUyi wGc3KoK118uXOakfahrtmvN4JTVhgJQ1LmGv1NxEO7AGhOlGb3/qk4vteQWCxB5/KBi1 R6rV30fv/bQJ9LFtNsjdP5FtrpbpML7KDytEZFRnH1WVvZ9UddI+98MGIYkbLxaCoc+9 eGz7MCe1BqEzdb6tT0bOLGNcb33GHYutfdrfvBMDnaEOVE92fFnQU+M1g/rFl5EQDFP+ oUeD+EPZ/ywMuADe+umD+HPbSuGd45un625YSEb8dMiM6dH+fooUQTzkp9JCVKLJjUEq tePA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tPHcF89YufFI7x+QXureXWrfnbuZOaQ/H1hHSk6nIwE=; b=ouiwzfnjyKNwCJDtzZpomA1QITufq1Yezu70CuO6T+DF7FngMol21JUf4qXLtWaxsn WOE5U+HR+iJCSaHc4aDD3rdmbMWG6TrRR9NowzzntD63WOn20XSnFsNFbenGmCxpIbEs 2q5Q5FYsN53w0L3sfgKktGpfFAKQjtyUqI+ti/no8lapjYtbvcShEgrqJL/Pr/3DZ6iL PW8UvoFcRfWIrFxZHAU8k1N4jNIFD8CeWUloy8BJVHv3QwpVhpoEK2G233/i6+BlcF4x +KaPDjQApZMWVeJKt2Iv0q4vS60S+vzmeSel4bpUrXOZnXebpf1amuf/EincpQgJpCZg cMzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AmrebvqC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g98si19808436plb.99.2019.01.28.08.04.13; Mon, 28 Jan 2019 08:04:30 -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=AmrebvqC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731383AbfA1QDX (ORCPT + 99 others); Mon, 28 Jan 2019 11:03:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:48664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731371AbfA1QDU (ORCPT ); Mon, 28 Jan 2019 11:03:20 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 215AB2175B; Mon, 28 Jan 2019 16:03:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691400; bh=yFmaWr2poVHxRTrHOvuMU2owI43FRFBpVtZfhpbG61g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AmrebvqCS7LDnqiNeK5AnLfwV/E8y5h4r683Jr6vkUxjQMNtIxT2RoCKkGeYgybqm rHuD6XqfKytjLWRndkJN2iq5nCd4bN9NZbFUg3BmPyMhd5q6XDI3NwtKr+GC/7/LA6 evVKMVBm5UsgD2ZQfTjbuNC00SO0ZLWBN92hucFc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "J. Bruce Fields" , Sasha Levin , linux-nfs@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 081/258] nfsd4: fix crash on writing v4_end_grace before nfsd startup Date: Mon, 28 Jan 2019 10:56:27 -0500 Message-Id: <20190128155924.51521-81-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "J. Bruce Fields" [ 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 7fb9f7c667b1..899174c7a8ae 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