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>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 22 Nov 2010 11:41:27 +0100
From:	Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:	Hans Verkuil <hverkuil@...all.nl>
Cc:	Jonathan Corbet <corbet@....net>, linux-media@...r.kernel.org,
	sakari.ailus@...well.research.nokia.com,
	linux-kernel@...r.kernel.org
Subject: What should poll() return when a device is unregistered ? (was "media: Media device node support")

Hi Hans,

On Monday 22 November 2010 10:08:06 Hans Verkuil wrote:
> On Monday, November 22, 2010 00:35:54 Laurent Pinchart wrote:
> > Hi Jonathan,
> > 
> > I forgot to answer one of your comments.
> > 
> > On Wednesday 17 November 2010 01:31:15 Jonathan Corbet wrote:
> > 
> > [snip]
> > 
> > > > +static unsigned int media_poll(struct file *filp,
> > > > +			       struct poll_table_struct *poll)
> > > > +{
> > > > +	struct media_devnode *mdev = media_devnode_data(filp);
> > > > +
> > > > +	if (!mdev->fops->poll || !media_devnode_is_registered(mdev))
> > > > +		return DEFAULT_POLLMASK;
> > > > +	return mdev->fops->poll(filp, poll);
> > > > +}
> > > 
> > > If it's not registered, I would expect poll() to return an error.
> > 
> > Agreed. I'll return POLLERR | POLLHUP in that case. Is that fine with you
> > ?
> 
> When I looked at this for the core code I decided to just return POLLERR.

I've copied the usbdevfs code which returns POLLERR | POLLHUP when devices are 
disconnected.

> That seemed to be what the majority of other usb drivers do. ALSA returns
> POLLERR | POLLNVAL, by the way, which I think is a poor choice.

Indeed, POLLNVAL has a clear semantics that doesn't apply here.

> This doesn't really seem to be standardized :-(

CC'ing LKML with the question.

POLLERR | POLLHUP and POLLERR won't make a difference to select(), but we 
should still standardize on a poll() return code when devices are unregistered 
and/or - for hot-pluggable devices - disconnected (for V4L devices 
unregistered usually means disconnected) ?

-- 
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ