Re: [PATCH 2/2] drivers: nfc: nfcmrvl: fix double free bug in nfc_fw_download_done()

From: kernel test robot
Date: Tue Apr 12 2022 - 13:01:08 EST


Hi Duoming,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]
[also build test ERROR on net/master linus/master linux/master v5.18-rc2 next-20220412]
[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]

url: https://github.com/intel-lab-lkp/linux/commits/Duoming-Zhou/Fix-double-free-bugs-in-nfcmrvl-module/20220412-203028
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b66bfc131c69bd9a5ed3ae90be4cf47ec46c1526
config: i386-randconfig-a004-20220411 (https://download.01.org/0day-ci/archive/20220413/202204130040.8kwehlO8-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project fe2478d44e4f7f191c43fef629ac7a23d0251e72)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/1f4dba76cb2e854d8ae29781d066257f58b33dee
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Duoming-Zhou/Fix-double-free-bugs-in-nfcmrvl-module/20220412-203028
git checkout 1f4dba76cb2e854d8ae29781d066257f58b33dee
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> drivers/nfc/nfcmrvl/fw_dnld.c:120:6: error: use of undeclared identifier 'dev'
if (dev->fw_download_in_progress)
^
1 error generated.


vim +/dev +120 drivers/nfc/nfcmrvl/fw_dnld.c

92
93 static void fw_dnld_over(struct nfcmrvl_private *priv, u32 error)
94 {
95 spin_lock_irq(&priv->fw_dnld.lock);
96 if (priv->fw_dnld.fw) {
97 release_firmware(priv->fw_dnld.fw);
98 priv->fw_dnld.fw = NULL;
99 priv->fw_dnld.header = NULL;
100 priv->fw_dnld.binary_config = NULL;
101 }
102 spin_unlock_irq(&priv->fw_dnld.lock);
103
104 atomic_set(&priv->ndev->cmd_cnt, 0);
105
106 if (timer_pending(&priv->ndev->cmd_timer))
107 del_timer_sync(&priv->ndev->cmd_timer);
108
109 if (timer_pending(&priv->fw_dnld.timer))
110 del_timer_sync(&priv->fw_dnld.timer);
111
112 nfc_info(priv->dev, "FW loading over (%d)]\n", error);
113
114 if (error != 0) {
115 /* failed, halt the chip to avoid power consumption */
116 nfcmrvl_chip_halt(priv);
117 }
118
119 spin_lock_irq(&priv->fw_dnld.lock);
> 120 if (dev->fw_download_in_progress)
121 nfc_fw_download_done(priv->ndev->nfc_dev, priv->fw_dnld.name, error);
122 spin_unlock_irq(&priv->fw_dnld.lock);
123 }
124

--
0-DAY CI Kernel Test Service
https://01.org/lkp