LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: sishuaigong <sishuai@purdue.edu>, jlbec@evilplan.org, hch@lst.de
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	sishuaigong <sishuai@purdue.edu>
Subject: Re: [PATCH v2] configfs: fix a race in configfs_lookup()
Date: Tue, 24 Aug 2021 07:33:41 +0800	[thread overview]
Message-ID: <202108240707.hJ9l8snv-lkp@intel.com> (raw)
In-Reply-To: <20210823194318.17528-1-sishuai@purdue.edu>

[-- Attachment #1: Type: text/plain, Size: 3989 bytes --]

Hi sishuaigong,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on hch-configfs/for-next]
[also build test WARNING on v5.14-rc7 next-20210823]
[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]

url:    https://github.com/0day-ci/linux/commits/sishuaigong/configfs-fix-a-race-in-configfs_lookup/20210824-034517
base:   git://git.infradead.org/users/hch/configfs.git for-next
config: m68k-buildonly-randconfig-r006-20210822 (attached as .config)
compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/ff28c41926fb184655325e34dba02c438963dcf5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review sishuaigong/configfs-fix-a-race-in-configfs_lookup/20210824-034517
        git checkout ff28c41926fb184655325e34dba02c438963dcf5
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=m68k 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   fs/configfs/dir.c: In function 'configfs_lookup':
>> fs/configfs/dir.c:446:25: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     446 |                         struct configfs_attribute *attr = sd->s_element;
         |                         ^~~~~~


vim +446 fs/configfs/dir.c

   419	
   420	static struct dentry * configfs_lookup(struct inode *dir,
   421					       struct dentry *dentry,
   422					       unsigned int flags)
   423	{
   424		struct configfs_dirent * parent_sd = dentry->d_parent->d_fsdata;
   425		struct configfs_dirent * sd;
   426		struct inode *inode = NULL;
   427	
   428		/*
   429		 * Fake invisibility if dir belongs to a group/default groups hierarchy
   430		 * being attached
   431		 *
   432		 * This forbids userspace to read/write attributes of items which may
   433		 * not complete their initialization, since the dentries of the
   434		 * attributes won't be instantiated.
   435		 */
   436		if (!configfs_dirent_is_ready(parent_sd))
   437			return ERR_PTR(-ENOENT);
   438	
   439		spin_lock(&configfs_dirent_lock);
   440		list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
   441			if (sd->s_type & CONFIGFS_NOT_PINNED) {
   442				const unsigned char *name = configfs_get_name(sd);
   443				if (strcmp(name, dentry->d_name.name))
   444					continue;
   445	
 > 446				struct configfs_attribute *attr = sd->s_element;
   447				umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG;
   448	
   449				dentry->d_fsdata = configfs_get(sd);
   450				sd->s_dentry = dentry;
   451	
   452				spin_unlock(&configfs_dirent_lock);
   453	
   454				inode = configfs_create(dentry, mode);
   455				if (IS_ERR(inode)) {
   456					configfs_put(sd);
   457					return ERR_CAST(inode);
   458				}
   459				if (sd->s_type & CONFIGFS_ITEM_BIN_ATTR) {
   460					inode->i_size = 0;
   461					inode->i_fop = &configfs_bin_file_operations;
   462				} else {
   463					inode->i_size = PAGE_SIZE;
   464					inode->i_fop = &configfs_file_operations;
   465				}
   466				goto out;
   467			}
   468		}
   469		spin_unlock(&configfs_dirent_lock);
   470	
   471		/*
   472		 * If it doesn't exist and it isn't a NOT_PINNED item,
   473		 * it must be negative.
   474		 */
   475		if (dentry->d_name.len > NAME_MAX)
   476			return ERR_PTR(-ENAMETOOLONG);
   477	out:
   478		d_add(dentry, inode);
   479		return NULL;
   480	}
   481	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 20766 bytes --]

      reply	other threads:[~2021-08-23 23:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23 19:43 sishuaigong
2021-08-23 23:33 ` 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=202108240707.hJ9l8snv-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=hch@lst.de \
    --cc=jlbec@evilplan.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sishuai@purdue.edu \
    --subject='Re: [PATCH v2] configfs: fix a race in configfs_lookup()' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).