Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2682537imj; Mon, 11 Feb 2019 06:59:30 -0800 (PST) X-Google-Smtp-Source: AHgI3IYky5+AgYFA2WcExFcvwDth75dZT+Kg1vU0qp286gIG1DEE/ukRW5Z6rHrD91PSBJTwaB3g X-Received: by 2002:a63:d052:: with SMTP id s18mr27693047pgi.11.1549897170766; Mon, 11 Feb 2019 06:59:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897170; cv=none; d=google.com; s=arc-20160816; b=RoAORcZhj5eCEriFnpSHdOf1c6YGjG4W+xj31Cn3OlYLoxE34usaYbW0lNAsK5nNa4 QykU1m048cmUOhrN8VPekFfaqIT9xWAsLd+YsgNBxL6d2NDpieoI2P84R7nrthsnmeh9 CFWBe6mz9iIQhKVIvlAUbyzXXgJSVCI4V0VLyASTEUtc0dQApYqPBZJjMgXRqrwcfAMu 3my3fKwickNHYHeKTl4D3XnE4zLkjN4TM2+XTOxJGQQ2GeGF4GD5be48WmSWzbzml7C6 +PATrVNhE4rbtGfWlex5bjX+GXzqpQu5+09KibAufKBycOGnaah6D3ykuDGgmKDMyItm PH+A== 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=tKHsR6/ozJhxW0EPtuiP6eW8MIqLjOiPi/S+uAlt3i4=; b=TRtsCpit7a4eVOd5uNBXXZRbooUYm6+w1myvHaAlwppVcpmuESKyIY0A38d+U6Z5bR KP5Z4Pf1dMfR35W2E+/rpbsjm4uv1pcXTxC4DJwLh71KZPIgEDr9i/oLaLWQUrVSG+8s V79PsKR4CK4xpwYGs4Ehf42OyO6LJprVuiW1gesacCHu8dlfvhYZfaCIhimyYZ4pBCZg RZS6k94tl5jeO/aE7eWXggTvA2n3t6vAID8ALSSkYDxgj0dGnoi7dbXvRaGrjNzA1Qqm riOlP5u7BbBtJ1ijUZk/1YVwlbSBrs7hm8oAvlCgVnNvHykjxPvaaIyFyeLdePKtFhVC BR8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="AsOg+/Cr"; 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 f7si7632557pga.87.2019.02.11.06.59.14; Mon, 11 Feb 2019 06:59: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="AsOg+/Cr"; 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 S2389523AbfBKO6V (ORCPT + 99 others); Mon, 11 Feb 2019 09:58:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:45912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389514AbfBKO6U (ORCPT ); Mon, 11 Feb 2019 09:58:20 -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 E87732229E; Mon, 11 Feb 2019 14:58:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897099; bh=iVrcdKRjcKxKjCaIp25sZ5erMxdlQnKGUxJrYXL1Dhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AsOg+/CrybKQoznQPBz5gWBoBO7qK52RSkKtk7gZoaosM7EW8BkbGjLjecbqKtXXE 36boExmJtrQQUf2+e22ZEWazFyT0d4upGSlI3kRhBpRdLBL+uhfLWTqE1narvKB0UB eHBIqNfT5m7doYBOLJuRtUutYQ6cXIRk6vJa+Pco= 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.14 050/205] nfsd4: fix crash on writing v4_end_grace before nfsd startup Date: Mon, 11 Feb 2019 15:17:28 +0100 Message-Id: <20190211141832.121356052@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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 6493df6b1bd5..4b8ebcc6b183 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