Re: [PATCH] crypto: hisilicon/sec - Fix element drop and UAF in sec_send_request()

kernel test robot <[email protected]> Sat, 1 Aug 2026 04:39:54 +0800
Newsgroups org.kernel.vger.linux-crypto,dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
Hi Arbab,

kernel test robot noticed the following build warnings:

[auto build test WARNING on herbert-cryptodev-2.6/master]
[also build test WARNING on herbert-crypto-2.6/master linus/master v7.2-rc5 next-20260731]
[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/Arbab-Haider/crypto-hisilicon-sec-Fix-element-drop-and-UAF-in-sec_send_request/20260731-234619
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/20260730215449.299311-1-arbabhaider649%40gmail.com
patch subject: [PATCH] crypto: hisilicon/sec - Fix element drop and UAF in sec_send_request()
config: alpha-allmodconfig (https://download.01.org/0day-ci/archive/20260801/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260801/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   drivers/crypto/hisilicon/sec/sec_algs.c: In function 'sec_send_request':
>> drivers/crypto/hisilicon/sec/sec_algs.c:406:33: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
     406 |                                 ;
         |                                 ^
   drivers/crypto/hisilicon/sec/sec_algs.c:410:33: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
     410 |                                 ;
         |                                 ^


vim +/if +406 drivers/crypto/hisilicon/sec/sec_algs.c

   382	
   383	/* queuelock must be held */
   384	static void sec_send_request(struct sec_request *sec_req, struct sec_queue *queue)
   385	{
   386		struct sec_request_el *el, *temp;
   387	
   388		mutex_lock(&sec_req->lock);
   389		list_for_each_entry_safe(el, temp, &sec_req->elements, head) {
   390			/*
   391			 * Add to hardware queue only under following circumstances
   392			 * 1) Software and hardware queue empty so no chain dependencies
   393			 * 2) No dependencies as new IV - (check software queue empty
   394			 *    to maintain order)
   395			 * 3) No dependencies because the mode does no chaining.
   396			 *
   397			 * In other cases first insert onto the software queue which
   398			 * is then emptied as requests complete
   399			 */
   400			if (!queue->havesoftqueue ||
   401			    (kfifo_is_empty(&queue->softqueue) &&
   402			     sec_queue_empty(queue))) {
   403				if (WARN_ON_ONCE(sec_queue_send(queue, &el->req,
   404								sec_req)))
   405					/* Should not happen with proper capacity check */
 > 406					;
   407			} else {
   408				if (WARN_ON_ONCE(!kfifo_put(&queue->softqueue, el)))
   409					/* Should not happen with proper capacity check */
   410					;
   411			}
   412		}
   413		mutex_unlock(&sec_req->lock);
   414	}
   415	

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