Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3623070rdh; Mon, 27 Nov 2023 21:35:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8Y2yNMv1V3+12SKFyG1GXViD3UKwokqysYROzqyfbvFrOUtR3LCj+E90jvir8Cd0YIKEn X-Received: by 2002:a17:902:db03:b0:1cf:c518:fa70 with SMTP id m3-20020a170902db0300b001cfc518fa70mr8020777plx.34.1701149715361; Mon, 27 Nov 2023 21:35:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701149715; cv=none; d=google.com; s=arc-20160816; b=nY8RgQJHs+IpI0Q9oujIwxEPnxD5FuN7gfcN9fDjvaBPuWVrKeTnpJe+FNZlzhORHg /bko/b7NvUzPBdJrLDTZLh++unPHPw4GQSqDE4YIkZmTY5K4ns40spNW8poIIXPh+2BG j9qEUYj0Fsq5tRTNJVEql6r3Vzn4+pt8LVL+KzxlJJWzAcu1nfkuWTddmKon3YWmS24Y ai7UBLR0yMivfM8ntdCdmjzN2pDv/hVid9v3twX9VLVGg1qUclNWhKyS9SlFdmAAoawV AhJHYLEBotHRzQxh/ayiIcB596T3CXZXlhe0JUrPO5GFkwCntd7kl2B3Hc0c8ixlSeg9 VyrQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fxO33hgX7qudIID8yDsz8ucZ3gJV05i7WjPRt4ATm1c=; fh=af6/g7Mw4PWw8c1/IQL1lMUyTpO0lxbaYh3SFBWn9U8=; b=njJwgF26ccGOjDlWlIokDXWLTx9h5KBruVNxKxtoyTx6YHACbgBaMgCKUVepPIG6xK /e7+ZjRvaIok5v2OjRGZcdqnWmscWHUO6gnH3Kw7dkpz3lmFqygxQ6m4lBaavGZnetUL X9jSWVINQzVbILfim88r4l/clipYkoQye+jsdrsodC5IVob0G5NEIqhEP8LS1DEFjmcz cBGOnS+RQM9xWPAdMOOKxJiqxbGkAxz1PU4NiRfzjlLu9Y2eUs+p0ZkEPfNZUbhG3KnW PVfHo/lLbrDKs4CfxT/RQMqmtOlKl9ZipKmTDlNQ7FtkUJtL9D16mLvckXLB3Y8/w8Xv IWzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=bhZA9CJc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id b15-20020a170902d50f00b001cfd4eb4deasi3394958plg.357.2023.11.27.21.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 21:35:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=bhZA9CJc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id C8CBD805FD63; Mon, 27 Nov 2023 21:35:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343574AbjK1Few (ORCPT + 99 others); Tue, 28 Nov 2023 00:34:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343552AbjK1Feq (ORCPT ); Tue, 28 Nov 2023 00:34:46 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21731E6 for ; Mon, 27 Nov 2023 21:34:29 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1ce28faa92dso38862925ad.2 for ; Mon, 27 Nov 2023 21:34:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1701149668; x=1701754468; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fxO33hgX7qudIID8yDsz8ucZ3gJV05i7WjPRt4ATm1c=; b=bhZA9CJchPrKFiQfbQF+NRJRfXVXkcAFEkGxZ7UABAQ1cfDqDCZbSPOzurpSk+scPc hQUC17nOc6sFrkYIFnANlXLljAnqoMLyZ8IsuHhUjz8zPTQaHuKgL6TfsGa948nxoA/s IWgg84LIqYD3zvi9L+9R5nogMayy0c1PwNm2Sbqv1gUDpYi56dUnzwXklqp6iws57fxa pmaFrp/fyFhjuKW5nt1F+GGhGqFA6rAx4hnIcczt1/k9XmUmHlJ3OAFTeQ09QlVailTJ Gp3nZo7d9vmhhUOMLTPHlXkBzagXVGTmutvEPFDycrfxhdBZY2LFOwVklLP0LFDDrY3m pelg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701149668; x=1701754468; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fxO33hgX7qudIID8yDsz8ucZ3gJV05i7WjPRt4ATm1c=; b=UwiULU3yeYzIezEvFVdoAavjK6hBqR7OlJp13jZuNCYYsiafXA0jC6yEvw/vOkvm+b hy4PLxNkJPLL/kAYdFGmXgmmmAEj0or9ddYjLJdCPQ3cJK75FHn1vxRlABOjS9kr2oIE Wb5IrCay2PpbzAxFrBDxg31K65+7aQV/UTDONaJUHftLPiUISbGw3uHtCr9w843qsVd2 MDhh1+1nbDKsQkn7mKOuCc0gPFiO8FrPYdDoTzluzkeLPFM/Uk9TOQQDWNUFpYtwOnFT udroEdlvJE/hz4yJq7m1+gTLqvpzm7ZfJWwUg162kwDawNrM+daBG3K4+UMseXruci86 xIzg== X-Gm-Message-State: AOJu0YyN/eiSBvm+NiQvFAU67Ujiv9yO0JnbitQI8lIfzVmZtMlZ6cll Vvpoyn/ALieCfwq5YyIPkAD7Xw== X-Received: by 2002:a17:902:b401:b0:1cf:9790:f243 with SMTP id x1-20020a170902b40100b001cf9790f243mr12596195plr.61.1701149668646; Mon, 27 Nov 2023 21:34:28 -0800 (PST) Received: from localhost.localdomain ([61.213.176.14]) by smtp.gmail.com with ESMTPSA id u12-20020a17090341cc00b001cfb6bef8fesm5372899ple.186.2023.11.27.21.34.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 21:34:28 -0800 (PST) From: Jiachen Zhang To: Chandan Babu R , "Darrick J. Wong" Cc: Dave Chinner , Allison Henderson , Zhang Tianci , Brian Foster , Ben Myers , linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, xieyongji@bytedance.com, me@jcix.top, Jiachen Zhang Subject: [PATCH 1/2] xfs: ensure tmp_logflags is initialized in xfs_bmap_del_extent_real Date: Tue, 28 Nov 2023 13:32:01 +0800 Message-Id: <20231128053202.29007-2-zhangjiachen.jaycee@bytedance.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231128053202.29007-1-zhangjiachen.jaycee@bytedance.com> References: <20231128053202.29007-1-zhangjiachen.jaycee@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 27 Nov 2023 21:35:08 -0800 (PST) In the case of returning -ENOSPC, ensure tmp_logflags is initialized by 0. Otherwise the caller __xfs_bunmapi will set uninitialized illegal tmp_logflags value into xfs log, which might cause unpredictable error in the log recovery procedure. Fixes: 1b24b633aafe ("xfs: move some more code into xfs_bmap_del_extent_real") Signed-off-by: Jiachen Zhang --- fs/xfs/libxfs/xfs_bmap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index be62acffad6c..7cb395a38507 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -5048,8 +5048,10 @@ xfs_bmap_del_extent_real( if (tp->t_blk_res == 0 && ifp->if_format == XFS_DINODE_FMT_EXTENTS && ifp->if_nextents >= XFS_IFORK_MAXEXT(ip, whichfork) && - del->br_startoff > got.br_startoff && del_endoff < got_endoff) - return -ENOSPC; + del->br_startoff > got.br_startoff && del_endoff < got_endoff) { + error = -ENOSPC; + goto done; + } flags = XFS_ILOG_CORE; if (whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip)) { -- 2.20.1