All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: YangWen <anmuxixixi@gmail.com>, hirofumi@mail.parknet.co.jp
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	YangWen <anmuxixixi@gmail.com>
Subject: Re: [PATCH] fat: fix data-race between fat12_ent_put() and fat_mirror_bhs()
Date: Wed, 3 Sep 2025 03:56:54 +0800	[thread overview]
Message-ID: <202509030347.6cUT1zxe-lkp@intel.com> (raw)
In-Reply-To: <20250902081727.7146-1-anmuxixixi@gmail.com>

Hi YangWen,

kernel test robot noticed the following build errors:

[auto build test ERROR on brauner-vfs/vfs.all]
[also build test ERROR on linus/master v6.17-rc4 next-20250902]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/YangWen/fat-fix-data-race-between-fat12_ent_put-and-fat_mirror_bhs/20250902-162253
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all
patch link:    https://lore.kernel.org/r/20250902081727.7146-1-anmuxixixi%40gmail.com
patch subject: [PATCH] fat: fix data-race between fat12_ent_put() and fat_mirror_bhs()
config: csky-randconfig-002-20250903 (https://download.01.org/0day-ci/archive/20250903/202509030347.6cUT1zxe-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250903/202509030347.6cUT1zxe-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509030347.6cUT1zxe-lkp@intel.com/

All errors (new ones prefixed by >>):

   fs/fat/fatent.c: In function 'fat_mirror_bhs':
>> fs/fat/fatent.c:382:25: error: called object 'is_fat12' is not a function or function pointer
     382 |         bool is_fat12 = is_fat12(sbi);
         |                         ^~~~~~~~
   fs/fat/fatent.c:382:14: note: declared here
     382 |         bool is_fat12 = is_fat12(sbi);
         |              ^~~~~~~~


vim +/is_fat12 +382 fs/fat/fatent.c

   374	
   375	/* FIXME: We can write the blocks as more big chunk. */
   376	static int fat_mirror_bhs(struct super_block *sb, struct buffer_head **bhs,
   377				  int nr_bhs)
   378	{
   379		struct msdos_sb_info *sbi = MSDOS_SB(sb);
   380		struct buffer_head *c_bh;
   381		int err, n, copy;
 > 382		bool is_fat12 = is_fat12(sbi);
   383	
   384		err = 0;
   385		for (copy = 1; copy < sbi->fats; copy++) {
   386			sector_t backup_fat = sbi->fat_length * copy;
   387	
   388			for (n = 0; n < nr_bhs; n++) {
   389				c_bh = sb_getblk(sb, backup_fat + bhs[n]->b_blocknr);
   390				if (!c_bh) {
   391					err = -ENOMEM;
   392					goto error;
   393				}
   394				/* Avoid race with userspace read via bdev */
   395				lock_buffer(c_bh);
   396				/*
   397				 * For FAT12, protect memcpy() of the source sector
   398				 * against concurrent 12-bit entry updates in
   399				 * fat12_ent_put(), otherwise we may copy a torn
   400				 * pair of bytes into the mirror FAT.
   401				 */
   402				if (is_fat12)
   403					spin_lock(&fat12_entry_lock);
   404				memcpy(c_bh->b_data, bhs[n]->b_data, sb->s_blocksize);
   405				if (is_fat12)
   406					spin_unlock(&fat12_entry_lock);
   407				set_buffer_uptodate(c_bh);
   408				unlock_buffer(c_bh);
   409				mark_buffer_dirty_inode(c_bh, sbi->fat_inode);
   410				if (sb->s_flags & SB_SYNCHRONOUS)
   411					err = sync_dirty_buffer(c_bh);
   412				brelse(c_bh);
   413				if (err)
   414					goto error;
   415			}
   416		}
   417	error:
   418		return err;
   419	}
   420	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

      parent reply	other threads:[~2025-09-02 19:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02  8:17 [PATCH] fat: fix data-race between fat12_ent_put() and fat_mirror_bhs() YangWen
2025-09-02  9:01 ` OGAWA Hirofumi
2025-09-02 12:07   ` [PATCH] drivers: example: fix memory leak YangWen
2025-09-02 12:38     ` OGAWA Hirofumi
2025-09-02 13:24       ` [PATCH] fat: fix data-race between fat12_ent_put() and fat_mirror_bhs() YangWen
2025-09-02 13:38         ` OGAWA Hirofumi
2025-09-02 14:20           ` YangWen
2025-09-02 18:05             ` OGAWA Hirofumi
2025-09-03  2:28               ` YangWen
2025-09-02 12:11   ` YangWen
2025-09-02 19:56 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202509030347.6cUT1zxe-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=anmuxixixi@gmail.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.