From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 831A0242D88 for ; Sun, 28 Jun 2026 09:25:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782638759; cv=none; b=XclzfS2hF0f70A3qaApfgww2HVEodGhGq5+oP9ZsRwcUuxd3Lf+gE7mtFTL3CtCCZZ1R5itM2IMdA8B0W8TgkA0Pu/fprBzForJ6hOr98ROQKgFy/m1lHw2hTs4JXlS7HVDcp8g+TynX1KZSr++Mjdb9RT5jlZ3O3VejWuQAWgQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782638759; c=relaxed/simple; bh=UNNiuzmcBoG+nRsEkI60Cg/VDBcGfYPkQvWMrsNU45Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QSe8YGMAzcIPFQfhT8VmmISKbxyO8Ctr9tH26o0snUu0Y8ak72ydem4m5pPx+5wzoiM5buuUlsH3AcXEWNGeCPHBYRdgCs0iTbaOxpyOCPwjmGAEOZR3tB1snA5Gd0uCH2yu5APAnHGBCNxTusoBeRnhPyGPSGKHtTl6EtgL3tU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=q71PGOmZ; arc=none smtp.client-ip=209.85.128.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q71PGOmZ" Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-80b9993928dso25211727b3.0 for ; Sun, 28 Jun 2026 02:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782638757; x=1783243557; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xuTjDHAVL3C45DH+ngv7eazzAslDVL12lledj+rRglU=; b=q71PGOmZwgt6qtjjhugkWv6G8yYww3MsEy+RX9Cc7cjOzo1ytZcubxJX5WKjORIaYV K0i8HyIL3GTUPV3LpSQqqw9P8Y+i5EKdWyg8TEe+7DgNERz0FX0otgU2X0BtP1ipibCw 0lHC5b9wwTQNN/iBjMWBBcxl5KOH0sZKqYACW43g25lD6mZRYAwSUHBWwFvMvYTg6jKS axK7aIDApGnUQcspCmvRh8jtQhCu/s/ahiO0JZIGTtQS6Q8U0UwLLrWsyVH6jmatTl/c i8KM2Rac023xdJ1LvS4gNX1n85FKXt4BfTb6zP9ZIxSPXKt3ReGVrwzXUnpK7S/RIShu Xkng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782638757; x=1783243557; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xuTjDHAVL3C45DH+ngv7eazzAslDVL12lledj+rRglU=; b=W9j6ZD/j+i6tYGIOrgWaUsS1XF+u33lovzfBTl3ckAwsZti7FR57CixM1QXPqrASnE az5V3vrnOy1JDMnLPGlC8DnX40Ntio00e2r3XAAKbLpLnfYpl6GXQ2pqR4r10rjHoZRX vXYApQnLkBrPyQbQtp5rGe9+pkf67PjY1U5UFEApjzxqRGrhfYfl5drTpSVjsM7AABEz OiQx+jRYIwLldpA4ag5pQrHdoudmfkOJLC1G/am3mux5TOOFySmjSzqjXwZ9tHZQ4snz dhtjCdsSU6U9fn6YXHGsmp4Z6hlrG3qiHSTffFEw+/rVXIhEd66qQWVoYEF5jicS+d8N jl6A== X-Forwarded-Encrypted: i=1; AHgh+Rqsraep+7OqEwfje5n37EshXaHrPq8Sy7J6yIeGI0w98/Zi0JZ4b76/Yh3CAf3KSkZtYAal+yIr0Yas47g=@vger.kernel.org X-Gm-Message-State: AOJu0Yw39TO5bIBjGDH6a8o2OG6Ae51Sa+6MoClM3Q1/4VOvZS8GwL5r i9a8Sl+YUhMIv+Yfm3WtGFlIW92henZBOdikpXWoo2lGpg53d6uXpkCv X-Gm-Gg: AfdE7cnAFfxWcLMVIDu5/l7eaSeH08bOJApXfexIKS3qczPVVMWvtWJWXKXMqN7w70i 3PGDDNi1e91o+JZ3srmUeSd0hlj9p+6mDmrRuxgQWAckmZiSgVzb73N7IVd3d4hWTo2SEtKMJUM hc6dPmYkB/d8TvvBzr00McYOiKnrjgpdRl7rSsAHfMZFHkd6Vp9g/VdSpowNrng/wfyfy9RlOfI /LUuWavFsA17YUoGvDh+8ym5trnY1KUXngKEtChcIfOVm11sYGupDfdBe52M6i21dAUObqRt46a IADo6oH7Bfo9gILXlgayAZTHkAzUlEKShE1HVyQ7yW/d/yo5XpMDdtIIlEgKTLdFy9T4tfOvAl0 1iWLh2saUQrtM0mt8yJisRna9+IObuNrGtkRygRXEPhKiRwGS2DKiGIv8aG+ccLsFtEI6cXiwKF 3ZhijmaXhCpIcwU8DtXIZvxKw4QA== X-Received: by 2002:a05:690c:9985:b0:7f8:7e02:248 with SMTP id 00721157ae682-80a6ae88e31mr124636427b3.48.1782638757572; Sun, 28 Jun 2026 02:25:57 -0700 (PDT) Received: from Dev-Null-MSI ([2a0d:3344:52ac:a808:98a4:4381:be45:536f]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8025ffc60f0sm104475967b3.37.2026.06.28.02.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2026 02:25:57 -0700 (PDT) From: Yousef Alhouseen To: Carlos Maiolino Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+b7dfbed0c6c2b5e9fd34@syzkaller.appspotmail.com, Yousef Alhouseen Subject: [PATCH] xfs: initialize first bad log block in head verification Date: Sun, 28 Jun 2026 11:25:13 +0200 Message-ID: <20260628092513.39620-1-alhouseenyousef@gmail.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit xlog_do_recovery_pass() only writes first_bad when it reaches the common error exit after processing a log record. An earlier CRC or corruption failure can therefore return without initializing the out-parameter. xlog_verify_head() tests first_bad on those errors and may then use its uninitialized stack value as a log block number while searching for the last good record. Initialize it to zero, matching xlog_verify_tail(), so an error without a recorded bad block is returned directly. Fixes: 7088c4136fa1 ("xfs: detect and trim torn writes during log recovery") Reported-by: syzbot+b7dfbed0c6c2b5e9fd34@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=b7dfbed0c6c2b5e9fd34 Cc: stable@vger.kernel.org Signed-off-by: Yousef Alhouseen --- fs/xfs/xfs_log_recover.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 09e6678ca487..d8125f3add4b 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -1028,7 +1028,7 @@ xlog_verify_head( { struct xlog_rec_header *tmp_rhead; char *tmp_buffer; - xfs_daddr_t first_bad; + xfs_daddr_t first_bad = 0; xfs_daddr_t tmp_rhead_blk; int found; int error; -- 2.54.0