lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <202301131759.qq5Cubxn-lkp@intel.com> Date: Fri, 13 Jan 2023 12:26:26 +0300 From: Dan Carpenter <error27@...il.com> To: oe-kbuild@...ts.linux.dev, Yangtao Li <frank.li@...o.com>, jaegeuk@...nel.org, chao@...nel.org Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev, linux-f2fs-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org, Yangtao Li <frank.li@...o.com> Subject: Re: [PATCH] f2fs: use iostat_lat_type directly as a parameter in the iostat_update_and_unbind_ctx() Hi Yangtao, https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Yangtao-Li/f2fs-use-iostat_lat_type-directly-as-a-parameter-in-the-iostat_update_and_unbind_ctx/20230105-122414 base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test patch link: https://lore.kernel.org/r/20230105042240.24738-1-frank.li%40vivo.com patch subject: [PATCH] f2fs: use iostat_lat_type directly as a parameter in the iostat_update_and_unbind_ctx() config: alpha-randconfig-m041-20230110 compiler: alpha-linux-gcc (GCC) 12.1.0 If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@...el.com> | Reported-by: Dan Carpenter <error27@...il.com> New smatch warnings: fs/f2fs/iostat.c:228 __update_iostat_latency() error: buffer overflow 'io_lat->sum_lat[type]' 3 <= 3 fs/f2fs/iostat.c:229 __update_iostat_latency() error: buffer overflow 'io_lat->bio_cnt[type]' 3 <= 3 fs/f2fs/iostat.c:230 __update_iostat_latency() error: buffer overflow 'io_lat->peak_lat[type]' 3 <= 3 Old smatch warnings: fs/f2fs/iostat.c:231 __update_iostat_latency() error: buffer overflow 'io_lat->peak_lat[type]' 3 <= 3 vim +228 fs/f2fs/iostat.c a4b6817625e71d Daeho Jeong 2021-08-20 211 static inline void __update_iostat_latency(struct bio_iostat_ctx *iostat_ctx, 2804a18e00dbd6 Yangtao Li 2023-01-05 212 enum iostat_lat_type type) a4b6817625e71d Daeho Jeong 2021-08-20 213 { a4b6817625e71d Daeho Jeong 2021-08-20 214 unsigned long ts_diff; 2804a18e00dbd6 Yangtao Li 2023-01-05 215 unsigned int page_type = iostat_ctx->type; a4b6817625e71d Daeho Jeong 2021-08-20 216 struct f2fs_sb_info *sbi = iostat_ctx->sbi; a4b6817625e71d Daeho Jeong 2021-08-20 217 struct iostat_lat_info *io_lat = sbi->iostat_io_lat; 61803e984307c7 Daeho Jeong 2022-06-10 218 unsigned long flags; a4b6817625e71d Daeho Jeong 2021-08-20 219 a4b6817625e71d Daeho Jeong 2021-08-20 220 if (!sbi->iostat_enable) a4b6817625e71d Daeho Jeong 2021-08-20 221 return; a4b6817625e71d Daeho Jeong 2021-08-20 222 a4b6817625e71d Daeho Jeong 2021-08-20 223 ts_diff = jiffies - iostat_ctx->submit_ts; 2804a18e00dbd6 Yangtao Li 2023-01-05 224 if (page_type >= META_FLUSH) ^^^^^^^^^^ 2804a18e00dbd6 Yangtao Li 2023-01-05 225 page_type = META; a4b6817625e71d Daeho Jeong 2021-08-20 226 61803e984307c7 Daeho Jeong 2022-06-10 227 spin_lock_irqsave(&sbi->iostat_lat_lock, flags); 2804a18e00dbd6 Yangtao Li 2023-01-05 @228 io_lat->sum_lat[type][page_type] += ts_diff; ^^^^^^^^^ Mixup between META_FLUSH and NR_PAGE_TYPE leads to memory corruption. 2804a18e00dbd6 Yangtao Li 2023-01-05 @229 io_lat->bio_cnt[type][page_type]++; 2804a18e00dbd6 Yangtao Li 2023-01-05 @230 if (ts_diff > io_lat->peak_lat[type][page_type]) 2804a18e00dbd6 Yangtao Li 2023-01-05 231 io_lat->peak_lat[type][page_type] = ts_diff; 61803e984307c7 Daeho Jeong 2022-06-10 232 spin_unlock_irqrestore(&sbi->iostat_lat_lock, flags); a4b6817625e71d Daeho Jeong 2021-08-20 233 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
Powered by blists - more mailing lists