From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
John Kacur <jkacur@gmail.com>
Subject: Re: [PATCH 2/3] input: use input_mutex instead of BKL when opening input device
Date: Tue, 9 Mar 2010 22:20:15 -0800 [thread overview]
Message-ID: <20100310062015.GA2445@core.coreip.homeip.net> (raw)
In-Reply-To: <20100309205947.GB1498@holoscopio.com>
On Tue, Mar 09, 2010 at 05:59:48PM -0300, Thadeu Lima de Souza Cascardo wrote:
> On Tue, Mar 09, 2010 at 09:12:13PM +0100, Arnd Bergmann wrote:
> > On Tuesday 09 March 2010, Thadeu Lima de Souza Cascardo wrote:
> > > MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
> > > @@ -1881,7 +1880,7 @@ static int input_open_file(struct inode *inode, struct file *file)
> > > const struct file_operations *old_fops, *new_fops = NULL;
> > > int err;
> > >
> > > - lock_kernel();
> > > + mutex_lock(&input_mutex);
> > > /* No load-on-demand here? */
> > > handler = input_table[iminor(inode) >> 5];
> > > if (!handler || !(new_fops = fops_get(handler->fops))) {
> > > @@ -1909,7 +1908,7 @@ static int input_open_file(struct inode *inode, struct file *file)
> > > }
> > > fops_put(old_fops);
> > > out:
> > > - unlock_kernel();
> > > + mutex_unlock(&input_mutex);
> > > return err;
> > > }
> > >
> > > --
> >
> > Well, actually please have a look at
> > http://git.kernel.org/?p=linux/kernel/git/arnd/playground.git;a=commitdiff;h=c06fd0234357618a5741ce958d58901ae4cb7ac1
> >
> > * use mutex_lock_interruptible() where possible
> > * you probably don't want to hold input_mutex when calling into the lower
> > device's open function
> >
> > Arnd
>
> Yeah. I was just looking at your appointed branch. And I've noticed your
> change was better.
>
> I was willing to let the open call go unprotected. But ended up checking
> that the three callees were fine (they do not call any of the other
> functions that take the mutex).
>
> Since the fops_put/fops_get do protect that section from the handler
> removal and I can't think of any other race right now, I think your
> version is really better.
>
> Acked-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
>
OK, applied 2 Thadeu's patches and one Arnd's.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2010-03-10 6:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-09 19:19 [PATCH 1/3] input: remove BKL from mousedev Thadeu Lima de Souza Cascardo
2010-03-09 19:19 ` [PATCH 2/3] input: use input_mutex instead of BKL when opening input device Thadeu Lima de Souza Cascardo
2010-03-09 19:19 ` [PATCH 3/3] input: remove BKL from serio_raw Thadeu Lima de Souza Cascardo
2010-03-09 20:06 ` Arnd Bergmann
2010-03-09 20:06 ` [PATCH 2/3] input: use input_mutex instead of BKL when opening input device Arnd Bergmann
2010-03-09 20:12 ` Arnd Bergmann
2010-03-09 20:59 ` Thadeu Lima de Souza Cascardo
2010-03-10 6:20 ` Dmitry Torokhov [this message]
2010-03-10 6:49 ` Oliver Neukum
2010-03-10 6:56 ` Dmitry Torokhov
2010-03-09 20:05 ` [PATCH 1/3] input: remove BKL from mousedev Arnd Bergmann
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=20100310062015.GA2445@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=arnd@arndb.de \
--cc=cascardo@holoscopio.com \
--cc=jkacur@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).