Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp803876pxb; Tue, 3 Nov 2020 13:00:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaqgsGDEcyT4z/Ugt2AjtoONqe2kvH+zSrH3SNkUHK0COoqQlrxKFVsWYy5SZPtE6toqXz X-Received: by 2002:a50:ff02:: with SMTP id a2mr22957891edu.364.1604437249239; Tue, 03 Nov 2020 13:00:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437249; cv=none; d=google.com; s=arc-20160816; b=iapmNBeSZW9vN8qcziiw5R0tnX4ycDI9pERF0OFhFN62AX011QVTPicF7EuvPmREPu 5oKEqP/WLCtbgdAoLa3ls+qwC92t+SFYSd7k3UICtnoB4waoBACXuPblgxH/YXt8L917 yoZ4xI6rLGBSzL0Id0Pv3QBJkNsW7EQG7ZECxIswMYef6/eDXz9gPAgakV8U+mEx9iOV DsjqNKFlPnvcY5Q/M7xK2ut3W7k8q2dkLe5QkBLrFwn+5utfQPWhfzX4xVYY5L+pM1zl 7HQgjE2vDdtl7mvyhYRIW/8sXu56XfcmVn4ZSKqdq4/Wil8PYrFVZCSHUlN96pH9HlBf HFgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wcFN0k4+0XiAMHYSCYM0ieMAOSWV+E1egK147KpUjUU=; b=yHKhfXtbBj6Ctbq/nR+0tFVofUCEwEfEo+ss52SIKpBB9JMcLFacjWV+kkGuSk8AcH uLq4j4cICmbUFmSnQl3wuyMlNW0eMOjXqW7TIycazZx5NEgXkb7hIYw+F3T+ACXS5vDv Z9qV/ULwb8bYKmlSJjnv3FF7I31Lf1GOIMHXjcs1BBU3VFuWnQ/z1fW01bhnfDFIOgt5 nfQ8pGxPBWcUUGeJHQWOjGTODjzQ/LomQS60g4bjA3SvZj4//42H3agRm5gxKLRuUQcL L63eerSbZA+YG6ijm3vjUz+uFrlESA/OYwB0ZxWdplNpz5NJz7QoOsxeJIoYsfjEuAWm cuTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=puNZKkSa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k1si1108ejv.576.2020.11.03.13.00.26; Tue, 03 Nov 2020 13:00:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=puNZKkSa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733070AbgKCU7J (ORCPT + 99 others); Tue, 3 Nov 2020 15:59:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:33930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733052AbgKCU7F (ORCPT ); Tue, 3 Nov 2020 15:59:05 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 39B4222226; Tue, 3 Nov 2020 20:59:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437144; bh=nKmsieHP+Q5iP8RVEYxwtSZMk69vmjd3cYIPI16zKf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=puNZKkSaIvRKpb3fQ25GgCUTP9EtQHCKLKs/eZMXExHfrPtGe3BMl0HFQvnRjDvX+ FYOHE8NompNOO28MfdJWWr8NvPXaR7FFnI65MQr0Z+SA+mgYMpT8SKA+qByN0O1F3m n0zjBUqxoiqUV7eARHEo3P5hLH1lJx/vZQmezsBM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , "J. Bruce Fields" Subject: [PATCH 5.4 166/214] NFSD: Add missing NFSv2 .pc_func methods Date: Tue, 3 Nov 2020 21:36:54 +0100 Message-Id: <20201103203306.337882350@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuck Lever commit 6b3dccd48de8a4c650b01499a0b09d1e2279649e upstream. There's no protection in nfsd_dispatch() against a NULL .pc_func helpers. A malicious NFS client can trigger a crash by invoking the unused/unsupported NFSv2 ROOT or WRITECACHE procedures. The current NFSD dispatcher does not support returning a void reply to a non-NULL procedure, so the reply to both of these is wrong, for the moment. Cc: Signed-off-by: Chuck Lever Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfsproc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -118,6 +118,13 @@ done: return nfsd_return_attrs(nfserr, resp); } +/* Obsolete, replaced by MNTPROC_MNT. */ +static __be32 +nfsd_proc_root(struct svc_rqst *rqstp) +{ + return nfs_ok; +} + /* * Look up a path name component * Note: the dentry in the resp->fh may be negative if the file @@ -203,6 +210,13 @@ nfsd_proc_read(struct svc_rqst *rqstp) return fh_getattr(&resp->fh, &resp->stat); } +/* Reserved */ +static __be32 +nfsd_proc_writecache(struct svc_rqst *rqstp) +{ + return nfs_ok; +} + /* * Write data to a file * N.B. After this call resp->fh needs an fh_put @@ -617,6 +631,7 @@ static const struct svc_procedure nfsd_p .pc_xdrressize = ST+AT, }, [NFSPROC_ROOT] = { + .pc_func = nfsd_proc_root, .pc_decode = nfssvc_decode_void, .pc_encode = nfssvc_encode_void, .pc_argsize = sizeof(struct nfsd_void), @@ -654,6 +669,7 @@ static const struct svc_procedure nfsd_p .pc_xdrressize = ST+AT+1+NFSSVC_MAXBLKSIZE_V2/4, }, [NFSPROC_WRITECACHE] = { + .pc_func = nfsd_proc_writecache, .pc_decode = nfssvc_decode_void, .pc_encode = nfssvc_encode_void, .pc_argsize = sizeof(struct nfsd_void),