Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2963170ybh; Mon, 5 Aug 2019 09:39:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAFnKCzYEGk+suUCqajgxEPCkxL7z+K60IvhIm6qIJvg0UkWw6wcF8bIhrBCdfMU1hAi2S X-Received: by 2002:a65:5b8e:: with SMTP id i14mr135735667pgr.188.1565023161943; Mon, 05 Aug 2019 09:39:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565023161; cv=none; d=google.com; s=arc-20160816; b=IcOW5/uKpLOg5nThgqXv9cV+Blfqs6paudHhIq8AchP/M5HlqG/LkjZ2g+18ovUoDD TxL1ufkcMqdGEE1YMmexacGP7XT8gp/9KZ7Y/nRdHszH4+FgDKh4DTDJ3gaS/Wh3HbxI qiicvr5ipcq329hfo+LPmmB7p62Tft01qBvHAUMAADLH84KYDmetTVtETG/wKLockrka Nt+rXvV6UZg/R+ByhSaWTHEljb/7gGtUjmNHmr4KRxV+ypSUxQ/uAprrUPXuwqpSlNrh ENymizMtuEc1HC8UMNawX97uTHCw5riLmJdxdTBF0gp9RwdOIA/99JQqC4KWiX56z4eS /t/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=DIlnyrAQubtRedXdK/WQR+4utAEMUGb5wkLmNWPU8B4=; b=ixCOyF+7DnErxqw2fEdeNF3D9weYOWpHWoJyK68KqL923VjPElgeR6G7IN+P9O5Y60 VU6WKIQ/XXSj8rw8a29bHWIptDmspb+k3s3SsfG9R+KeuDw0HqHOQ+xqUfMvf+0Ii/SD kY55wgQwWyKmxS7yiTQ8DeElptfwtd/6ZwAykRnEfhm+fouo4CVNDoMyjpTyCQ3GVQ3H ba3nG+kvYWLvCThEmk1jyvhnxv81O/u6YwC4ghLHL/zQ+zrbiicuuCz1OxG8Zidc3Xrs RSFv50RwJe+9AZdDL9HP0aGoGrxAz3EpCClIETzUI2PYXKe9BgA4cCY3Z0iCUNheA1Kb ZhnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umich.edu header.s=google-2016-06-03 header.b=ZVFjlMNT; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umich.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s186si6830687pgs.116.2019.08.05.09.39.00; Mon, 05 Aug 2019 09:39:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-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=@umich.edu header.s=google-2016-06-03 header.b=ZVFjlMNT; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umich.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727349AbfHEQi6 (ORCPT + 99 others); Mon, 5 Aug 2019 12:38:58 -0400 Received: from mail-vs1-f68.google.com ([209.85.217.68]:44652 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726559AbfHEQi5 (ORCPT ); Mon, 5 Aug 2019 12:38:57 -0400 Received: by mail-vs1-f68.google.com with SMTP id v129so56356611vsb.11 for ; Mon, 05 Aug 2019 09:38:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu; s=google-2016-06-03; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DIlnyrAQubtRedXdK/WQR+4utAEMUGb5wkLmNWPU8B4=; b=ZVFjlMNT67wOJwS8e1dCCGNvoVwDzEEEED/uZCRyHmVTGqW4BNGTVPaKxKDMK6OjM0 qISdcydjpK+M5jgYPuT5fH0NxrnSWy9GWxj4eWo6rM/czsYP2TrDsGjzOdDypESwQ6s8 AqvM5U6ghOw2DaPoYtphjeekhf7glCXTPC1nnSY8obRqZwGg5CTTCERGqF5Nz3Ym3yCx 7ci28/qJJyHm+pf0aJCrdbELBjz5aW35+L/IOAq2mvYViQadwbvwLl5bfep+6sMksU39 Zj2TcKX66av+n0daOup4ualx6YvRoqJL+jRxjw9UEWx5dYFwYu93bGuVXcByt5o3tmpI AqOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DIlnyrAQubtRedXdK/WQR+4utAEMUGb5wkLmNWPU8B4=; b=k3fBZiYauieiT9XOcq8Y/9SafTVvERwhgMp6H9w+XFDSGQqI5pSyZnNpPMjBaxyHdc la7VMFJJyhYMMU2OpQzh0kKYlvkB7Ha1uLVj3OQ39Q7e3xDIosgpGgoZ+5iF9YumihNl jryeB5bAfw0qBxIv+dMMZ+L1GPZhDqZU0ALylZSYhsPda9BJhm5tC+fzfwAQHGiPGo+b 0zkbvPVAcI+EDjKGqMmwztLVWSQM6uJsUaQXAvrqyHRrQyISOOPhPDbbkXv4SO1PFgWt /P0vbjUsc9ki0O5p1P5f0dRfQmc/c7ieGCOSzmb7L8wTtiTs0NSZu97Qz4I+HX0ow0FH Kn6Q== X-Gm-Message-State: APjAAAXdL4uqmhweeBvxlxtmWXkjewBFJ5Q0rX3zmpOoGG7SU8Ggt2YE vK3QvwGZzzaKTBvQoNrClXDSTmFk06j0jGYFuEg= X-Received: by 2002:a67:dc1:: with SMTP id 184mr36325218vsn.164.1565023136933; Mon, 05 Aug 2019 09:38:56 -0700 (PDT) MIME-Version: 1.0 References: <20190803144320.15276-1-trond.myklebust@hammerspace.com> In-Reply-To: <20190803144320.15276-1-trond.myklebust@hammerspace.com> From: Olga Kornievskaia Date: Mon, 5 Aug 2019 12:38:45 -0400 Message-ID: Subject: Re: [PATCH] NFSv4: Fix an Oops in nfs4_do_setattr To: Trond Myklebust Cc: linux-nfs Content-Type: text/plain; charset="UTF-8" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Sat, Aug 3, 2019 at 10:45 AM Trond Myklebust wrote: > > 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+ > --- > fs/nfs/nfs4proc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c > index 3e0b93f2b61a..12b2b65ad8a8 100644 > --- a/fs/nfs/nfs4proc.c > +++ b/fs/nfs/nfs4proc.c > @@ -3214,7 +3214,7 @@ static int _nfs4_do_setattr(struct inode *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; Thank you Trond. No longer oops-ing with this patch. > -- > 2.21.0 >