Re: [PATCH] padata: Fix the UAF issue related to parallel_data

From: kernel test robot
Date: Tue Sep 26 2023 - 21:38:24 EST


Hi Wang,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.6-rc3 next-20230926]
[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/Wang-Jinchao/padata-Fix-the-UAF-issue-related-to-parallel_data/20230925-153852
base: linus/master
patch link: https://lore.kernel.org/r/ZRE4XvOOhz4HSOgR%40fedora
patch subject: [PATCH] padata: Fix the UAF issue related to parallel_data
config: i386-randconfig-062-20230925 (https://download.01.org/0day-ci/archive/20230927/202309270829.xHgTOMKw-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230927/202309270829.xHgTOMKw-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/202309270829.xHgTOMKw-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> kernel/padata.c:1110:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct refcount_struct [usertype] *r @@ got struct refcount_struct [noderef] __rcu * @@
kernel/padata.c:1110:38: sparse: expected struct refcount_struct [usertype] *r
kernel/padata.c:1110:38: sparse: got struct refcount_struct [noderef] __rcu *

vim +1110 kernel/padata.c

1097
1098 /**
1099 * padata_free_shell - free a padata shell
1100 *
1101 * @ps: padata shell to free
1102 */
1103 void padata_free_shell(struct padata_shell *ps)
1104 {
1105 if (!ps)
1106 return;
1107
1108 mutex_lock(&ps->pinst->lock);
1109 list_del(&ps->list);
> 1110 if (refcount_dec_and_test(&ps->pd->refcnt))
1111 padata_free_pd(rcu_dereference_protected(ps->pd, 1));
1112 mutex_unlock(&ps->pinst->lock);
1113
1114 kfree(ps);
1115 }
1116 EXPORT_SYMBOL(padata_free_shell);
1117

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