All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: kernel test robot <lkp@intel.com>
Cc: linux-media@vger.kernel.org, kbuild-all@lists.01.org,
	syzbot+ceef16277388d6f24898@syzkaller.appspotmail.com,
	Hillf Danton <hdanton@sina.com>
Subject: Re: [PATCH 1/2] media: rc: uevent sysfs file races with rc_register_device()
Date: Sat, 8 Aug 2020 19:14:03 +0100	[thread overview]
Message-ID: <20200808181403.GA7560@gofer.mess.org> (raw)
In-Reply-To: <202008082239.nKblgRIG%lkp@intel.com>

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@intel.com>
> 
> 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@lists.01.org



      reply	other threads:[~2020-08-08 18:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-08 12:31 [PATCH 1/2] media: rc: uevent sysfs file races with rc_register_device() Sean Young
2020-08-08 12:31 ` [PATCH 2/2] media: rc: do not access device via sysfs after rc_unregister_device() Sean Young
2020-08-08 14:42 ` [PATCH 1/2] media: rc: uevent sysfs file races with rc_register_device() kernel test robot
2020-08-08 14:42   ` kernel test robot
2020-08-08 18:14   ` Sean Young [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=20200808181403.GA7560@gofer.mess.org \
    --to=sean@mess.org \
    --cc=hdanton@sina.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=syzbot+ceef16277388d6f24898@syzkaller.appspotmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.