All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH v8 3/3] ksmbd: fix racy issue from using ->d_parent and ->d_name
Date: Thu, 16 Mar 2023 15:30:29 +0800	[thread overview]
Message-ID: <202303161501.AIXGVwna-lkp@intel.com> (raw)
In-Reply-To: <20230315223435.5139-4-linkinjeon@kernel.org>

Hi Namjae,

I love your patch! Perhaps something to improve:

[auto build test WARNING on vfs-idmapping/for-next]
[also build test WARNING on linus/master v6.3-rc2 next-20230316]
[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/Namjae-Jeon/ksmbd-remove-internal-h-include/20230316-063731
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping.git for-next
patch link:    https://lore.kernel.org/r/20230315223435.5139-4-linkinjeon%40kernel.org
patch subject: [PATCH v8 3/3] ksmbd: fix racy issue from using ->d_parent and ->d_name
config: i386-randconfig-a013-20230313 (https://download.01.org/0day-ci/archive/20230316/202303161501.AIXGVwna-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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/intel-lab-lkp/linux/commit/96a66748207926f3642ac4d24c7a591de22e3bad
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Namjae-Jeon/ksmbd-remove-internal-h-include/20230316-063731
        git checkout 96a66748207926f3642ac4d24c7a591de22e3bad
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash fs/ksmbd/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303161501.AIXGVwna-lkp@intel.com/

All warnings (new ones prefixed by >>):

   fs/ksmbd/vfs.c:54: warning: Function parameter or member 'parent' not described in 'ksmbd_vfs_lock_parent'
   fs/ksmbd/vfs.c:54: warning: Function parameter or member 'child' not described in 'ksmbd_vfs_lock_parent'
   fs/ksmbd/vfs.c:356: warning: Function parameter or member 'fp' not described in 'ksmbd_vfs_read'
   fs/ksmbd/vfs.c:356: warning: Excess function parameter 'fid' description in 'ksmbd_vfs_read'
   fs/ksmbd/vfs.c:472: warning: Function parameter or member 'fp' not described in 'ksmbd_vfs_write'
   fs/ksmbd/vfs.c:472: warning: Excess function parameter 'fid' description in 'ksmbd_vfs_write'
   fs/ksmbd/vfs.c:535: warning: Function parameter or member 'path' not described in 'ksmbd_vfs_getattr'
   fs/ksmbd/vfs.c:535: warning: Function parameter or member 'stat' not described in 'ksmbd_vfs_getattr'
   fs/ksmbd/vfs.c:535: warning: Excess function parameter 'work' description in 'ksmbd_vfs_getattr'
   fs/ksmbd/vfs.c:535: warning: Excess function parameter 'fid' description in 'ksmbd_vfs_getattr'
   fs/ksmbd/vfs.c:535: warning: Excess function parameter 'attrs' description in 'ksmbd_vfs_getattr'
   fs/ksmbd/vfs.c:552: warning: Function parameter or member 'p_id' not described in 'ksmbd_vfs_fsync'
   fs/ksmbd/vfs.c:575: warning: Function parameter or member 'work' not described in 'ksmbd_vfs_remove_file'
   fs/ksmbd/vfs.c:575: warning: Function parameter or member 'path' not described in 'ksmbd_vfs_remove_file'
   fs/ksmbd/vfs.c:575: warning: Excess function parameter 'name' description in 'ksmbd_vfs_remove_file'
   fs/ksmbd/vfs.c:613: warning: Function parameter or member 'work' not described in 'ksmbd_vfs_link'
   fs/ksmbd/vfs.c:779: warning: Function parameter or member 'fp' not described in 'ksmbd_vfs_truncate'
   fs/ksmbd/vfs.c:779: warning: Excess function parameter 'fid' description in 'ksmbd_vfs_truncate'
   fs/ksmbd/vfs.c:820: warning: Excess function parameter 'size' description in 'ksmbd_vfs_listxattr'
   fs/ksmbd/vfs.c:917: warning: Function parameter or member 'option' not described in 'ksmbd_vfs_set_fadvise'
   fs/ksmbd/vfs.c:917: warning: Excess function parameter 'options' description in 'ksmbd_vfs_set_fadvise'
   fs/ksmbd/vfs.c:1117: warning: Function parameter or member 'um' not described in 'ksmbd_vfs_lookup_in_dir'
   fs/ksmbd/vfs.c:1152: warning: Function parameter or member 'work' not described in 'ksmbd_vfs_kern_path_locked'
>> fs/ksmbd/vfs.c:1152: warning: expecting prototype for ksmbd_vfs_kern_path(). Prototype was for ksmbd_vfs_kern_path_locked() instead


vim +1152 fs/ksmbd/vfs.c

f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1139  
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1140  /**
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1141   * ksmbd_vfs_kern_path() - lookup a file and get path info
265fd1991c1db8 fs/ksmbd/vfs.c Hyunchul Lee  2021-09-25  1142   * @name:	file path that is relative to share
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1143   * @flags:	lookup flags
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1144   * @path:	if lookup succeed, return path info
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1145   * @caseless:	caseless filename lookup
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1146   *
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1147   * Return:	0 on success, otherwise error
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1148   */
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1149  int ksmbd_vfs_kern_path_locked(struct ksmbd_work *work, char *name,
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1150  			       unsigned int flags, struct path *path,
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1151  			       bool caseless)
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16 @1152  {
265fd1991c1db8 fs/ksmbd/vfs.c Hyunchul Lee  2021-09-25  1153  	struct ksmbd_share_config *share_conf = work->tcon->share_conf;
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1154  	int err;
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1155  	struct path parent_path;
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1156  
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1157  	err = ksmbd_vfs_path_lookup_locked(share_conf, name, flags, path);
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1158  	if (!err)
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1159  		return err;
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1160  
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1161  	if (caseless) {
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1162  		char *filepath;
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1163  		size_t path_len, remain_len;
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1164  
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1165  		filepath = kstrdup(name, GFP_KERNEL);
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1166  		if (!filepath)
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1167  			return -ENOMEM;
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1168  
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1169  		path_len = strlen(filepath);
265fd1991c1db8 fs/ksmbd/vfs.c Hyunchul Lee  2021-09-25  1170  		remain_len = path_len;
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1171  
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1172  		parent_path = share_conf->vfs_path;
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1173  		path_get(&parent_path);
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1174  
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1175  		while (d_can_lookup(parent_path.dentry)) {
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1176  			char *filename = filepath + path_len - remain_len;
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1177  			char *next = strchrnul(filename, '/');
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1178  			size_t filename_len = next - filename;
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1179  			bool is_last = !next[0];
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1180  
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1181  			if (filename_len == 0)
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1182  				break;
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1183  
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1184  			err = ksmbd_vfs_lookup_in_dir(&parent_path, filename,
dbab80e2071ad8 fs/ksmbd/vfs.c Atte Heikkilä 2022-09-28  1185  						      filename_len,
dbab80e2071ad8 fs/ksmbd/vfs.c Atte Heikkilä 2022-09-28  1186  						      work->conn->um);
265fd1991c1db8 fs/ksmbd/vfs.c Hyunchul Lee  2021-09-25  1187  			if (err)
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1188  				goto out2;
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1189  
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1190  			next[0] = '\0';
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1191  
265fd1991c1db8 fs/ksmbd/vfs.c Hyunchul Lee  2021-09-25  1192  			err = vfs_path_lookup(share_conf->vfs_path.dentry,
265fd1991c1db8 fs/ksmbd/vfs.c Hyunchul Lee  2021-09-25  1193  					      share_conf->vfs_path.mnt,
265fd1991c1db8 fs/ksmbd/vfs.c Hyunchul Lee  2021-09-25  1194  					      filepath,
265fd1991c1db8 fs/ksmbd/vfs.c Hyunchul Lee  2021-09-25  1195  					      flags,
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1196  					      path);
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1197  			if (err)
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1198  				goto out2;
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1199  			else if (is_last)
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1200  				goto out1;
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1201  			path_put(&parent_path);
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1202  			parent_path = *path;
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1203  
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1204  			next[0] = '/';
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1205  			remain_len -= filename_len + 1;
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1206  		}
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1207  
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1208  		err = -EINVAL;
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1209  out2:
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1210  		path_put(&parent_path);
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1211  out1:
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1212  		kfree(filepath);
3c20378325c710 fs/cifsd/vfs.c Hyunchul Lee  2021-04-13  1213  	}
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1214  
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1215  	if (!err) {
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1216  		err = ksmbd_vfs_lock_parent(parent_path.dentry, path->dentry);
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1217  		if (err)
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1218  			dput(path->dentry);
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1219  		path_put(&parent_path);
96a66748207926 fs/ksmbd/vfs.c Namjae Jeon   2023-03-16  1220  	}
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1221  	return err;
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1222  }
f44158485826c0 fs/cifsd/vfs.c Namjae Jeon   2021-03-16  1223  

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

  parent reply	other threads:[~2023-03-16  7:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 22:34 [PATCH v8 0/3] ksmbd patches included vfs changes Namjae Jeon
2023-03-15 22:34 ` [PATCH v8 1/3] ksmbd: remove internal.h include Namjae Jeon
2023-03-17  8:55   ` Christian Brauner
2023-03-15 22:34 ` [PATCH v8 2/3] fs: introduce lock_rename_child() helper Namjae Jeon
2023-03-16  0:46   ` [lkp] [+118 bytes kernel size regression] [i386-tinyconfig] [6e6937ac88] " kernel test robot
2023-03-15 22:34 ` [PATCH v8 3/3] ksmbd: fix racy issue from using ->d_parent and ->d_name Namjae Jeon
2023-03-16  0:30   ` kernel test robot
2023-03-16  0:56     ` Namjae Jeon
2023-03-16  7:30   ` kernel test robot [this message]
2023-04-21  2:35 ` [PATCH v8 0/3] ksmbd patches included vfs changes Al Viro
2023-04-21  2:38   ` Al Viro
2023-04-21  7:26   ` Namjae Jeon
2023-06-13 10:57 ` Amir Goldstein
2023-06-13 12:24   ` Namjae Jeon

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=202303161501.AIXGVwna-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linkinjeon@kernel.org \
    --cc=llvm@lists.linux.dev \
    --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.