Re: [PATCH] crypto: qat - fix Use-After-Free in adf_ctl_ioctl_dev_start()

From: kernel test robot

Date: Mon May 11 2026 - 08:29:17 EST


Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on herbert-cryptodev-2.6/master]
[also build test ERROR on herbert-crypto-2.6/master linus/master v7.1-rc3 next-20260508]
[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/w15303746062-163-com/crypto-qat-fix-Use-After-Free-in-adf_ctl_ioctl_dev_start/20260510-110441
base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link: https://lore.kernel.org/r/20260508023542.256299-1-w15303746062%40163.com
patch subject: [PATCH] crypto: qat - fix Use-After-Free in adf_ctl_ioctl_dev_start()
config: loongarch-randconfig-001-20260510 (https://download.01.org/0day-ci/archive/20260511/202605112040.jcfTlYZH-lkp@xxxxxxxxx/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260511/202605112040.jcfTlYZH-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605112040.jcfTlYZH-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> drivers/crypto/intel/qat/qat_common/adf_ctl_drv.c:286:6: error: use of undeclared identifier 'accel_dev'
286 | if (accel_dev)
| ^~~~~~~~~
drivers/crypto/intel/qat/qat_common/adf_ctl_drv.c:287:15: error: use of undeclared identifier 'accel_dev'
287 | adf_dev_put(accel_dev);
| ^~~~~~~~~
2 errors generated.


vim +/accel_dev +286 drivers/crypto/intel/qat/qat_common/adf_ctl_drv.c

255
256 static int adf_ctl_ioctl_dev_stop(struct file *fp, unsigned int cmd,
257 unsigned long arg)
258 {
259 int ret;
260 struct adf_user_cfg_ctl_data *ctl_data;
261
262 ctl_data = adf_ctl_alloc_resources(arg);
263 if (IS_ERR(ctl_data))
264 return PTR_ERR(ctl_data);
265
266 if (adf_devmgr_verify_id(ctl_data->device_id)) {
267 pr_err("QAT: Device %d not found\n", ctl_data->device_id);
268 ret = -ENODEV;
269 goto out;
270 }
271
272 ret = adf_ctl_is_device_in_use(ctl_data->device_id);
273 if (ret)
274 goto out;
275
276 if (ctl_data->device_id == ADF_CFG_ALL_DEVICES)
277 pr_info("QAT: Stopping all acceleration devices.\n");
278 else
279 pr_info("QAT: Stopping acceleration device qat_dev%d.\n",
280 ctl_data->device_id);
281
282 adf_ctl_stop_devices(ctl_data->device_id);
283
284 out:
285 /* Release the reference acquired by adf_devmgr_get_dev_by_id() */
> 286 if (accel_dev)
287 adf_dev_put(accel_dev);
288
289 kfree(ctl_data);
290 return ret;
291 }
292

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