Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1069741ybl; Wed, 14 Aug 2019 10:12:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTO95tlzmGwPoMDajWOnWVAno6FeaKUZriNrrnTQpacgnZl1bR9vrx6eCi+zuavXnnBsz0 X-Received: by 2002:a17:902:8489:: with SMTP id c9mr396509plo.327.1565802751970; Wed, 14 Aug 2019 10:12:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802751; cv=none; d=google.com; s=arc-20160816; b=lFflcUHfPfppNX4AQwRncSoDJqatgNOUPBrpcjZZihtA9/tmWvI9INPqXFLzPNmvVm H4V0eQot6vkHDqfw0GzH+eIpeSxG67eQ5XCofUJzcbMIbYbjicy9+TKes5TLt7P9Q7As muNLJaiwkt9s5JZoFTFL0kJPbGiSVGHSPcezN52M2IsCtpN4EjHZHWD/fW4PUzOIo5wt Vl+EIz2NUc/sM8ugRTzsbbLb96/HDLr6d9npKQ/804EhYiIjgDXyajlpV9/mWMeZnocW 0oIuwr4ti5jnw1nOLoopgtbWUGWd9XjUdaNejr8P8vThEkZLv3ZJZCgsSUpWxHZyXenW F57Q== 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=a5VsHdmUA2qcDeklKJf2q1yJCy+q9MQXoIsjLCnLFRs=; b=VOmQdBXhW/xHKCWtygbTJqqK392Y482yuQlVA9yPToiatT7R/IZB/CQ4jn51PiXMer am6hYymrQzMqDC9w2lekBwhR8QwakC4EzVHQdMy2ZugvNCFdR++651OJea3VFbuUx5jz 6foaPlYi4cLlq5OW/g8/O+sOno/bc71283BcSISZcJADxu2hZidQ42HO48hfkQEmdvnk +/FTm6ebKUeAN8qDwBLKdyXEpEjya5FZEMKNpb733RHPVfp8WJ77LBX9ld2VEIB21SVo 1X+8/AFfFGbBdXYovBITkbfw1f0H9iPoe0Pro9tVsW9Iv5uPo5PJkS7Jgf1DZzYCOPxU faSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NGsvPBsp; 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 a186si167080pge.365.2019.08.14.10.12.16; Wed, 14 Aug 2019 10:12:31 -0700 (PDT) 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=NGsvPBsp; 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 S1730234AbfHNRLr (ORCPT + 99 others); Wed, 14 Aug 2019 13:11:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:35242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730630AbfHNRLp (ORCPT ); Wed, 14 Aug 2019 13:11:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 D11302063F; Wed, 14 Aug 2019 17:11:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802705; bh=7nilxyzThzW7Y1VoAFL8BNe89egM2VX6ASzzpL36Dtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NGsvPBspsrUJxdC/2TsjnAfM28NLdCO2gj6GfmvWjITJk6x9uqQhUCOErOkimWFzb t7MyFk6sY86dHgki/3oeuPBbik5qEX1j6V6/aMTQDDNlrzjbOMHmRUdsmFCf1pEhd2 z2rop4/EH1VY7phtf0u/1ZSLLR47RPswM8j0AM5U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Trond Myklebust Subject: [PATCH 4.19 85/91] NFSv4: Fix an Oops in nfs4_do_setattr Date: Wed, 14 Aug 2019 19:01:48 +0200 Message-Id: <20190814165753.654041844@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165748.991235624@linuxfoundation.org> References: <20190814165748.991235624@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Trond Myklebust commit 09a54f0ebfe263bc27c90bbd80187b9a93283887 upstream. If the user specifies an open mode of 3, then we don't have a NFSv4 state attached to the context, and so we Oops when we try to dereference it. Reported-by: Olga Kornievskaia Fixes: 29b59f9416937 ("NFSv4: change nfs4_do_setattr to take...") Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org # v4.10: 991eedb1371dc: NFSv4: Only pass the... Cc: stable@vger.kernel.org # v4.10+ Signed-off-by: Greg Kroah-Hartman --- fs/nfs/nfs4proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3133,7 +3133,7 @@ static int _nfs4_do_setattr(struct inode if (nfs4_copy_delegation_stateid(inode, FMODE_WRITE, &arg->stateid, &delegation_cred)) { /* Use that stateid */ - } else if (ctx != NULL) { + } else if (ctx != NULL && ctx->state) { struct nfs_lock_context *l_ctx; if (!nfs4_valid_open_stateid(ctx->state)) return -EBADF;