Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2261294rwd; Fri, 19 May 2023 03:21:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KRs1ZeNl5v5EkXTLqX77ULeBkQ+bo1AlLN90Hjou/iEQbBJtvWlmbNBq4iPmt76k+Ku1Q X-Received: by 2002:a17:90a:118f:b0:250:d12d:1a1 with SMTP id e15-20020a17090a118f00b00250d12d01a1mr6341188pja.12.1684491697140; Fri, 19 May 2023 03:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684491697; cv=none; d=google.com; s=arc-20160816; b=KA074xsXfgJG6rOLsgdVzT1z8yh57C9dyDNmYS/Jxc7eO+Ugap0k115ufdCLMfbo1W P/zlu+WIZDGeAYDvoWG3KgLZLvqSnm43GVMtjQh49oZ8Xdc31bHvXH4cAvUAS7Uj9oSk TcObWO0FdULjnOGz4b6puo/qQcm4mPwnjbxJvu8l3JEOogPtK4qLRc2WFqREw3al4EHo sATu7r+GoNCf/HNyNmsjkzAzS/J55kJPvXyhDZA5qEVFBKxcuwIX6RxCNFa5gRelwmMi UHoUY86AINQfC/3IySl3u/S/Eoycq7UHK0zltZUjXD9jy2JVDIMIf1g/nU3+6m5au5j3 9P4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=9v4JZqgxU9KouaDxU6lMOmMCI1ny6AVAy12cI3M+HLQ=; b=TJdS3eZSMDofWSUtm6sxreOyb6odRCmnvOtl5zwxeO8WbuJL7FWJwFXD85gGb7sNV7 Ibt4tR8ihDAhmFytD8kfl/DfxwHctuI3gNLez9Sih9acp5E50tuirGYy0rhYaBt6BOAh mIUpKVUiFIGtyG7AjE/hqMuMOD/2XoQwY11o2tWYvCNYcTqK+/4xBNcY4n7GU6ilrBNS 68Qot4blreLWCUVkBBXKsGmcX6eFVbUcWL0STcL+nTjD/nCHpmKGZSagYsKfuRqAk+9T VtUvJY38IL73s1Xd9qK/2YARh+MgVvVar89+Uax6Dx2Gb+fyS1aQQZmr5P24+OPrGTKT vhow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u6ErOHLW; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 71-20020a63004a000000b005139d2b9306si3466257pga.514.2023.05.19.03.21.10; Fri, 19 May 2023 03:21:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u6ErOHLW; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231810AbjESKKO (ORCPT + 99 others); Fri, 19 May 2023 06:10:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231760AbjESKKJ (ORCPT ); Fri, 19 May 2023 06:10:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CB2BE5A; Fri, 19 May 2023 03:10:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89D3861B47; Fri, 19 May 2023 10:10:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A23EC433EF; Fri, 19 May 2023 10:10:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684491002; bh=SH3Ai0VIsZ5Tro1m/lUwyde5P3oV+8XIW0LuSqw/h3Y=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=u6ErOHLWzIPaOsxk0ez6lwUx1hQa61M6PBaSMEA+rrC8v0EZKh/abMt0tfqHkZcsW +I1A6daUGRlOKPBRgr3c6MmbP/2nOmh9yemPsu5YGOGe5no4fvYfH1qjoEGSqkAXlN ysUui50ICNt7jCIiT64aMSUif+aPaySt6M6urvZ+zyBtwKkknMShxDdn/ZFVw5W9H/ rbWMCWEJuOmWuehgWUNHxy73TF0Q62Plgofd9CRF0F86RUpTTP/eA+K/ZiS3YIuJBy atf5zlAqhuCmhNpgN5kfBDQPQIDoDMQURmrXzFjoW8t5pqeiccKbyILRuXkPqZClS5 hwiNtPfvt5PRw== Message-ID: Subject: Re: [PATCH] nfsd: make a copy of struct iattr before calling notify_change From: Jeff Layton To: Chuck Lever Cc: Zhi Li , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 19 May 2023 06:10:01 -0400 In-Reply-To: <20230517162645.254512-1-jlayton@kernel.org> References: <20230517162645.254512-1-jlayton@kernel.org> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.1 (3.48.1-1.fc38) MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, 2023-05-17 at 12:26 -0400, Jeff Layton wrote: > notify_change can modify the iattr structure. In particular it can can > end up setting ATTR_MODE when ATTR_KILL_SUID is already set, causing a > BUG() if the same iattr is passed to notify_change more than once. >=20 > Make a copy of the struct iattr before calling notify_change. >=20 > Fixes: 34b91dda7124 NFSD: Make nfsd4_setattr() wait before returning NFS4= ERR_DELAY > Link: https://bugzilla.redhat.com/show_bug.cgi?id=3D2207969 > Reported-by: Zhi Li > Signed-off-by: Jeff Layton > --- > fs/nfsd/vfs.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c > index c4ef24c5ffd0..ad0c5cd900b1 100644 > --- a/fs/nfsd/vfs.c > +++ b/fs/nfsd/vfs.c > @@ -538,7 +538,9 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *f= hp, > =20 > inode_lock(inode); > for (retries =3D 1;;) { > - host_err =3D __nfsd_setattr(dentry, iap); > + struct iattr attrs =3D *iap; > + > + host_err =3D __nfsd_setattr(dentry, &attrs); > if (host_err !=3D -EAGAIN || !retries--) > break; > if (!nfsd_wait_for_delegreturn(rqstp, inode)) Zhi Li tested the test kernel for this today and this seems to have fixed the issue. I think you can add: Tested-by: Zhi Li Cheers, Jeff