[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_1695E0E90AEC5ACFE478EE6F0C2DC56CE00A@qq.com>
Date: Wed,  5 Mar 2025 09:53:29 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+9f6d080dece587cfdd4c@...kaller.appspotmail.com
Cc: linux-kernel@...r.kernel.org,
	syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [xfs?] KASAN: slab-out-of-bounds Read in xlog_cksum
#syz test
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index f8851ff835de..160eb6738c8c 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1581,8 +1581,12 @@ xlog_cksum(
 		union xlog_in_core2 *xhdr = (union xlog_in_core2 *)rhead;
 		int		i;
 		int		xheads;
+		int		tail_xhead_len;
 
 		xheads = DIV_ROUND_UP(size, XLOG_HEADER_CYCLE_SIZE);
+		tail_xhead_len = size % XLOG_HEADER_CYCLE_SIZE;
+		if (sizeof(struct xlog_rec_ext_header) > tail_xhead_len)
+			xheads -= 1;
 
 		for (i = 1; i < xheads; i++) {
 			crc = crc32c(crc, &xhdr[i].hic_xheader,
Powered by blists - more mailing lists
 
