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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 15 Nov 2011 00:46:09 -0800
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	Felipe Balbi <balbi@...com>
Cc:	oskar.andero@...yericsson.com,
	"linux-input@...r.kernel.org" <linux-input@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"jic23@....ac.uk" <jic23@....ac.uk>,
	"aghayal@...eaurora.org" <aghayal@...eaurora.org>,
	"Cavin, Courtney" <Courtney.Cavin@...yericsson.com>
Subject: Re: [PATCH v2] input: add driver support for Sharp gp2ap002a00f
 proximity sensor

Hi Felipe,

On Tue, Nov 15, 2011 at 10:34:55AM +0200, Felipe Balbi wrote:
> Hi,
> 
> On Tue, Nov 15, 2011 at 12:29:26AM -0800, Dmitry Torokhov wrote:
> > > > > +	error = input_register_device(dt->device);
> > > > > +	if (error) {
> > > > > +		dev_err(&dt->device->dev, "device registration failed\n");
> > > > > +		input_free_device(dt->device);
> > > > 
> > > > If you swap request_threaded_irq() and input_register_device() so that
> > > > registration is the last action error handling will be much simpler.
> > > >
> > > 
> > > I am getting a bit confused here, since you asked me to swap the order
> > > of request_threaded_irq() and input_register_device() in my previous
> > > version as well. Swapping again will take us back to square one or maybe
> > > I am misinterpreting your comment?
> > 
> > Gah, sorry, a bit of boilerplate slipped in. You already have the calls
> > in right order, you just need proper labels.
> > 
> > 
> > 	input_dev = input_allocate_device();
> > 	if (!input_dev) {
> > 		dev_err(...);
> > 		error = -ENOMEM;
> > 		goto err_free_mem;
> > 	}
> > 
> > 	... set up input device fully ...
> > 
> > 	error = request_threaded_irq(...);
> > 	if (error) {
> > 		dev_err(...);
> > 		goto err_free_input_dev;
> > 	}
> > 
> > 	error = input_register_device(input_dev);
> > 	if (error) {
> > 		dev_err(...);
> > 		goto err_free_irq;
> > 	}
> 
> are you sure this is right order ? Won't this create a very small
> timeframe where we could try to call input_report_switch() and
> input_sync() on an unregistered input device ??
> 

Yes, this is fine. As long as input device was allocated with
input_allocate_device() it can be used by input_report_*() and
input_sync() even tough device may not be registered yet - the events
will simply be dropped.

Thanks.

-- 
Dmitry
--
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