The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Hyunwoo Kim <imv4bel@gmail.com>, lkundrak@v3.sk
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org, imv4bel@gmail.com, arnd@arndb.de,
	gregkh@linuxfoundation.org, linux@dominikbrodowski.net
Subject: Re: [PATCH v3] char: pcmcia: scr24x_cs: Fix use-after-free in scr24x_fops
Date: Mon, 19 Sep 2022 17:18:55 +0800	[thread overview]
Message-ID: <202209191730.mhZmYKD3-lkp@intel.com> (raw)
In-Reply-To: <20220919040854.GA302968@ubuntu>

Hi Hyunwoo,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on linus/master v6.0-rc6 next-20220916]
[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/Hyunwoo-Kim/char-pcmcia-scr24x_cs-Fix-use-after-free-in-scr24x_fops/20220919-121035
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git ceecbbddbf549fe0b7ffa3804a6e255b3360030f
config: hexagon-randconfig-r041-20220919 (https://download.01.org/0day-ci/archive/20220919/202209191730.mhZmYKD3-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
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/823ffd6f522e65ce9730fe5bc2ea59221adee881
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Hyunwoo-Kim/char-pcmcia-scr24x_cs-Fix-use-after-free-in-scr24x_fops/20220919-121035
        git checkout 823ffd6f522e65ce9730fe5bc2ea59221adee881
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/char/pcmcia/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/char/pcmcia/scr24x_cs.c:107:12: warning: variable 'dev' is uninitialized when used here [-Wuninitialized]
           kref_get(&dev->refcnt);
                     ^~~
   drivers/char/pcmcia/scr24x_cs.c:93:24: note: initialize the variable 'dev' to silence this warning
           struct scr24x_dev *dev;
                                 ^
                                  = NULL
   1 warning generated.


vim +/dev +107 drivers/char/pcmcia/scr24x_cs.c

f2ed287bcc9073 Lubomir Rintel 2016-10-25   90  
f2ed287bcc9073 Lubomir Rintel 2016-10-25   91  static int scr24x_open(struct inode *inode, struct file *filp)
f2ed287bcc9073 Lubomir Rintel 2016-10-25   92  {
823ffd6f522e65 Hyunwoo Kim    2022-09-18   93  	struct scr24x_dev *dev;
823ffd6f522e65 Hyunwoo Kim    2022-09-18   94  	struct pcmcia_device *link;
823ffd6f522e65 Hyunwoo Kim    2022-09-18   95  	int minor = iminor(inode);
823ffd6f522e65 Hyunwoo Kim    2022-09-18   96  
823ffd6f522e65 Hyunwoo Kim    2022-09-18   97  	if (minor >= SCR24X_DEVS)
823ffd6f522e65 Hyunwoo Kim    2022-09-18   98  		return -ENODEV;
823ffd6f522e65 Hyunwoo Kim    2022-09-18   99  
823ffd6f522e65 Hyunwoo Kim    2022-09-18  100  	mutex_lock(&remove_mutex);
823ffd6f522e65 Hyunwoo Kim    2022-09-18  101  	link = dev_table[minor];
823ffd6f522e65 Hyunwoo Kim    2022-09-18  102  	if (link == NULL) {
823ffd6f522e65 Hyunwoo Kim    2022-09-18  103  		mutex_unlock(&remove_mutex);
823ffd6f522e65 Hyunwoo Kim    2022-09-18  104  		return -ENODEV;
823ffd6f522e65 Hyunwoo Kim    2022-09-18  105  	}
f2ed287bcc9073 Lubomir Rintel 2016-10-25  106  
f2ed287bcc9073 Lubomir Rintel 2016-10-25 @107  	kref_get(&dev->refcnt);
f2ed287bcc9073 Lubomir Rintel 2016-10-25  108  	filp->private_data = dev;
823ffd6f522e65 Hyunwoo Kim    2022-09-18  109  	mutex_unlock(&remove_mutex);
f2ed287bcc9073 Lubomir Rintel 2016-10-25  110  
c5bf68fe0c86a5 Kirill Smelkov 2019-03-26  111  	return stream_open(inode, filp);
f2ed287bcc9073 Lubomir Rintel 2016-10-25  112  }
f2ed287bcc9073 Lubomir Rintel 2016-10-25  113  

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

      reply	other threads:[~2022-09-19  9:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19  4:08 [PATCH v3] char: pcmcia: scr24x_cs: Fix use-after-free in scr24x_fops Hyunwoo Kim
2022-09-19  9:18 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202209191730.mhZmYKD3-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=imv4bel@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=lkundrak@v3.sk \
    --cc=llvm@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox