In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix to avoid potential memory corruption in __updateiostatlatency()
Add iotype sanity check to avoid potential memory corruption. This is to fix the compile error below:
fs/f2fs/iostat.c:231 __updateiostatlatency() error: buffer overflow 'iolat->peaklat[type]' 3 <= 3
vim +228 fs/f2fs/iostat.c
211 static inline void _updateiostatlatency(struct bioiostatctx *iostatctx, 212 enum iostatlattype type) 213 { 214 unsigned long tsdiff; 215 unsigned int pagetype = iostatctx->type; 216 struct f2fssbinfo *sbi = iostatctx->sbi; 217 struct iostatlatinfo *iolat = sbi->iostatiolat; 218 unsigned long flags; 219 220 if (!sbi->iostatenable) 221 return; 222 223 tsdiff = jiffies - iostatctx->submitts; 224 if (pagetype >= META_FLUSH) ^^^^^^^^^^
225 pagetype = META; 226 227 spinlockirqsave(&sbi->iostatlatlock, flags); @228 iolat->sumlat[type][pagetype] += tsdiff; ^^^^^^^^^ Mixup between METAFLUSH and NRPAGETYPE leads to memory corruption.
{
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/53xxx/CVE-2023-53214.json",
"cna_assigner": "Linux"
}