Re: [PATCH 1/2] media: rc: uevent sysfs file races with rc_register_device()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 08, 2020 at 10:42:00PM +0800, kernel test robot wrote:
> Hi Sean,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on linuxtv-media/master]
> [also build test WARNING on v5.8 next-20200807]
> [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/0day-ci/linux/commits/Sean-Young/media-rc-uevent-sysfs-file-races-with-rc_register_device/20200808-203329
> base:   git://linuxtv.org/media_tree.git master
> config: x86_64-randconfig-m001-20200808 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> 
> smatch warnings:
> drivers/media/rc/rc-main.c:1630 rc_dev_uevent() warn: inconsistent returns 'dev->lock'.

smatch is totally right here, there are code paths where the mutex is not
unlocked. Oops.

I'll send out a v2 shortly.

Sean

> 
> vim +1630 drivers/media/rc/rc-main.c
> 
> d8b4b5822f51e2 David Härdeman       2010-10-29  1603  
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1604  #define ADD_HOTPLUG_VAR(fmt, val...)					\
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1605  	do {								\
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1606  		int err = add_uevent_var(env, fmt, val);		\
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1607  		if (err)						\
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1608  			return err;					\
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1609  	} while (0)
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1610  
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1611  static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env)
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1612  {
> d8b4b5822f51e2 David Härdeman       2010-10-29  1613  	struct rc_dev *dev = to_rc_dev(device);
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1614  
> e4b7677d34e789 Sean Young            2020-08-08  1615  	mutex_lock(&dev->lock);
> e4b7677d34e789 Sean Young            2020-08-08  1616  	if (!dev->registered) {
> e4b7677d34e789 Sean Young            2020-08-08  1617  		mutex_unlock(&dev->lock);
> e4b7677d34e789 Sean Young            2020-08-08  1618  		return -ENODEV;
> e4b7677d34e789 Sean Young            2020-08-08  1619  	}
> e4b7677d34e789 Sean Young            2020-08-08  1620  
> b088ba658b3438 Mauro Carvalho Chehab 2010-11-17  1621  	if (dev->rc_map.name)
> b088ba658b3438 Mauro Carvalho Chehab 2010-11-17  1622  		ADD_HOTPLUG_VAR("NAME=%s", dev->rc_map.name);
> d8b4b5822f51e2 David Härdeman       2010-10-29  1623  	if (dev->driver_name)
> d8b4b5822f51e2 David Härdeman       2010-10-29  1624  		ADD_HOTPLUG_VAR("DRV_NAME=%s", dev->driver_name);
> b9f407e31c5073 Sean Young            2017-09-01  1625  	if (dev->device_name)
> b9f407e31c5073 Sean Young            2017-09-01  1626  		ADD_HOTPLUG_VAR("DEV_NAME=%s", dev->device_name);
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1627  
> e4b7677d34e789 Sean Young            2020-08-08  1628  	mutex_unlock(&dev->lock);
> e4b7677d34e789 Sean Young            2020-08-08  1629  
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09 @1630  	return 0;
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1631  }
> bc2a6c5719efd7 Mauro Carvalho Chehab 2010-11-09  1632  
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux