Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp558185ybz; Fri, 24 Apr 2020 05:24:41 -0700 (PDT) X-Google-Smtp-Source: APiQypLOByf3LU+VAsYQKGDgIBIxW+1eJnYfx4QxUZdoX52UF7l5oRajpYnDH+0JN90MBnaSdsue X-Received: by 2002:a05:6402:759:: with SMTP id p25mr7205202edy.102.1587731081602; Fri, 24 Apr 2020 05:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587731081; cv=none; d=google.com; s=arc-20160816; b=0qWbXVgjrtY07iACHk/kl6I+1j8sNUYvjFZ401MHzIRC3iUE51qiDsxj65F3pfyPZe 6KNhgo7taPFpU5DeKXq9rhR3mQVtoGIdOU6dUySoGuSoL1tHj0Cu5IRQRRRaVMpaloV/ qmDZZLYO/3nZgmKLZaOLt4jKEvrJc/BjDoVpIsFLY2hlcU7EtC5152dQ5VqOLnxpYqm3 upK3JBohbC0VdGIluYZRWsF/qEun2ebq+7WllbJB8AkvEHZhsxh1FL1WfgZmynjdsydQ QyGSTktoyELjODa40Zc5+3tuzsZbK+qBAWFIrso+jadmVfBw27CaqmwDYH34xz4c9p3f KBEQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WyRg88b/YzBVz/opE/DU8/mprggP7UyFQWeLMBnrF5Y=; b=R+BrE0aq4I/X9wvr/Xlp3H37M9/dBpRO2U2iHSPI53V9dv9iQZaGB4iowLnt6Swx7D YBXqEIYLPbYLvtp6Yl/sze1VOE7vyXEWkr2al2sCyg6f8Jdpt49WkcSb6BjFrb6DapEb sEjy70sP0n4fsx/g5ubI0lWtm+nhp14Z3QbJAKuOZ7zNoEUrWS4HqL4wYGU+ZRCmE4FN nKheGYG8OEL8e29j6yd548Smrr0UB6p5SQnDd4dmvv8n9fqB1C6RBHvXQRy8fStTveKR RK8sZUPJpRs6gKzYdCsXLASSVEh9250sAqxx74ObPQox4hn99OlpURFuYka+XBm7cQgk jHCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="P6Uw/fDF"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si2930913ejv.401.2020.04.24.05.24.17; Fri, 24 Apr 2020 05:24:41 -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=@kernel.org header.s=default header.b="P6Uw/fDF"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727083AbgDXMWu (ORCPT + 99 others); Fri, 24 Apr 2020 08:22:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:52012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727073AbgDXMWs (ORCPT ); Fri, 24 Apr 2020 08:22:48 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4E141215A4; Fri, 24 Apr 2020 12:22:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587730968; bh=D/WkIwVgvEMD3xO8gDUh7kVDLW+mEo/bNDyZXVnhDOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P6Uw/fDFjIAlFUeGmRpiIkhpMV7nOzajY3LG1D8iDp9/rMxh7rLJt1c7TGmV3heXT mk1cI2mz4o3hkriVHG6O7DiTeZ+AladZLPJmjip4JYri2Keqpvg2Leniytmnm74WN8 mxj1or9vkvx5GKTnd4y3rhcADkmcitm4v7Bk03QA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Darrick J. Wong" , Brian Foster , Sasha Levin , linux-xfs@vger.kernel.org Subject: [PATCH AUTOSEL 5.6 09/38] xfs: fix partially uninitialized structure in xfs_reflink_remap_extent Date: Fri, 24 Apr 2020 08:22:07 -0400 Message-Id: <20200424122237.9831-9-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200424122237.9831-1-sashal@kernel.org> References: <20200424122237.9831-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Darrick J. Wong" [ Upstream commit c142932c29e533ee892f87b44d8abc5719edceec ] In the reflink extent remap function, it turns out that uirec (the block mapping corresponding only to the part of the passed-in mapping that got unmapped) was not fully initialized. Specifically, br_state was not being copied from the passed-in struct to the uirec. This could lead to unpredictable results such as the reflinked mapping being marked unwritten in the destination file. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Signed-off-by: Sasha Levin --- fs/xfs/xfs_reflink.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index b0ce04ffd3cd2..107bf2a2f3448 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -1051,6 +1051,7 @@ xfs_reflink_remap_extent( uirec.br_startblock = irec->br_startblock + rlen; uirec.br_startoff = irec->br_startoff + rlen; uirec.br_blockcount = unmap_len - rlen; + uirec.br_state = irec->br_state; unmap_len = rlen; /* If this isn't a real mapping, we're done. */ -- 2.20.1