From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4681844AB9F; Tue, 21 Jul 2026 22:28:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784672920; cv=none; b=VVqqA2+VBeDwcaRRuod9zdqw+D1SUDJhxE+VQwGwESis3FMqDrYsDAY9yoYvzyk1pBRFgZP1oysvn/xfIv/Qh6U9mwrZop3KGzcvDukrROXliGlIclz9S+sU7UwTekm+g9tcP5Q7qaEwIDDr7R2V5BBxDTNmY2LBmhnni4Lp1Ec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784672920; c=relaxed/simple; bh=asrwIjc0mXFGdtM7tQxbqIVcdZMjg3KQzMNxTI9Qoug=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZJ2em5noFrv13Q4QvO25xoPJ3tgOw/A78qpaJI4orFqRYjSVvDVQBjegLX2zEjIaq7aHQSnFhjtkG0Jkdz2l0tsA4wVjKgopb3BBW0v7jgL75EszeyyPOmo3cvLkxxyAdOvAkb8L26BshRVC4ZIXvfZnjzAkic7HaeueYGWvg9Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FSPgMWm+; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="FSPgMWm+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 317401F00A3D; Tue, 21 Jul 2026 22:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784672917; bh=ctag5dj0roS88KQLjRCcT0RFNggWpVOWo2Ez3HVa7O0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FSPgMWm+c9VfYqSJH6EEk/n4aYvDlTvNOTq6+HtJeUW+ONJ4FgJEk/OGYjwwtM5sI hoXk2n1vslkvnvSviJ6Vj87W9ddF1Yo4lQ89oZKv98ERDpJhiv1FIqVcd5FbGNu5Xz 8QlYnuigsa4vzXt5pYVBms1jdvZW3Zi4IJk+s0NU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Darrick J. Wong" , syzbot+b7dfbed0c6c2b5e9fd34@syzkaller.appspotmail.com, Yousef Alhouseen , Carlos Maiolino , Sasha Levin Subject: [PATCH 5.15 805/843] xfs: use null daddr for unset first bad log block Date: Tue, 21 Jul 2026 17:27:20 +0200 Message-ID: <20260721152424.176502337@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152405.946368001@linuxfoundation.org> References: <20260721152405.946368001@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yousef Alhouseen [ Upstream commit cc9af5e461ea5f6e37738f3f1e41c45a9b7f45d6 ] xlog_do_recovery_pass() may return before setting first_bad. The caller must distinguish that case from an error at a valid log block, including block zero after the log wraps. Initialize first_bad to XFS_BUF_DADDR_NULL and test it explicitly before treating the error as a torn write. Fixes: 7088c4136fa1 ("xfs: detect and trim torn writes during log recovery") Suggested-by: Darrick J. Wong Reported-by: syzbot+b7dfbed0c6c2b5e9fd34@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=b7dfbed0c6c2b5e9fd34 Cc: stable@vger.kernel.org # v4.5 Signed-off-by: Yousef Alhouseen Reviewed-by: "Darrick J. Wong" Signed-off-by: Carlos Maiolino Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_log_recover.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- 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 = XFS_BUF_DADDR_NULL; xfs_daddr_t tmp_rhead_blk; int found; int error; @@ -1057,7 +1057,8 @@ xlog_verify_head( */ error = xlog_do_recovery_pass(log, *head_blk, tmp_rhead_blk, XLOG_RECOVER_CRCPASS, &first_bad); - if ((error == -EFSBADCRC || error == -EFSCORRUPTED) && first_bad) { + if ((error == -EFSBADCRC || error == -EFSCORRUPTED) && + first_bad != XFS_BUF_DADDR_NULL) { /* * We've hit a potential torn write. Reset the error and warn * about it. @@ -3549,4 +3550,3 @@ xlog_recover_cancel( if (xlog_recovery_needed(log)) xlog_recover_cancel_intents(log); } -