Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4592357pxj; Wed, 12 May 2021 08:51:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy35sEHvMyTGaXSvuck0GwkkP1bImoAZt6rEYTK8UBwXlzRc8o4pIaZHipuAj9wNjNMRqjj X-Received: by 2002:a05:6402:17d7:: with SMTP id s23mr44191865edy.66.1620834690647; Wed, 12 May 2021 08:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834690; cv=none; d=google.com; s=arc-20160816; b=0FuZSyuis9InSY0icC8UrAu0kpeg+0OMDbKEUaiqCFh3ZAgultw1+SVNcmPh46t1fC IZY8g+wt4ZTJwbcapWyOhmrgP8iO705ZL2TPVuDM3LMJFQ4A3A/gcdoMGEtAGTwF81T5 3PvZrotOBJrljpOaRtEpiUPeKad4SOVspoIoL5QVoKO8IhiTBBv19ULvMC1zfOPRB29N UCFb1H2pqCBeA0K6xoAh2IDcW6ig+ZdgYo4puny0GZhhjd/d5HJFRIopqWm7CXMbkSYd i3x47UX+SA5kfyrYsADNH6XmYhsTiX2/ivuUSgdAnETz3W9qZ9MPsc3AvN6MmPJHz1vt ZWpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2obhSECG8o6VwCtlSuDBhkFGSlwLu7YoHq8BXBZz70c=; b=WL4ASzl3b42p3seiXERWUAb5OV4TNe4c5194LMkWi20V/+oLj1h2UeA6ziBJ8LNaeX +eUI3XZ0o3KpY9NNTMvHYDQm62b/CVpdWunrHTmuGVd8KSVYVA30zTYk0lCI/rrppXdS YDQGAEPeQn+V8C27NXuGyeljeCZjNDxXVr40rNGn2fP8emX7FBkKkxUfGSvQTi2DWcgx kIcsCPjITwnlALdA4lcgSHi3ydhQlQZgxcHhCT04OKwZ0Us757haMprGZL6h3PRgbyXU xZl1j5ATGTu6uGjmnk8qpD2B1sb/lgGLKQjiDckXzd/L7rbp+DHZdEqgUSveL4SOzIrO KbFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="hilmr/o7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q11si130977edd.19.2021.05.12.08.51.05; Wed, 12 May 2021 08:51:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="hilmr/o7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237538AbhELPux (ORCPT + 99 others); Wed, 12 May 2021 11:50:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:37004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234428AbhELPZI (ORCPT ); Wed, 12 May 2021 11:25:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 73A336196A; Wed, 12 May 2021 15:10:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832225; bh=5fzwrXYurcH64eVOzjuY+zgCL9/S4g0U+kP4QjKdqIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hilmr/o72l6AiismEFDcbUCdLTdSLr9R8YT/14n98/t9SV1z3A+kbld/CIMoJZ6J8 qZ6MW0jZrUL3YJ/5L8UzlplWCu0g/bjYt7p1Ui7lgJ6oJKfHWSaVG+6ikJyDL3EGWt AUAvAZ0yGH6avyMtRZP3wTN+7R5OEN8kUu3q7J1U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Olga Kornievskaia , Chuck Lever , Dai Ngo , Sasha Levin Subject: [PATCH 5.10 193/530] NFSv4.2: fix copy stateid copying for the async copy Date: Wed, 12 May 2021 16:45:03 +0200 Message-Id: <20210512144826.183298536@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Olga Kornievskaia [ Upstream commit e739b12042b6b079a397a3c234f96c09d1de0b40 ] This patch fixes Dan Carpenter's report that the static checker found a problem where memcpy() was copying into too small of a buffer. Reported-by: Dan Carpenter Fixes: e0639dc5805a ("NFSD introduce async copy feature") Signed-off-by: Olga Kornievskaia Signed-off-by: Chuck Lever Reviewed-by: Dai Ngo Signed-off-by: Sasha Levin --- fs/nfsd/nfs4proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 015d25a5cd03..00440337efc1 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1535,8 +1535,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, if (!nfs4_init_copy_state(nn, copy)) goto out_err; refcount_set(&async_copy->refcount, 1); - memcpy(©->cp_res.cb_stateid, ©->cp_stateid, - sizeof(copy->cp_stateid)); + memcpy(©->cp_res.cb_stateid, ©->cp_stateid.stid, + sizeof(copy->cp_res.cb_stateid)); dup_copy_fields(copy, async_copy); async_copy->copy_task = kthread_create(nfsd4_do_async_copy, async_copy, "%s", "copy thread"); -- 2.30.2