From patchwork Thu Apr 13 15:29:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Fields X-Patchwork-Id: 9679649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EAD8360381 for ; Thu, 13 Apr 2017 15:29:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE8EC28664 for ; Thu, 13 Apr 2017 15:29:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D35882866A; Thu, 13 Apr 2017 15:29:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4111528664 for ; Thu, 13 Apr 2017 15:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754486AbdDMP3t (ORCPT ); Thu, 13 Apr 2017 11:29:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53712 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752236AbdDMP3s (ORCPT ); Thu, 13 Apr 2017 11:29:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 213A53D97F; Thu, 13 Apr 2017 15:29:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 213A53D97F Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=bfields@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 213A53D97F Received: from parsley.fieldses.org (ovpn-125-199.rdu2.redhat.com [10.10.125.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01F96C05BA; Thu, 13 Apr 2017 15:29:47 +0000 (UTC) Received: by parsley.fieldses.org (Postfix, from userid 2815) id 65186180607; Thu, 13 Apr 2017 11:29:47 -0400 (EDT) Date: Thu, 13 Apr 2017 11:29:47 -0400 From: "J. Bruce Fields" To: Olga Kornievskaia Cc: linux-nfs Subject: Re: NFSD oops when it receives operation it doesn't support Message-ID: <20170413152947.GA17915@parsley.fieldses.org> References: <20170324155926.GB29655@parsley.fieldses.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.0 (2017-02-23) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 13 Apr 2017 15:29:48 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Mar 24, 2017 at 01:45:02PM -0400, Olga Kornievskaia wrote: > On Fri, Mar 24, 2017 at 11:59 AM, J. Bruce Fields wrote: > > On Thu, Mar 23, 2017 at 02:36:20PM -0400, Olga Kornievskaia wrote: > >> I'm getting this oops when client sends an operation the server doesn't support. > >> > >> in nfsd4_max_reply() it checks for NULL rsize_bop but non-supported > >> operation wouldn't have that set. > >> > >> So maybe something like this for the fix: > > > > Ouch, thanks, did you notice whether this was a recent regression? > > > > I thought we had a pynfs test for this--I'll check. > > Seems like regression though i don't know when. I tried against RHEL > 3.10.0.-514 kernel and it doesn't oops when it receives CLONE,COPY ops > (returns ILLEGAL and NOTSUPP respectively). Sorry for the delay handling this. I haven't tested, but it's almost certainly a regression from 2282cd2c05e2 "NFSD: Get response size before operation for all RPCs", which added that BUG(). Applying for 4.11 as follows. --b. commit 05b7278d510a Author: Olga Kornievskaia Date: Thu Mar 23 14:36:20 2017 -0400 nfsd: fix oops on unsupported operation I'm hitting the BUG in nfsd4_max_reply() at fs/nfsd/nfs4proc.c:2495 when client sends an operation the server doesn't support. in nfsd4_max_reply() it checks for NULL rsize_bop but a non-supported operation wouldn't have that set. Cc: Kinglong Mee Fixes: 2282cd2c05e2 "NFSD: Get response size before operation..." Signed-off-by: J. Bruce Fields --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index cbeeda1e94a2..d86031b6ad79 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -2489,7 +2489,7 @@ bool nfsd4_spo_must_allow(struct svc_rqst *rqstp) int nfsd4_max_reply(struct svc_rqst *rqstp, struct nfsd4_op *op) { - if (op->opnum == OP_ILLEGAL) + if (op->opnum == OP_ILLEGAL || op->status == nfserr_notsupp) return op_encode_hdr_size * sizeof(__be32); BUG_ON(OPDESC(op)->op_rsize_bop == NULL);