lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202109020425.tObTnysX-lkp@intel.com>
Date:   Fri, 3 Sep 2021 11:10:55 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Cai Huoqing <caihuoqing@...du.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Hans Verkuil <hverkuil@...all.nl>
Subject: [hverkuil-media:for-v5.16c 7/24]
 drivers/media/usb/siano/smsusb.c:354 smsusb_term_device() error: we
 previously assumed 'dev' could be null (see line 340)

tree:   git://linuxtv.org/hverkuil/media_tree.git for-v5.16c
head:   1ff8a1958e10f52762323ab98ad84bd417c4bd24
commit: 84f96613da19427380d40262262745e27ffc7c75 [7/24] media: smsusb: Use usb_get_dev() for the reference count of udev
config: arm64-randconfig-m031-20210831 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
drivers/media/usb/siano/smsusb.c:354 smsusb_term_device() error: we previously assumed 'dev' could be null (see line 340)
drivers/media/usb/siano/smsusb.c:354 smsusb_term_device() error: dereferencing freed memory 'dev'

vim +/dev +354 drivers/media/usb/siano/smsusb.c

0c071f374f66f0 drivers/media/dvb/siano/smsusb.c Michael Krufky        2008-06-21  336  static void smsusb_term_device(struct usb_interface *intf)
2e5c1ec8865abd drivers/media/mdtv/smsusb.c      Michael Krufky        2008-05-19  337  {
8350e1551c27ee drivers/media/dvb/siano/smsusb.c Joe Perches           2010-11-30  338  	struct smsusb_device_t *dev = usb_get_intfdata(intf);
2e5c1ec8865abd drivers/media/mdtv/smsusb.c      Michael Krufky        2008-05-19  339  
822374165d6b11 drivers/media/dvb/siano/smsusb.c Michael Krufky        2008-06-15 @340  	if (dev) {
                                                                                            ^^^
Check for NULL here.  (Unnecessary, "dev" can't be NULL at this point).

05f0ffbc487517 drivers/media/usb/siano/smsusb.c Mauro Carvalho Chehab 2013-03-06  341  		dev->state = SMSUSB_DISCONNECTED;
05f0ffbc487517 drivers/media/usb/siano/smsusb.c Mauro Carvalho Chehab 2013-03-06  342  
2e5c1ec8865abd drivers/media/mdtv/smsusb.c      Michael Krufky        2008-05-19  343  		smsusb_stop_streaming(dev);
2e5c1ec8865abd drivers/media/mdtv/smsusb.c      Michael Krufky        2008-05-19  344  
fa830e8a014a20 drivers/media/dvb/siano/smsusb.c Michael Krufky        2008-06-15  345  		/* unregister from smscore */
2e5c1ec8865abd drivers/media/mdtv/smsusb.c      Michael Krufky        2008-05-19  346  		if (dev->coredev)
2e5c1ec8865abd drivers/media/mdtv/smsusb.c      Michael Krufky        2008-05-19  347  			smscore_unregister_device(dev->coredev);
2e5c1ec8865abd drivers/media/mdtv/smsusb.c      Michael Krufky        2008-05-19  348  
0dd5f20cb35b59 drivers/media/usb/siano/smsusb.c Mauro Carvalho Chehab 2015-02-22  349  		pr_debug("device 0x%p destroyed\n", dev);
08921ac9e9d185 drivers/media/dvb/siano/smsusb.c Jesper Juhl           2011-04-21  350  		kfree(dev);
                                                                                                      ^^^
"dev" is freed.

2e5c1ec8865abd drivers/media/mdtv/smsusb.c      Michael Krufky        2008-05-19  351  	}
2e5c1ec8865abd drivers/media/mdtv/smsusb.c      Michael Krufky        2008-05-19  352  
2e5c1ec8865abd drivers/media/mdtv/smsusb.c      Michael Krufky        2008-05-19  353  	usb_set_intfdata(intf, NULL);
84f96613da1942 drivers/media/usb/siano/smsusb.c Cai Huoqing           2021-08-02 @354  	usb_put_dev(dev->udev);
                                                                                                    ^^^
Use after free.

2e5c1ec8865abd drivers/media/mdtv/smsusb.c      Michael Krufky        2008-05-19  355  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ