Re: [PATCH] audit: add FSOPEN record to log filesystem name
kernel test robot <[email protected]>
| Newsgroups | dev.linux.lists.oe-kbuild |
|---|---|
| Message-ID | <[email protected]> |
BCC: [email protected] CC: [email protected] In-Reply-To: <[email protected]> References: <[email protected]> TO: Ricardo Robaina <[email protected]> TO: [email protected] TO: [email protected] TO: [email protected] CC: [email protected] CC: [email protected] CC: [email protected] CC: [email protected] CC: [email protected] CC: Ricardo Robaina <[email protected]> Hi Ricardo, kernel test robot noticed the following build warnings: [auto build test WARNING on pcmoore-audit/next] [also build test WARNING on brauner-vfs/vfs.all linus/master v7.2-rc6 next-20260807] [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/Ricardo-Robaina/audit-add-FSOPEN-record-to-log-filesystem-name/20260807-192421 base: https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit.git next patch link: https://lore.kernel.org/r/20260701132410.711205-1-rrobaina%40redhat.com patch subject: [PATCH] audit: add FSOPEN record to log filesystem name :::::: branch date: 14 hours ago :::::: commit date: 14 hours ago config: sparc-randconfig-r071-20260808 (https://download.01.org/0day-ci/archive/20260808/[email protected]/config) compiler: sparc-linux-gcc (GCC) 8.5.0 smatch: v0.5.0-9187-g5189e3fb 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 <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/ New smatch warnings: fs/fsopen.c:154 __do_sys_fsopen() warn: passing freed memory 'fs_name' (line 139) fs/fsopen.c:154 __do_sys_fsopen() warn: passing freed memory 'fs_name' (line 139) Old smatch warnings: fs/fsopen.c:481 __do_sys_fsconfig() warn: variable dereferenced before check 'param.name' (see line 450) fs/fsopen.c:481 __do_sys_fsconfig() warn: variable dereferenced before check 'param.name' (see line 450) vim +/fs_name +154 fs/fsopen.c 007ec26cdc9fef David Howells 2018-11-01 113 24dcb3d90a1f67 David Howells 2018-11-01 114 /* 24dcb3d90a1f67 David Howells 2018-11-01 115 * Open a filesystem by name so that it can be configured for mounting. 24dcb3d90a1f67 David Howells 2018-11-01 116 * 24dcb3d90a1f67 David Howells 2018-11-01 117 * We are allowed to specify a container in which the filesystem will be 24dcb3d90a1f67 David Howells 2018-11-01 118 * opened, thereby indicating which namespaces will be used (notably, which 24dcb3d90a1f67 David Howells 2018-11-01 119 * network namespace will be used for network filesystems). 24dcb3d90a1f67 David Howells 2018-11-01 120 */ 24dcb3d90a1f67 David Howells 2018-11-01 121 SYSCALL_DEFINE2(fsopen, const char __user *, _fs_name, unsigned int, flags) 24dcb3d90a1f67 David Howells 2018-11-01 122 { 24dcb3d90a1f67 David Howells 2018-11-01 123 struct file_system_type *fs_type; 24dcb3d90a1f67 David Howells 2018-11-01 124 struct fs_context *fc; 24dcb3d90a1f67 David Howells 2018-11-01 125 const char *fs_name; 007ec26cdc9fef David Howells 2018-11-01 126 int ret; 24dcb3d90a1f67 David Howells 2018-11-01 127 a5f85d7834f7e1 Al Viro 2022-03-01 128 if (!may_mount()) 24dcb3d90a1f67 David Howells 2018-11-01 129 return -EPERM; 24dcb3d90a1f67 David Howells 2018-11-01 130 24dcb3d90a1f67 David Howells 2018-11-01 131 if (flags & ~FSOPEN_CLOEXEC) 24dcb3d90a1f67 David Howells 2018-11-01 132 return -EINVAL; 24dcb3d90a1f67 David Howells 2018-11-01 133 24dcb3d90a1f67 David Howells 2018-11-01 134 fs_name = strndup_user(_fs_name, PAGE_SIZE); 24dcb3d90a1f67 David Howells 2018-11-01 135 if (IS_ERR(fs_name)) 24dcb3d90a1f67 David Howells 2018-11-01 136 return PTR_ERR(fs_name); 24dcb3d90a1f67 David Howells 2018-11-01 137 24dcb3d90a1f67 David Howells 2018-11-01 138 fs_type = get_fs_type(fs_name); 24dcb3d90a1f67 David Howells 2018-11-01 @139 kfree(fs_name); 24dcb3d90a1f67 David Howells 2018-11-01 140 if (!fs_type) 24dcb3d90a1f67 David Howells 2018-11-01 141 return -ENODEV; 24dcb3d90a1f67 David Howells 2018-11-01 142 24dcb3d90a1f67 David Howells 2018-11-01 143 fc = fs_context_for_mount(fs_type, 0); 24dcb3d90a1f67 David Howells 2018-11-01 144 put_filesystem(fs_type); 24dcb3d90a1f67 David Howells 2018-11-01 145 if (IS_ERR(fc)) 24dcb3d90a1f67 David Howells 2018-11-01 146 return PTR_ERR(fc); 24dcb3d90a1f67 David Howells 2018-11-01 147 24dcb3d90a1f67 David Howells 2018-11-01 148 fc->phase = FS_CONTEXT_CREATE_PARAMS; 007ec26cdc9fef David Howells 2018-11-01 149 007ec26cdc9fef David Howells 2018-11-01 150 ret = fscontext_alloc_log(fc); 007ec26cdc9fef David Howells 2018-11-01 151 if (ret < 0) 007ec26cdc9fef David Howells 2018-11-01 152 goto err_fc; 007ec26cdc9fef David Howells 2018-11-01 153 aee6439c3eb4ef Ricardo Robaina 2026-07-01 @154 audit_log_fsopen(fs_name); aee6439c3eb4ef Ricardo Robaina 2026-07-01 155 24dcb3d90a1f67 David Howells 2018-11-01 156 return fscontext_create_fd(fc, flags & FSOPEN_CLOEXEC ? O_CLOEXEC : 0); 007ec26cdc9fef David Howells 2018-11-01 157 007ec26cdc9fef David Howells 2018-11-01 158 err_fc: 007ec26cdc9fef David Howells 2018-11-01 159 put_fs_context(fc); 007ec26cdc9fef David Howells 2018-11-01 160 return ret; 24dcb3d90a1f67 David Howells 2018-11-01 161 } ecdab150fddb42 David Howells 2018-11-01 162 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki