Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1075962ybl; Wed, 14 Aug 2019 10:18:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyh2M1Wlll8/1yKHtJ5Cd4m2KfBaxovmU8Gx+A+VDk2MkxxOreUtEyPKbUfkr80C+eYqDJD X-Received: by 2002:a17:902:29a7:: with SMTP id h36mr485707plb.158.1565803095954; Wed, 14 Aug 2019 10:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803095; cv=none; d=google.com; s=arc-20160816; b=yL5pLJKDMBQc/rWuX9IJ/K5isPS+gOzlLql/eRB6qvfZQ8MkYBXPDbf+KVgqAsl4hZ oLixySrZNTMbGDWyzD0svzVmjtot2JpzOsrKL0yvimWiI150383rEQUQnMWUXCnNrgFB L33KdhJZ5EWP8jFl71MfvuF/V6tKahBHFOSb8Nm4Vz5XTh9o20IHuuOjeL/OwzI533b/ VbyIvX4sBlckanYYgReOjLDCm4xJjL8ar8+rn1I/Hm4ZFiMU3eFB+s19t71SDvw/4bo/ crOalhS3/DoJ1bQBqTu1HRzpXuF6bHvdRr63pPi9Q3IqnRjXqjtEgR6QpLwWvapcPd3x JmRQ== 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=LO7AlYA4828Jn8S2EoPN19Vzr6+ycZcTpRntJecaTls=; b=DoA8LLcxbxdS6gfajY99s9XsyksyPN418pZjuWxIKlkvQuGtnpeQOduCmwjytZcO2U sbrRLQuj6eQsntPRJxmucC4T6XMXCCxPLeRK0UT7af4zze244zMQ69WjId5T++MFVwla OMTw4eIkEk5Vqa/qgdthtRk5yDAVtAZXiOa8/E+08zPJ4H298/iOYV6s7qyHKun0Zwck fqY3RB7c1EVbPadX9D6VY9bKD7CydxNhk3+yof5kfa6yO+XFTsI2k4IJC76ZP2k7OCzX Ny+AFejEXtnCC6CkwJgLx8ks2KHQ0u2LUE+e5J/HXxbR7R0oyGhtUIMhYud2x/nDZTeP pGJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k8FgeUvj; 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 16si64986pfc.213.2019.08.14.10.18.00; Wed, 14 Aug 2019 10:18:15 -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=k8FgeUvj; 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 S1731124AbfHNRQM (ORCPT + 99 others); Wed, 14 Aug 2019 13:16:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:39250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731126AbfHNROo (ORCPT ); Wed, 14 Aug 2019 13:14:44 -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 B43C62133F; Wed, 14 Aug 2019 17:14:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802884; bh=BtqCLSai4wh4OD2jBiqrILAd4IwAXlkPsvd5EAO5rtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k8FgeUvj31eB+abDzrK/YxjhhCGZ7WUHhseqoLnJM+tclsDPdJyhBAKwB/xKXRdI9 +3zkI/XyKeOcwnydA5iJ6nsIZG5acOfa54nLlpWKRP0kqWAaZ/lzyxA+DlLJQpf81m Ey/5HUYH3NaagMqYoCUJm5ynQ1XkSaVqTA4OJcLY= 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.14 63/69] NFSv4: Fix an Oops in nfs4_do_setattr Date: Wed, 14 Aug 2019 19:02:01 +0200 Message-Id: <20190814165750.358605921@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165744.822314328@linuxfoundation.org> References: <20190814165744.822314328@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 @@ -2966,7 +2966,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;