[PATCH v2] powerpc/pseries/papr-hvpipe: fix NULL dereference in handle creation

kernel test robot lkp at intel.com
Wed Apr 22 18:54:41 AEST 2026


Hi Guangshuo,

kernel test robot noticed the following build errors:

[auto build test ERROR on powerpc/next]
[also build test ERROR on powerpc/fixes linus/master v7.0 next-20260421]
[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/Guangshuo-Li/powerpc-pseries-papr-hvpipe-fix-NULL-dereference-in-handle-creation/20260420-224327
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link:    https://lore.kernel.org/r/20260420132429.128075-1-lgs201920130244%40gmail.com
patch subject: [PATCH v2] powerpc/pseries/papr-hvpipe: fix NULL dereference in handle creation
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20260422/202604221653.KzDQsCY8-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260422/202604221653.KzDQsCY8-lkp@intel.com/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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604221653.KzDQsCY8-lkp@intel.com/

All errors (new ones prefixed by >>):

   arch/powerpc/platforms/pseries/papr-hvpipe.c: In function 'papr_hvpipe_dev_create_handle':
>> arch/powerpc/platforms/pseries/papr-hvpipe.c:513:24: error: invalid use of void expression
     513 |         owned_src_info = retain_and_null_ptr(src_info);
         |                        ^


vim +513 arch/powerpc/platforms/pseries/papr-hvpipe.c

   479	
   480	static int papr_hvpipe_dev_create_handle(u32 srcID)
   481	{
   482		struct hvpipe_source_info *src_info __free(kfree) = NULL;
   483		struct hvpipe_source_info *owned_src_info;
   484	
   485		spin_lock(&hvpipe_src_list_lock);
   486		/*
   487		 * Do not allow more than one process communicates with
   488		 * each source.
   489		 */
   490		src_info = hvpipe_find_source(srcID);
   491		if (src_info) {
   492			spin_unlock(&hvpipe_src_list_lock);
   493			pr_err("pid(%d) is already using the source(%d)\n",
   494					src_info->tsk->pid, srcID);
   495			return -EALREADY;
   496		}
   497		spin_unlock(&hvpipe_src_list_lock);
   498	
   499		src_info = kzalloc_obj(*src_info, GFP_KERNEL_ACCOUNT);
   500		if (!src_info)
   501			return -ENOMEM;
   502	
   503		src_info->srcID = srcID;
   504		src_info->tsk = current;
   505		init_waitqueue_head(&src_info->recv_wqh);
   506	
   507		FD_PREPARE(fdf, O_RDONLY | O_CLOEXEC,
   508			   anon_inode_getfile("[papr-hvpipe]", &papr_hvpipe_handle_ops,
   509					      (void *)src_info, O_RDWR));
   510		if (fdf.err)
   511			return fdf.err;
   512	
 > 513		owned_src_info = retain_and_null_ptr(src_info);
   514		spin_lock(&hvpipe_src_list_lock);
   515		/*
   516		 * If two processes are executing ioctl() for the same
   517		 * source ID concurrently, prevent the second process to
   518		 * acquire FD.
   519		 */
   520		if (hvpipe_find_source(srcID)) {
   521			spin_unlock(&hvpipe_src_list_lock);
   522			return -EALREADY;
   523		}
   524		list_add(&owned_src_info->list, &hvpipe_src_list);
   525		spin_unlock(&hvpipe_src_list_lock);
   526		return fd_publish(fdf);
   527	}
   528	

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


More information about the Linuxppc-dev mailing list